diff mbox series

[v1,04/17] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs()

Message ID 20230219143657.241542-5-daniel.lezcano@linaro.org
State Superseded
Headers show
Series Self-encapsulate the thermal zone device structure | expand

Commit Message

Daniel Lezcano Feb. 19, 2023, 2:36 p.m. UTC
The thermal->tzp->no_hwmon parameter is only used when calling
thermal_zone_device_register().

Setting it to 'false' before calling thermal_add_hwmon_sysfs() has no
effect.

Remove the call and again prevent the drivers to access the thermal
internals.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/broadcom/bcm2711_thermal.c | 1 -
 drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
 drivers/thermal/rcar_gen3_thermal.c        | 1 -
 drivers/thermal/rcar_thermal.c             | 5 -----
 drivers/thermal/rockchip_thermal.c         | 1 -
 drivers/thermal/rzg2l_thermal.c            | 1 -
 6 files changed, 10 deletions(-)

Comments

Niklas Söderlund Feb. 19, 2023, 3:08 p.m. UTC | #1
Hi Daniel,

Thanks for your work.

On 2023-02-19 15:36:44 +0100, Daniel Lezcano wrote:
> The thermal->tzp->no_hwmon parameter is only used when calling
> thermal_zone_device_register().
> 
> Setting it to 'false' before calling thermal_add_hwmon_sysfs() has no
> effect.
> 
> Remove the call and again prevent the drivers to access the thermal
> internals.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/thermal/broadcom/bcm2711_thermal.c | 1 -
>  drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
>  drivers/thermal/rcar_gen3_thermal.c        | 1 -
>  drivers/thermal/rcar_thermal.c             | 5 -----

For R-Car,

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

>  drivers/thermal/rockchip_thermal.c         | 1 -
>  drivers/thermal/rzg2l_thermal.c            | 1 -
>  6 files changed, 10 deletions(-)
> 
> diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
> index 18b1a4d9ecc7..0a499435431c 100644
> --- a/drivers/thermal/broadcom/bcm2711_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2711_thermal.c
> @@ -98,7 +98,6 @@ static int bcm2711_thermal_probe(struct platform_device *pdev)
>  
>  	priv->thermal = thermal;
>  
> -	thermal->tzp->no_hwmon = false;
>  	return thermal_add_hwmon_sysfs(thermal);
>  }
>  
> diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
> index de2f573863da..8ed7a80122a0 100644
> --- a/drivers/thermal/broadcom/bcm2835_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2835_thermal.c
> @@ -267,7 +267,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
>  	 * Thermal_zone doesn't enable hwmon as default,
>  	 * enable it here
>  	 */
> -	tz->tzp->no_hwmon = false;
>  	err = thermal_add_hwmon_sysfs(tz);
>  	if (err)
>  		goto err_tz;
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index 8ad713cb4bf7..4ea9d4bd8e6f 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -527,7 +527,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
>  		}
>  		tsc->zone = zone;
>  
> -		tsc->zone->tzp->no_hwmon = false;
>  		ret = thermal_add_hwmon_sysfs(tsc->zone);
>  		if (ret)
>  			goto error_unregister;
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 538ed6731589..919f0e32d3c5 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -509,11 +509,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  		}
>  
>  		if (chip->use_of_thermal) {
> -			/*
> -			 * thermal_zone doesn't enable hwmon as default,
> -			 * but, enable it here to keep compatible
> -			 */
> -			priv->zone->tzp->no_hwmon = false;
>  			ret = thermal_add_hwmon_sysfs(priv->zone);
>  			if (ret)
>  				goto error_unregister;
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index bd593ec712ee..3211b70c85b9 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -1451,7 +1451,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
>  
>  	for (i = 0; i < thermal->chip->chn_num; i++) {
>  		rockchip_thermal_toggle_sensor(&thermal->sensors[i], true);
> -		thermal->sensors[i].tzd->tzp->no_hwmon = false;
>  		error = thermal_add_hwmon_sysfs(thermal->sensors[i].tzd);
>  		if (error)
>  			dev_warn(&pdev->dev,
> diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
> index d3ba2a74e42d..a2f21c941cfe 100644
> --- a/drivers/thermal/rzg2l_thermal.c
> +++ b/drivers/thermal/rzg2l_thermal.c
> @@ -216,7 +216,6 @@ static int rzg2l_thermal_probe(struct platform_device *pdev)
>  	}
>  
>  	priv->zone = zone;
> -	priv->zone->tzp->no_hwmon = false;
>  	ret = thermal_add_hwmon_sysfs(priv->zone);
>  	if (ret)
>  		goto err;
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
index 18b1a4d9ecc7..0a499435431c 100644
--- a/drivers/thermal/broadcom/bcm2711_thermal.c
+++ b/drivers/thermal/broadcom/bcm2711_thermal.c
@@ -98,7 +98,6 @@  static int bcm2711_thermal_probe(struct platform_device *pdev)
 
 	priv->thermal = thermal;
 
-	thermal->tzp->no_hwmon = false;
 	return thermal_add_hwmon_sysfs(thermal);
 }
 
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index de2f573863da..8ed7a80122a0 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -267,7 +267,6 @@  static int bcm2835_thermal_probe(struct platform_device *pdev)
 	 * Thermal_zone doesn't enable hwmon as default,
 	 * enable it here
 	 */
-	tz->tzp->no_hwmon = false;
 	err = thermal_add_hwmon_sysfs(tz);
 	if (err)
 		goto err_tz;
diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index 8ad713cb4bf7..4ea9d4bd8e6f 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -527,7 +527,6 @@  static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 		}
 		tsc->zone = zone;
 
-		tsc->zone->tzp->no_hwmon = false;
 		ret = thermal_add_hwmon_sysfs(tsc->zone);
 		if (ret)
 			goto error_unregister;
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 538ed6731589..919f0e32d3c5 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -509,11 +509,6 @@  static int rcar_thermal_probe(struct platform_device *pdev)
 		}
 
 		if (chip->use_of_thermal) {
-			/*
-			 * thermal_zone doesn't enable hwmon as default,
-			 * but, enable it here to keep compatible
-			 */
-			priv->zone->tzp->no_hwmon = false;
 			ret = thermal_add_hwmon_sysfs(priv->zone);
 			if (ret)
 				goto error_unregister;
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index bd593ec712ee..3211b70c85b9 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1451,7 +1451,6 @@  static int rockchip_thermal_probe(struct platform_device *pdev)
 
 	for (i = 0; i < thermal->chip->chn_num; i++) {
 		rockchip_thermal_toggle_sensor(&thermal->sensors[i], true);
-		thermal->sensors[i].tzd->tzp->no_hwmon = false;
 		error = thermal_add_hwmon_sysfs(thermal->sensors[i].tzd);
 		if (error)
 			dev_warn(&pdev->dev,
diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
index d3ba2a74e42d..a2f21c941cfe 100644
--- a/drivers/thermal/rzg2l_thermal.c
+++ b/drivers/thermal/rzg2l_thermal.c
@@ -216,7 +216,6 @@  static int rzg2l_thermal_probe(struct platform_device *pdev)
 	}
 
 	priv->zone = zone;
-	priv->zone->tzp->no_hwmon = false;
 	ret = thermal_add_hwmon_sysfs(priv->zone);
 	if (ret)
 		goto err;