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,
	Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-trace-kernel@vger.kernel.org (open list:TRACING)
Subject: [PATCH v2 16/16] thermal/traces: Replace the thermal zone structure parameter with the field value
Date: Tue, 21 Feb 2023 19:07:10 +0100	[thread overview]
Message-ID: <20230221180710.2781027-17-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <20230221180710.2781027-1-daniel.lezcano@linaro.org>

In the work of the thermal zone device self-encapsulation, let's pass
the field value instead of dereferencing them in the traces which
force us to export publicly the thermal_zone_device structure.

No fonctionnal change intended.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/gov_fair_share.c              |  2 +-
 drivers/thermal/gov_power_allocator.c         |  4 ++--
 drivers/thermal/gov_step_wise.c               |  2 +-
 drivers/thermal/thermal_core.c                |  5 ++--
 include/trace/events/thermal.h                | 24 +++++++++----------
 .../trace/events/thermal_power_allocator.h    | 12 +++++-----
 6 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c
index aad7d5fe3a14..e6c21abaaa80 100644
--- a/drivers/thermal/gov_fair_share.c
+++ b/drivers/thermal/gov_fair_share.c
@@ -35,7 +35,7 @@ static int get_trip_level(struct thermal_zone_device *tz)
 	 * point, in which case, trip_point = count - 1
 	 */
 	if (count > 0)
-		trace_thermal_zone_trip(tz, count - 1, trip.type);
+		trace_thermal_zone_trip(tz->type, tz->id, count - 1, trip.type);
 
 	return count;
 }
diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index 0eaf1527d3e3..aaa8b57434ef 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -266,7 +266,7 @@ static u32 pid_controller(struct thermal_zone_device *tz,
 
 	power_range = clamp(power_range, (s64)0, (s64)max_allocatable_power);
 
-	trace_thermal_power_allocator_pid(tz, frac_to_int(err),
+	trace_thermal_power_allocator_pid(tz->id, frac_to_int(err),
 					  frac_to_int(params->err_integral),
 					  frac_to_int(p), frac_to_int(i),
 					  frac_to_int(d), power_range);
@@ -481,7 +481,7 @@ static int allocate_power(struct thermal_zone_device *tz,
 		i++;
 	}
 
-	trace_thermal_power_allocator(tz, req_power, total_req_power,
+	trace_thermal_power_allocator(tz->id, req_power, total_req_power,
 				      granted_power, total_granted_power,
 				      num_actors, power_range,
 				      max_allocatable_power, tz->temperature,
diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c
index 31235e169c5a..f469e04770fe 100644
--- a/drivers/thermal/gov_step_wise.c
+++ b/drivers/thermal/gov_step_wise.c
@@ -109,7 +109,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
 
 	if (tz->temperature >= trip.temperature) {
 		throttle = true;
-		trace_thermal_zone_trip(tz, trip_id, trip.type);
+		trace_thermal_zone_trip(tz->type, tz->id, trip_id, trip.type);
 	}
 
 	dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n",
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 73b7a060f768..48987129b20d 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -336,7 +336,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz,
 	if (trip_temp <= 0 || tz->temperature < trip_temp)
 		return;
 
-	trace_thermal_zone_trip(tz, trip, trip_type);
+	trace_thermal_zone_trip(tz->type, tz->id, trip, trip_type);
 
 	if (trip_type == THERMAL_TRIP_HOT && tz->ops->hot)
 		tz->ops->hot(tz);
@@ -387,7 +387,8 @@ static void update_temperature(struct thermal_zone_device *tz)
 	tz->last_temperature = tz->temperature;
 	tz->temperature = temp;
 
-	trace_thermal_temperature(tz);
+	trace_thermal_temperature(tz->type, tz->id,
+				  tz->last_temperature, tz->temperature);
 
 	thermal_genl_sampling_temp(tz->id, temp);
 }
diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h
index e58bf3072f32..50c7d2e1526d 100644
--- a/include/trace/events/thermal.h
+++ b/include/trace/events/thermal.h
@@ -23,22 +23,22 @@ TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE);
 
 TRACE_EVENT(thermal_temperature,
 
-	TP_PROTO(struct thermal_zone_device *tz),
+	TP_PROTO(const char *type, int id, int temp_prev, int temp),
 
-	TP_ARGS(tz),
+	TP_ARGS(type, id, temp_prev, temp),
 
 	TP_STRUCT__entry(
-		__string(thermal_zone, tz->type)
+		__string(thermal_zone, type)
 		__field(int, id)
 		__field(int, temp_prev)
 		__field(int, temp)
 	),
 
 	TP_fast_assign(
-		__assign_str(thermal_zone, tz->type);
-		__entry->id = tz->id;
-		__entry->temp_prev = tz->last_temperature;
-		__entry->temp = tz->temperature;
+		__assign_str(thermal_zone, type);
+		__entry->id = id;
+		__entry->temp_prev = temp_prev;
+		__entry->temp = temp;
 	),
 
 	TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
@@ -67,21 +67,21 @@ TRACE_EVENT(cdev_update,
 
 TRACE_EVENT(thermal_zone_trip,
 
-	TP_PROTO(struct thermal_zone_device *tz, int trip,
+	TP_PROTO(const char *type, int id, int trip,
 		enum thermal_trip_type trip_type),
 
-	TP_ARGS(tz, trip, trip_type),
+	TP_ARGS(type, id, trip, trip_type),
 
 	TP_STRUCT__entry(
-		__string(thermal_zone, tz->type)
+		__string(thermal_zone, type)
 		__field(int, id)
 		__field(int, trip)
 		__field(enum thermal_trip_type, trip_type)
 	),
 
 	TP_fast_assign(
-		__assign_str(thermal_zone, tz->type);
-		__entry->id = tz->id;
+		__assign_str(thermal_zone, type);
+		__entry->id = id;
 		__entry->trip = trip;
 		__entry->trip_type = trip_type;
 	),
diff --git a/include/trace/events/thermal_power_allocator.h b/include/trace/events/thermal_power_allocator.h
index 1c8fb95544f9..7ac049e7e3cf 100644
--- a/include/trace/events/thermal_power_allocator.h
+++ b/include/trace/events/thermal_power_allocator.h
@@ -8,12 +8,12 @@
 #include <linux/tracepoint.h>
 
 TRACE_EVENT(thermal_power_allocator,
-	TP_PROTO(struct thermal_zone_device *tz, u32 *req_power,
+	TP_PROTO(int id, u32 *req_power,
 		 u32 total_req_power, u32 *granted_power,
 		 u32 total_granted_power, size_t num_actors,
 		 u32 power_range, u32 max_allocatable_power,
 		 int current_temp, s32 delta_temp),
-	TP_ARGS(tz, req_power, total_req_power, granted_power,
+	TP_ARGS(id, req_power, total_req_power, granted_power,
 		total_granted_power, num_actors, power_range,
 		max_allocatable_power, current_temp, delta_temp),
 	TP_STRUCT__entry(
@@ -29,7 +29,7 @@ TRACE_EVENT(thermal_power_allocator,
 		__field(s32,           delta_temp               )
 	),
 	TP_fast_assign(
-		__entry->tz_id = tz->id;
+		__entry->tz_id = id;
 		memcpy(__get_dynamic_array(req_power), req_power,
 			num_actors * sizeof(*req_power));
 		__entry->total_req_power = total_req_power;
@@ -56,9 +56,9 @@ TRACE_EVENT(thermal_power_allocator,
 );
 
 TRACE_EVENT(thermal_power_allocator_pid,
-	TP_PROTO(struct thermal_zone_device *tz, s32 err, s32 err_integral,
+	TP_PROTO(int id, s32 err, s32 err_integral,
 		 s64 p, s64 i, s64 d, s32 output),
-	TP_ARGS(tz, err, err_integral, p, i, d, output),
+	TP_ARGS(id, err, err_integral, p, i, d, output),
 	TP_STRUCT__entry(
 		__field(int, tz_id       )
 		__field(s32, err         )
@@ -69,7 +69,7 @@ TRACE_EVENT(thermal_power_allocator_pid,
 		__field(s32, output      )
 	),
 	TP_fast_assign(
-		__entry->tz_id = tz->id;
+		__entry->tz_id = id;
 		__entry->err = err;
 		__entry->err_integral = err_integral;
 		__entry->p = p;
-- 
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 ` [PATCH v2 06/16] thermal: Don't use 'device' internal thermal zone structure field Daniel Lezcano
2023-02-22  9:31   ` 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 ` Daniel Lezcano [this message]
2023-02-22 19:51   ` [PATCH v2 16/16] thermal/traces: Replace the thermal zone structure parameter with the field value 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-17-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rui.zhang@intel.com \
    --cc=viresh.kumar@linaro.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