From: Lukasz Luba <lukasz.luba@arm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux PM <linux-pm@vger.kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines
Date: Wed, 3 Jan 2024 20:08:23 +0000 [thread overview]
Message-ID: <d362ed6b-7e6a-4b77-b364-14e987eaa9e7@arm.com> (raw)
In-Reply-To: <1975810.PYKUYFuaPT@kreacher>
On 12/15/23 20:00, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> There are several routines in the thermal netlink API that take a
> thermal zone ID or a thermal zone type as their arguments, but from
> their callers perspective it would be more convenient to pass a thermal
> zone pointer to them and let them extract the necessary data from the
> given thermal zone object by themselves.
>
> Modify the code accordingly.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_core.c | 10 +++++-----
> drivers/thermal/thermal_netlink.c | 21 +++++++++++----------
> drivers/thermal/thermal_netlink.h | 22 ++++++++++++----------
> 3 files changed, 28 insertions(+), 25 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -213,7 +213,7 @@ exit:
> mutex_unlock(&tz->lock);
> mutex_unlock(&thermal_governor_lock);
>
> - thermal_notify_tz_gov_change(tz->id, policy);
> + thermal_notify_tz_gov_change(tz, policy);
>
> return ret;
> }
> @@ -475,9 +475,9 @@ static int thermal_zone_device_set_mode(
> mutex_unlock(&tz->lock);
>
> if (mode == THERMAL_DEVICE_ENABLED)
> - thermal_notify_tz_enable(tz->id);
> + thermal_notify_tz_enable(tz);
> else
> - thermal_notify_tz_disable(tz->id);
> + thermal_notify_tz_disable(tz);
>
> return ret;
> }
> @@ -1386,7 +1386,7 @@ thermal_zone_device_register_with_trips(
> if (atomic_cmpxchg(&tz->need_update, 1, 0))
> thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
>
> - thermal_notify_tz_create(tz->id, tz->type);
> + thermal_notify_tz_create(tz);
>
> return tz;
>
> @@ -1490,7 +1490,7 @@ void thermal_zone_device_unregister(stru
>
> put_device(&tz->device);
>
> - thermal_notify_tz_delete(tz_id);
> + thermal_notify_tz_delete(tz);
>
> wait_for_completion(&tz->removal);
> kfree(tz);
> Index: linux-pm/drivers/thermal/thermal_netlink.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> +++ linux-pm/drivers/thermal/thermal_netlink.c
> @@ -288,30 +288,30 @@ out_free_msg:
> return ret;
> }
>
> -int thermal_notify_tz_create(int tz_id, const char *name)
> +int thermal_notify_tz_create(const struct thermal_zone_device *tz)
> {
> - struct param p = { .tz_id = tz_id, .name = name };
> + struct param p = { .tz_id = tz->id, .name = tz->type };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_CREATE, &p);
> }
>
> -int thermal_notify_tz_delete(int tz_id)
> +int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
> {
> - struct param p = { .tz_id = tz_id };
> + struct param p = { .tz_id = tz->id };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DELETE, &p);
> }
>
> -int thermal_notify_tz_enable(int tz_id)
> +int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
> {
> - struct param p = { .tz_id = tz_id };
> + struct param p = { .tz_id = tz->id };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_ENABLE, &p);
> }
>
> -int thermal_notify_tz_disable(int tz_id)
> +int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
> {
> - struct param p = { .tz_id = tz_id };
> + struct param p = { .tz_id = tz->id };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DISABLE, &p);
> }
> @@ -370,9 +370,10 @@ int thermal_notify_cdev_delete(int cdev_
> return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_DELETE, &p);
> }
>
> -int thermal_notify_tz_gov_change(int tz_id, const char *name)
> +int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
> + const char *name)
> {
> - struct param p = { .tz_id = tz_id, .name = name };
> + struct param p = { .tz_id = tz->id, .name = name };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_GOV_CHANGE, &p);
> }
> Index: linux-pm/drivers/thermal/thermal_netlink.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.h
> +++ linux-pm/drivers/thermal/thermal_netlink.h
> @@ -14,10 +14,10 @@ struct thermal_genl_cpu_caps {
> #ifdef CONFIG_THERMAL_NETLINK
> int __init thermal_netlink_init(void);
> void __init thermal_netlink_exit(void);
> -int thermal_notify_tz_create(int tz_id, const char *name);
> -int thermal_notify_tz_delete(int tz_id);
> -int thermal_notify_tz_enable(int tz_id);
> -int thermal_notify_tz_disable(int tz_id);
> +int thermal_notify_tz_create(const struct thermal_zone_device *tz);
> +int thermal_notify_tz_delete(const struct thermal_zone_device *tz);
> +int thermal_notify_tz_enable(const struct thermal_zone_device *tz);
> +int thermal_notify_tz_disable(const struct thermal_zone_device *tz);
> int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip);
> int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
> @@ -27,7 +27,8 @@ int thermal_notify_tz_trip_change(const
> int thermal_notify_cdev_state_update(int cdev_id, int state);
> int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state);
> int thermal_notify_cdev_delete(int cdev_id);
> -int thermal_notify_tz_gov_change(int tz_id, const char *name);
> +int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
> + const char *name);
> int thermal_genl_sampling_temp(int id, int temp);
> int thermal_genl_cpu_capability_event(int count,
> struct thermal_genl_cpu_caps *caps);
> @@ -37,22 +38,22 @@ static inline int thermal_netlink_init(v
> return 0;
> }
>
> -static inline int thermal_notify_tz_create(int tz_id, const char *name)
> +static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz)
> {
> return 0;
> }
>
> -static inline int thermal_notify_tz_delete(int tz_id)
> +static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz)
> {
> return 0;
> }
>
> -static inline int thermal_notify_tz_enable(int tz_id)
> +static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz)
> {
> return 0;
> }
>
> -static inline int thermal_notify_tz_disable(int tz_id)
> +static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz)
> {
> return 0;
> }
> @@ -91,7 +92,8 @@ static inline int thermal_notify_cdev_de
> return 0;
> }
>
> -static inline int thermal_notify_tz_gov_change(int tz_id, const char *name)
> +static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
> + const char *name)
> {
> return 0;
> }
>
>
>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
next prev parent reply other threads:[~2024-01-03 20:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 19:51 [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
2023-12-15 19:53 ` [PATCH v1 1/6] thermal: trip: Constify thermal zone argument of thermal_zone_trip_id() Rafael J. Wysocki
2024-01-03 19:48 ` Lukasz Luba
2024-01-09 11:12 ` Daniel Lezcano
2023-12-15 19:56 ` [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change() Rafael J. Wysocki
2024-01-03 19:58 ` Lukasz Luba
2024-01-03 20:09 ` Rafael J. Wysocki
2024-01-09 11:11 ` Daniel Lezcano
2023-12-15 19:57 ` [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down() Rafael J. Wysocki
2024-01-03 20:00 ` Lukasz Luba
2024-01-09 11:28 ` Daniel Lezcano
2023-12-15 19:59 ` [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete() Rafael J. Wysocki
2024-01-03 20:07 ` Lukasz Luba
2024-01-04 11:12 ` Rafael J. Wysocki
2024-01-09 11:29 ` Daniel Lezcano
2023-12-15 20:00 ` [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines Rafael J. Wysocki
2024-01-03 20:08 ` Lukasz Luba [this message]
2024-01-09 11:31 ` Daniel Lezcano
2023-12-15 20:02 ` [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API Rafael J. Wysocki
2024-01-03 20:10 ` Lukasz Luba
2024-01-09 11:36 ` Daniel Lezcano
2024-01-09 12:23 ` Rafael J. Wysocki
2024-01-02 13:24 ` [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
2024-01-03 8:11 ` Lukasz Luba
2024-01-03 10:24 ` Rafael J. Wysocki
2024-01-03 11:14 ` Lukasz Luba
2024-01-03 9:53 ` Daniel Lezcano
2024-01-03 10:26 ` 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=d362ed6b-7e6a-4b77-b364-14e987eaa9e7@arm.com \
--to=lukasz.luba@arm.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-acpi@vger.kernel.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