Skip to content

Commit 4a16c19

Browse files
dlezcanorafaeljw
authored andcommitted
thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs()
The devres variant of thermal_add_hwmon_sysfs() only takes the thermal zone structure pointer as parameter. Actually, it uses the tz->device to add it in the devres list. It is preferable to use the device registering the thermal zone instead of the thermal zone device itself. That prevents the driver accessing the thermal zone structure internals and it is from my POV more correct regarding how devm_ is used. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> #amlogic_thermal Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> #sun8i_thermal Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> #MediaTek auxadc Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 8f3f4ad commit 4a16c19

14 files changed

Lines changed: 16 additions & 16 deletions

drivers/thermal/amlogic_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
285285
return ret;
286286
}
287287

288-
if (devm_thermal_add_hwmon_sysfs(pdata->tzd))
288+
if (devm_thermal_add_hwmon_sysfs(&pdev->dev, pdata->tzd))
289289
dev_warn(&pdev->dev, "Failed to add hwmon sysfs attributes\n");
290290

291291
ret = amlogic_thermal_initialize(pdata);

drivers/thermal/imx8mm_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
343343
}
344344
tmu->sensors[i].hw_id = i;
345345

346-
if (devm_thermal_add_hwmon_sysfs(tmu->sensors[i].tzd))
346+
if (devm_thermal_add_hwmon_sysfs(&pdev->dev, tmu->sensors[i].tzd))
347347
dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n");
348348
}
349349

drivers/thermal/imx_sc_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
116116
return ret;
117117
}
118118

119-
if (devm_thermal_add_hwmon_sysfs(sensor->tzd))
119+
if (devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd))
120120
dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n");
121121
}
122122

drivers/thermal/k3_bandgap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static int k3_bandgap_probe(struct platform_device *pdev)
222222
goto err_alloc;
223223
}
224224

225-
if (devm_thermal_add_hwmon_sysfs(data[id].tzd))
225+
if (devm_thermal_add_hwmon_sysfs(dev, data[id].tzd))
226226
dev_warn(dev, "Failed to add hwmon sysfs attributes\n");
227227
}
228228

drivers/thermal/mediatek/auxadc_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
12101210
goto err_disable_clk_peri_therm;
12111211
}
12121212

1213-
ret = devm_thermal_add_hwmon_sysfs(tzdev);
1213+
ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
12141214
if (ret)
12151215
dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs");
12161216

drivers/thermal/qcom/qcom-spmi-adc-tm5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
689689
return PTR_ERR(tzd);
690690
}
691691
adc_tm->channels[i].tzd = tzd;
692-
if (devm_thermal_add_hwmon_sysfs(tzd))
692+
if (devm_thermal_add_hwmon_sysfs(adc_tm->dev, tzd))
693693
dev_warn(adc_tm->dev,
694694
"Failed to add hwmon sysfs attributes\n");
695695
}

drivers/thermal/qcom/qcom-spmi-temp-alarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static int qpnp_tm_probe(struct platform_device *pdev)
459459
return ret;
460460
}
461461

462-
if (devm_thermal_add_hwmon_sysfs(chip->tz_dev))
462+
if (devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev))
463463
dev_warn(&pdev->dev,
464464
"Failed to add hwmon sysfs attributes\n");
465465

drivers/thermal/qcom/tsens.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ static int tsens_register(struct tsens_priv *priv)
11891189
if (priv->ops->enable)
11901190
priv->ops->enable(priv, i);
11911191

1192-
if (devm_thermal_add_hwmon_sysfs(tzd))
1192+
if (devm_thermal_add_hwmon_sysfs(priv->dev, tzd))
11931193
dev_warn(priv->dev,
11941194
"Failed to add hwmon sysfs attributes\n");
11951195
}

drivers/thermal/qoriq_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int qoriq_tmu_register_tmu_zone(struct device *dev,
157157
return ret;
158158
}
159159

160-
if (devm_thermal_add_hwmon_sysfs(tzd))
160+
if (devm_thermal_add_hwmon_sysfs(dev, tzd))
161161
dev_warn(dev,
162162
"Failed to add hwmon sysfs attributes\n");
163163

drivers/thermal/sun8i_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ static int sun8i_ths_register(struct ths_device *tmdev)
475475
if (IS_ERR(tmdev->sensor[i].tzd))
476476
return PTR_ERR(tmdev->sensor[i].tzd);
477477

478-
if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
478+
if (devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd))
479479
dev_warn(tmdev->dev,
480480
"Failed to add hwmon sysfs attributes\n");
481481
}

0 commit comments

Comments
 (0)