Commit 4a16c190 authored by Daniel Lezcano's avatar Daniel Lezcano Committed by Rafael J. Wysocki
Browse files

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: default avatarDaniel 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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 8f3f4ad4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
		return ret;
	}

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

	ret = amlogic_thermal_initialize(pdata);
+1 −1
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
		}
		tmu->sensors[i].hw_id = i;

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

+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
			return ret;
		}

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

+1 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ static int k3_bandgap_probe(struct platform_device *pdev)
			goto err_alloc;
		}

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

+1 −1
Original line number Diff line number Diff line
@@ -1210,7 +1210,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
		goto err_disable_clk_peri_therm;
	}

	ret = devm_thermal_add_hwmon_sysfs(tzdev);
	ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev);
	if (ret)
		dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs");

Loading