diff mbox series

[v1,04/11] thermal/drivers/db8500: Use driver dev instead of tz->device

Message ID 20230307133735.90772-5-daniel.lezcano@linaro.org
State Accepted
Commit 311526b7e38fb35ab6dcdec290babda3d2b4f8d3
Headers show
Series [v1,01/11] thermal/core: Relocate the traces definition in thermal directory | expand

Commit Message

Daniel Lezcano March 7, 2023, 1:37 p.m. UTC
The db8500 driver uses the thermal zone device instead of the device
attached to it. In order to prevent the drivers to access the thermal
zone device structure, replace the thermal zone device by the driver
to show the debug message.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/db8500_thermal.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Linus Walleij March 7, 2023, 8:52 p.m. UTC | #1
On Tue, Mar 7, 2023 at 2:37 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:

> The db8500 driver uses the thermal zone device instead of the device
> attached to it. In order to prevent the drivers to access the thermal
> zone device structure, replace the thermal zone device by the driver
> to show the debug message.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Yep that's the right thing to do.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
index c0418497520c..de790e526ca5 100644
--- a/drivers/thermal/db8500_thermal.c
+++ b/drivers/thermal/db8500_thermal.c
@@ -53,6 +53,7 @@  static const unsigned long db8500_thermal_points[] = {
 
 struct db8500_thermal_zone {
 	struct thermal_zone_device *tz;
+	struct device *dev;
 	unsigned long interpolated_temp;
 	unsigned int cur_index;
 };
@@ -114,7 +115,7 @@  static irqreturn_t prcmu_low_irq_handler(int irq, void *irq_data)
 	idx -= 1;
 
 	db8500_thermal_update_config(th, idx, next_low, next_high);
-	dev_dbg(&th->tz->device,
+	dev_dbg(th->dev,
 		"PRCMU set max %ld, min %ld\n", next_high, next_low);
 
 	thermal_zone_device_update(th->tz, THERMAL_EVENT_UNSPECIFIED);
@@ -136,7 +137,7 @@  static irqreturn_t prcmu_high_irq_handler(int irq, void *irq_data)
 
 		db8500_thermal_update_config(th, idx, next_low, next_high);
 
-		dev_dbg(&th->tz->device,
+		dev_dbg(th->dev,
 			"PRCMU set max %ld, min %ld\n", next_high, next_low);
 	} else if (idx == num_points - 1)
 		/* So we roof out 1 degree over the max point */
@@ -157,6 +158,8 @@  static int db8500_thermal_probe(struct platform_device *pdev)
 	if (!th)
 		return -ENOMEM;
 
+	th->dev = dev;
+	
 	low_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_LOW");
 	if (low_irq < 0)
 		return low_irq;