Skip to content

Commit b2be242

Browse files
vadimp-nvidiagroeck
authored andcommitted
hwmon: (mlxreg-fan) Support distinctive names per different cooling devices
Provide different names for cooling devices registration to allow binding each cooling devices to relevant thermal zone. Thus, specific cooling device can be associated with related thermal sensor by setting thermal cooling device type for example to "mlxreg_fan2" and passing this type to thermal_zone_bind_cooling_device() through 'cdev->type'. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Link: https://lore.kernel.org/r/20210926053541.1806937-3-vadimp@nvidia.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent b1c2423 commit b2be242

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/hwmon/mlxreg-fan.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ mlxreg_fan_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr,
263263
return 0;
264264
}
265265

266+
static char *mlxreg_fan_name[] = {
267+
"mlxreg_fan",
268+
"mlxreg_fan1",
269+
"mlxreg_fan2",
270+
"mlxreg_fan3",
271+
};
272+
266273
static const struct hwmon_channel_info *mlxreg_fan_hwmon_info[] = {
267274
HWMON_CHANNEL_INFO(fan,
268275
HWMON_F_INPUT | HWMON_F_FAULT,
@@ -565,8 +572,8 @@ static int mlxreg_fan_cooling_config(struct device *dev, struct mlxreg_fan *fan)
565572
if (!pwm->connected)
566573
continue;
567574
pwm->fan = fan;
568-
pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, "mlxreg_fan", pwm,
569-
&mlxreg_fan_cooling_ops);
575+
pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, mlxreg_fan_name[i],
576+
pwm, &mlxreg_fan_cooling_ops);
570577
if (IS_ERR(pwm->cdev)) {
571578
dev_err(dev, "Failed to register cooling device\n");
572579
return PTR_ERR(pwm->cdev);

0 commit comments

Comments
 (0)