public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: rafael@kernel.org, daniel.lezcano@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Balsam CHIHI <bchihi@baylibre.com>,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Keerthy <j-keerthy@ti.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Ido Schimmel <idosch@nvidia.com>, Mark Brown <broonie@kernel.org>,
	linux-arm-kernel@lists.infradead.org (moderated
	list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE),
	linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL
	DRIVER),
	linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek
	SoC support)
Subject: [PATCH v2 06/16] thermal: Don't use 'device' internal thermal zone structure field
Date: Tue, 21 Feb 2023 19:07:00 +0100	[thread overview]
Message-ID: <20230221180710.2781027-7-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <20230221180710.2781027-1-daniel.lezcano@linaro.org>

Some drivers are directly using the thermal zone's 'device' structure
field.

Use the driver device pointer instead of the thermal zone device when
it is available.

Remove the traces when they are duplicate with the traces in the core
code.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Balsam CHIHI <bchihi@baylibre.com> #Mediatek LVTS
---
 drivers/thermal/imx_thermal.c                 | 37 ++++---------------
 drivers/thermal/mediatek/lvts_thermal.c       |  4 +-
 drivers/thermal/thermal_hwmon.c               |  4 +-
 .../ti-soc-thermal/ti-thermal-common.c        |  2 +-
 4 files changed, 13 insertions(+), 34 deletions(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index a0b8de269986..c3136978adee 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -285,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
 		if (data->alarm_temp == trips[IMX_TRIP_CRITICAL].temperature &&
 			*temp < trips[IMX_TRIP_PASSIVE].temperature) {
 			imx_set_alarm_temp(data, trips[IMX_TRIP_PASSIVE].temperature);
-			dev_dbg(&tz->device, "thermal alarm off: T < %d\n",
+			dev_dbg(data->dev, "thermal alarm off: T < %d\n",
 				data->alarm_temp / 1000);
 		}
 	}
 
 	if (*temp != data->last_temp) {
-		dev_dbg(&tz->device, "millicelsius: %d\n", *temp);
+		dev_dbg(data->dev, "millicelsius: %d\n", *temp);
 		data->last_temp = *temp;
 	}
 
@@ -367,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
 static int imx_bind(struct thermal_zone_device *tz,
 		    struct thermal_cooling_device *cdev)
 {
-	int ret;
-
-	ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev,
-					       THERMAL_NO_LIMIT,
-					       THERMAL_NO_LIMIT,
-					       THERMAL_WEIGHT_DEFAULT);
-	if (ret) {
-		dev_err(&tz->device,
-			"binding zone %s with cdev %s failed:%d\n",
-			tz->type, cdev->type, ret);
-		return ret;
-	}
-
-	return 0;
+	return thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev,
+						THERMAL_NO_LIMIT,
+						THERMAL_NO_LIMIT,
+						THERMAL_WEIGHT_DEFAULT);
 }
 
 static int imx_unbind(struct thermal_zone_device *tz,
 		      struct thermal_cooling_device *cdev)
 {
-	int ret;
-
-	ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev);
-	if (ret) {
-		dev_err(&tz->device,
-			"unbinding zone %s with cdev %s failed:%d\n",
-			tz->type, cdev->type, ret);
-		return ret;
-	}
-
-	return 0;
+	return thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev);
 }
 
 static struct thermal_zone_device_ops imx_tz_ops = {
@@ -558,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
 {
 	struct imx_thermal_data *data = dev;
 
-	dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n",
-		data->alarm_temp / 1000);
+	dev_dbg(data->dev, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000);
 
 	thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED);
 
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index fb4b1b4db245..beb835d644e2 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -305,7 +305,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
 	 * 14-0 : Raw temperature for threshold
 	 */
 	if (low != -INT_MAX) {
-		dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", low);
+		pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, low);
 		writel(raw_low, LVTS_H2NTHRE(base));
 	}
 
@@ -318,7 +318,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
 	 *
 	 * 14-0 : Raw temperature for threshold
 	 */
-	dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", high);
+	pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, high);
 	writel(raw_high, LVTS_HTHRE(base));
 
 	return 0;
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index 964db7941e31..bc02095b314c 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -228,14 +228,14 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
 	hwmon = thermal_hwmon_lookup_by_type(tz);
 	if (unlikely(!hwmon)) {
 		/* Should never happen... */
-		dev_dbg(&tz->device, "hwmon device lookup failed!\n");
+		dev_dbg(hwmon->device, "hwmon device lookup failed!\n");
 		return;
 	}
 
 	temp = thermal_hwmon_lookup_temp(hwmon, tz);
 	if (unlikely(!temp)) {
 		/* Should never happen... */
-		dev_dbg(&tz->device, "temperature input lookup failed!\n");
+		dev_dbg(hwmon->device, "temperature input lookup failed!\n");
 		return;
 	}
 
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
index 216b29068b08..060f46cea5ff 100644
--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
@@ -43,7 +43,7 @@ static void ti_thermal_work(struct work_struct *work)
 
 	thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED);
 
-	dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n",
+	dev_dbg(data->bgp->dev, "updated thermal zone %s\n",
 		data->ti_thermal->type);
 }
 
-- 
2.34.1


  parent reply	other threads:[~2023-02-21 18:09 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 18:06 [PATCH v2 00/17] Self-encapsulate the thermal zone device structure Daniel Lezcano
2023-02-21 18:06 ` [PATCH v2 01/16] thermal/core: Add a thermal zone 'devdata' accessor Daniel Lezcano
2023-02-21 18:20   ` Jernej Škrabec
2023-02-22 19:19   ` Rafael J. Wysocki
2023-02-22 19:20   ` Florian Fainelli
2023-02-21 18:06 ` [PATCH v2 02/16] thermal/core: Show a debug message when get_temp() fails Daniel Lezcano
2023-02-22 19:25   ` Rafael J. Wysocki
2023-02-21 18:06 ` [PATCH v2 03/16] thermal: Remove debug or error messages in get_temp() ops Daniel Lezcano
2023-02-22 19:23   ` Florian Fainelli
2023-02-21 18:06 ` [PATCH v2 04/16] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs() Daniel Lezcano
2023-02-22 19:23   ` Florian Fainelli
2023-02-21 18:06 ` [PATCH v2 05/16] thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() Daniel Lezcano
2023-02-21 18:22   ` Jernej Škrabec
2023-02-22  9:31   ` AngeloGioacchino Del Regno
2023-02-21 18:07 ` Daniel Lezcano [this message]
2023-02-22  9:31   ` [PATCH v2 06/16] thermal: Don't use 'device' internal thermal zone structure field AngeloGioacchino Del Regno
2023-02-22 19:43   ` Rafael J. Wysocki
2023-02-22 20:00     ` Daniel Lezcano
2023-02-22 20:06       ` Rafael J. Wysocki
2023-02-23  9:56         ` Daniel Lezcano
2023-02-23 11:43           ` Rafael J. Wysocki
2023-02-23 14:35             ` Daniel Lezcano
2023-02-21 18:07 ` [PATCH v2 07/16] thermal/drivers/spear: Don't use tz->device but pdev->dev Daniel Lezcano
2023-02-21 18:07 ` [PATCH v2 08/16] thermal: Add a thermal zone id accessor Daniel Lezcano
2023-02-22 19:45   ` Rafael J. Wysocki
2023-02-21 18:07 ` [PATCH v2 09/16] thermal: Do not access 'type' field, use the tz id instead Daniel Lezcano
2023-02-22  9:31   ` AngeloGioacchino Del Regno
2023-02-22 19:47   ` Rafael J. Wysocki
2023-02-21 18:07 ` [PATCH v2 10/16] thermal/drivers/da9062: Don't access the thermal zone device fields Daniel Lezcano
2023-02-21 18:07 ` [PATCH v2 11/16] thermal/hwmon: Use the thermal_core.h header Daniel Lezcano
2023-02-21 18:37   ` Guenter Roeck
2023-02-21 18:07 ` [PATCH v2 12/16] thermal/drivers/tegra: Remove unneeded lock when setting a trip point Daniel Lezcano
2023-02-21 18:07 ` [PATCH v2 13/16] thermal/tegra: Do not enable the thermal zone, it is already enabled Daniel Lezcano
2023-02-21 18:07 ` [PATCH v2 14/16] thermal/drivers/acerhdf: Make interval setting only at module load time Daniel Lezcano
2023-02-21 20:07   ` Hans de Goede
2023-02-21 18:07 ` [PATCH v2 15/16] thermal/drivers/acerhdf: Remove pointless governor test Daniel Lezcano
2023-02-21 20:07   ` Hans de Goede
2023-02-21 18:07 ` [PATCH v2 16/16] thermal/traces: Replace the thermal zone structure parameter with the field value Daniel Lezcano
2023-02-22 19:51   ` Rafael J. Wysocki
2023-02-22 20:02     ` Daniel Lezcano
2023-02-22 20:07       ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230221180710.2781027-7-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bchihi@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=edubezval@gmail.com \
    --cc=festevam@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=j-keerthy@ti.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox