All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] thermal/drivers/thermal_helpers: Adjust output format
Date: Fri,  8 Apr 2022 13:09:20 +0200	[thread overview]
Message-ID: <20220408110920.3809225-2-alexander.stein@ew.tq-group.com> (raw)
In-Reply-To: <20220408110920.3809225-1-alexander.stein@ew.tq-group.com>

Outputs like this where -1 is printed as unsigned is somewhat misleading
 thermal thermal_zone1: Trip3[type=0,temp=48000]:trend=4,throttle=1
 thermal cooling_device3: cur_state=1
 thermal cooling_device3: old_target=-1, target=2
 thermal cooling_device3: zone1->target=1
 thermal cooling_device3: zone1->target=2
 thermal cooling_device3: zone1->target=18446744073709551615
 thermal cooling_device3: set to state 2

With THERMAL_NO_TARGET assigning -1 as unsigned it make sense to print
the target as signed integer, even if the type is actually unsigned.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
An alternative would be to change thermal_instance::target from unsigned
long to long, but this would entail a lot of API & driver changes as well
which looks less intriguing.

 drivers/thermal/thermal_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 3edd047e144f..0d0da6670267 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -199,7 +199,7 @@ void __thermal_cdev_update(struct thermal_cooling_device *cdev)
 
 	/* Make sure cdev enters the deepest cooling state */
 	list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) {
-		dev_dbg(&cdev->device, "zone%d->target=%lu\n",
+		dev_dbg(&cdev->device, "zone%d->target=%ld\n",
 			instance->tz->id, instance->target);
 		if (instance->target == THERMAL_NO_TARGET)
 			continue;
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] thermal/drivers/thermal_helpers: Adjust output format
Date: Fri,  8 Apr 2022 13:09:20 +0200	[thread overview]
Message-ID: <20220408110920.3809225-2-alexander.stein@ew.tq-group.com> (raw)
In-Reply-To: <20220408110920.3809225-1-alexander.stein@ew.tq-group.com>

Outputs like this where -1 is printed as unsigned is somewhat misleading
 thermal thermal_zone1: Trip3[type=0,temp=48000]:trend=4,throttle=1
 thermal cooling_device3: cur_state=1
 thermal cooling_device3: old_target=-1, target=2
 thermal cooling_device3: zone1->target=1
 thermal cooling_device3: zone1->target=2
 thermal cooling_device3: zone1->target=18446744073709551615
 thermal cooling_device3: set to state 2

With THERMAL_NO_TARGET assigning -1 as unsigned it make sense to print
the target as signed integer, even if the type is actually unsigned.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
An alternative would be to change thermal_instance::target from unsigned
long to long, but this would entail a lot of API & driver changes as well
which looks less intriguing.

 drivers/thermal/thermal_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 3edd047e144f..0d0da6670267 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -199,7 +199,7 @@ void __thermal_cdev_update(struct thermal_cooling_device *cdev)
 
 	/* Make sure cdev enters the deepest cooling state */
 	list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) {
-		dev_dbg(&cdev->device, "zone%d->target=%lu\n",
+		dev_dbg(&cdev->device, "zone%d->target=%ld\n",
 			instance->tz->id, instance->target);
 		if (instance->target == THERMAL_NO_TARGET)
 			continue;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-08 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 11:09 [PATCH 1/2] thermal: imx8mm: Add hwmon support Alexander Stein
2022-04-08 11:09 ` Alexander Stein
2022-04-08 11:09 ` Alexander Stein [this message]
2022-04-08 11:09   ` [PATCH 2/2] thermal/drivers/thermal_helpers: Adjust output format Alexander Stein
2022-04-14  7:35   ` Daniel Lezcano
2022-04-14  7:35     ` Daniel Lezcano
2022-05-10 22:48     ` Nitin Garg
2022-05-10 22:48       ` Nitin Garg
2022-05-11 10:17       ` (EXT) " Alexander Stein
2022-05-11 10:17         ` Alexander Stein

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=20220408110920.3809225-2-alexander.stein@ew.tq-group.com \
    --to=alexander.stein@ew.tq-group.com \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=festevam@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.