mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v1 2/6] thermal: trip: Define for_each_trip() macro
Date: Fri, 20 Oct 2023 18:15:02 +0100	[thread overview]
Message-ID: <63b7f4da-8ddb-443c-8074-66b7b0c6cd84@arm.com> (raw)
In-Reply-To: <8282829.T7Z3S40VBb@kreacher>



On 10/6/23 18:41, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Define a new macro for_each_trip() to be used by the thermal core code
> and thermal governors for walking trips in a given thermal zone.
> 
> Modify for_each_thermal_trip() to use this macro instead of an open-
> coded loop over trips.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   drivers/thermal/thermal_core.h |    3 +++
>   drivers/thermal/thermal_trip.c |    7 ++++---
>   2 files changed, 7 insertions(+), 3 deletions(-)
> 
> Index: linux-pm/drivers/thermal/thermal_core.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.h
> +++ linux-pm/drivers/thermal/thermal_core.h
> @@ -116,6 +116,9 @@ void __thermal_zone_device_update(struct
>   				  enum thermal_notify_event event);
>   
>   /* Helpers */
> +#define for_each_trip(__tz, __trip)	\
> +	for (__trip = __tz->trips; __trip - __tz->trips < __tz->num_trips; __trip++)
> +
>   void __thermal_zone_set_trips(struct thermal_zone_device *tz);
>   int __thermal_zone_get_trip(struct thermal_zone_device *tz, int trip_id,
>   			    struct thermal_trip *trip);
> Index: linux-pm/drivers/thermal/thermal_trip.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_trip.c
> +++ linux-pm/drivers/thermal/thermal_trip.c
> @@ -13,12 +13,13 @@ int for_each_thermal_trip(struct thermal
>   			  int (*cb)(struct thermal_trip *, void *),
>   			  void *data)
>   {
> -	int i, ret;
> +	struct thermal_trip *trip;
> +	int ret;
>   
>   	lockdep_assert_held(&tz->lock);
>   
> -	for (i = 0; i < tz->num_trips; i++) {
> -		ret = cb(&tz->trips[i], data);
> +	for_each_trip(tz, trip) {
> +		ret = cb(trip, data);
>   		if (ret)
>   			return ret;
>   	}
> 
> 
> 

LGTM

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

  parent reply	other threads:[~2023-10-20 17:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 17:38 [PATCH v1 0/6] thermal: core: Pass trip pointers to governor .throttle() callbacks Rafael J. Wysocki
2023-10-06 17:40 ` [PATCH v1 1/6] thermal: trip: Simplify computing trip indices Rafael J. Wysocki
2023-10-12 14:27   ` Daniel Lezcano
2023-10-12 16:21     ` Rafael J. Wysocki
2023-10-20 16:58   ` Lukasz Luba
2023-10-20 17:04     ` Rafael J. Wysocki
2023-10-06 17:41 ` [PATCH v1 2/6] thermal: trip: Define for_each_trip() macro Rafael J. Wysocki
2023-10-12 14:44   ` Daniel Lezcano
2023-10-20 17:15   ` Lukasz Luba [this message]
2023-10-20 17:19     ` Rafael J. Wysocki
2023-10-06 17:42 ` [PATCH v1 3/6] thermal: gov_fair_share: Rearrange get_trip_level() Rafael J. Wysocki
2023-10-12 15:04   ` Daniel Lezcano
2023-10-12 16:29     ` Rafael J. Wysocki
2023-10-06 17:47 ` [PATCH v1 4/6] thermal: gov_power_allocator: Use trip pointers instead of trip indices Rafael J. Wysocki
2023-10-12 15:19   ` Daniel Lezcano
2023-10-12 16:36     ` Rafael J. Wysocki
2023-10-20 16:37   ` Lukasz Luba
2023-10-20 16:41     ` Rafael J. Wysocki
2023-10-06 17:49 ` [PATCH v1 5/6] thermal: gov_step_wise: Fold update_passive_instance() into its caller Rafael J. Wysocki
2023-10-12 15:24   ` Daniel Lezcano
2023-10-20 16:17   ` Lukasz Luba
2023-10-20 16:31     ` Rafael J. Wysocki
2023-10-06 17:51 ` [PATCH v1 6/6] thermal: core: Pass trip pointer to governor throttle callback Rafael J. Wysocki
2023-10-12 15:29   ` Daniel Lezcano
2023-10-13  8:12 ` [PATCH v1 0/6] thermal: core: Pass trip pointers to governor .throttle() callbacks Lukasz Luba
2023-10-13 10: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=63b7f4da-8ddb-443c-8074-66b7b0c6cd84@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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

all inboxes | Powered by JetHome®