* [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code
@ 2023-12-15 19:51 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
` (6 more replies)
0 siblings, 7 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2023-12-15 19:51 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
Hi Everyone,
This patch series redefines the thermal netlink API to be somewhat more
convenient to use on the caller side and drops some unused code from
the thermal netlink library.
Please refer to the individual patch changelogs for details.
Thanks!
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v1 1/6] thermal: trip: Constify thermal zone argument of thermal_zone_trip_id()
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 ` 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
` (5 subsequent siblings)
6 siblings, 2 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2023-12-15 19:53 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Because thermal_zone_trip_id() does not update the thermal zone object
passed to it, its pointer argument representing the thermal zone can be
const, so adjust its definition accordingly.
No functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_core.h | 2 +-
drivers/thermal/thermal_trip.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-pm/drivers/thermal/thermal_core.h
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.h
+++ linux-pm/drivers/thermal/thermal_core.h
@@ -120,7 +120,7 @@ void __thermal_zone_device_update(struct
for (__trip = __tz->trips; __trip - __tz->trips < __tz->num_trips; __trip++)
void __thermal_zone_set_trips(struct thermal_zone_device *tz);
-int thermal_zone_trip_id(struct thermal_zone_device *tz,
+int thermal_zone_trip_id(const struct thermal_zone_device *tz,
const struct thermal_trip *trip);
void thermal_zone_trip_updated(struct thermal_zone_device *tz,
const 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
@@ -143,7 +143,7 @@ int thermal_zone_get_trip(struct thermal
}
EXPORT_SYMBOL_GPL(thermal_zone_get_trip);
-int thermal_zone_trip_id(struct thermal_zone_device *tz,
+int thermal_zone_trip_id(const struct thermal_zone_device *tz,
const struct thermal_trip *trip)
{
/*
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
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
@ 2023-12-15 19:56 ` Rafael J. Wysocki
2024-01-03 19:58 ` Lukasz Luba
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
` (4 subsequent siblings)
6 siblings, 2 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2023-12-15 19:56 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Instead of requiring the caller of thermal_notify_tz_trip_change() to
provide specific values needed to populate struct param in it, make it
extract those values from objects passed to it by the caller via const
pointers.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_netlink.c | 12 +++++++-----
drivers/thermal/thermal_netlink.h | 8 ++++----
drivers/thermal/thermal_trip.c | 8 ++------
3 files changed, 13 insertions(+), 15 deletions(-)
Index: linux-pm/drivers/thermal/thermal_netlink.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_netlink.c
+++ linux-pm/drivers/thermal/thermal_netlink.c
@@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tz
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p);
}
-int thermal_notify_tz_trip_change(int tz_id, int trip_id, int trip_type,
- int trip_temp, int trip_hyst)
+int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
- struct param p = { .tz_id = tz_id, .trip_id = trip_id,
- .trip_type = trip_type, .trip_temp = trip_temp,
- .trip_hyst = trip_hyst };
+ struct param p = { .tz_id = tz->id,
+ .trip_id = thermal_zone_trip_id(tz, trip),
+ .trip_type = trip->type,
+ .trip_temp = trip->temperature,
+ .trip_hyst = trip->hysteresis };
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_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
@@ -23,8 +23,8 @@ int thermal_notify_tz_trip_up(int tz_id,
int thermal_notify_tz_trip_delete(int tz_id, int id);
int thermal_notify_tz_trip_add(int tz_id, int id, int type,
int temp, int hyst);
-int thermal_notify_tz_trip_change(int tz_id, int id, int type,
- int temp, int hyst);
+int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
+ const struct thermal_trip *trip);
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);
@@ -79,8 +79,8 @@ static inline int thermal_notify_tz_trip
return 0;
}
-static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type,
- int temp, int hyst)
+static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
return 0;
}
Index: linux-pm/drivers/thermal/thermal_trip.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_trip.c
+++ linux-pm/drivers/thermal/thermal_trip.c
@@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct th
void thermal_zone_trip_updated(struct thermal_zone_device *tz,
const struct thermal_trip *trip)
{
- thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
- trip->type, trip->temperature,
- trip->hysteresis);
+ thermal_notify_tz_trip_change(tz, trip);
__thermal_zone_device_update(tz, THERMAL_TRIP_CHANGED);
}
@@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct t
return;
trip->temperature = temp;
- thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
- trip->type, trip->temperature,
- trip->hysteresis);
+ thermal_notify_tz_trip_change(tz, trip);
}
EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down()
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
2023-12-15 19:56 ` [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change() Rafael J. Wysocki
@ 2023-12-15 19:57 ` 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
` (3 subsequent siblings)
6 siblings, 2 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2023-12-15 19:57 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Instead of requiring the callers of thermal_notify_tz_trip_up/down() to
provide specific values needed to populate struct param in them, make
them extract those values from objects passed by the callers via const
pointers.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_core.c | 8 ++------
drivers/thermal/thermal_netlink.c | 14 ++++++++++----
drivers/thermal/thermal_netlink.h | 12 ++++++++----
3 files changed, 20 insertions(+), 14 deletions(-)
Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -361,9 +361,7 @@ static void handle_thermal_trip(struct t
* the threshold and the trip temperature will be equal.
*/
if (tz->temperature >= trip->temperature) {
- thermal_notify_tz_trip_up(tz->id,
- thermal_zone_trip_id(tz, trip),
- tz->temperature);
+ thermal_notify_tz_trip_up(tz, trip);
trip->threshold = trip->temperature - trip->hysteresis;
} else {
trip->threshold = trip->temperature;
@@ -380,9 +378,7 @@ static void handle_thermal_trip(struct t
* the trip.
*/
if (tz->temperature < trip->temperature - trip->hysteresis) {
- thermal_notify_tz_trip_down(tz->id,
- thermal_zone_trip_id(tz, trip),
- tz->temperature);
+ thermal_notify_tz_trip_down(tz, trip);
trip->threshold = trip->temperature;
} else {
trip->threshold = trip->temperature - trip->hysteresis;
Index: linux-pm/drivers/thermal/thermal_netlink.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_netlink.c
+++ linux-pm/drivers/thermal/thermal_netlink.c
@@ -330,16 +330,22 @@ int thermal_notify_tz_disable(int tz_id)
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DISABLE, &p);
}
-int thermal_notify_tz_trip_down(int tz_id, int trip_id, int temp)
+int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
- struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp };
+ struct param p = { .tz_id = tz->id,
+ .trip_id = thermal_zone_trip_id(tz, trip),
+ .temp = tz->temperature };
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DOWN, &p);
}
-int thermal_notify_tz_trip_up(int tz_id, int trip_id, int temp)
+int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
- struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp };
+ struct param p = { .tz_id = tz->id,
+ .trip_id = thermal_zone_trip_id(tz, trip),
+ .temp = tz->temperature };
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p);
}
Index: linux-pm/drivers/thermal/thermal_netlink.h
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_netlink.h
+++ linux-pm/drivers/thermal/thermal_netlink.h
@@ -18,8 +18,10 @@ int thermal_notify_tz_create(int tz_id,
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_trip_down(int tz_id, int id, int temp);
-int thermal_notify_tz_trip_up(int tz_id, int id, int temp);
+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,
+ const struct thermal_trip *trip);
int thermal_notify_tz_trip_delete(int tz_id, int id);
int thermal_notify_tz_trip_add(int tz_id, int id, int type,
int temp, int hyst);
@@ -58,12 +60,14 @@ static inline int thermal_notify_tz_disa
return 0;
}
-static inline int thermal_notify_tz_trip_down(int tz_id, int id, int temp)
+static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
return 0;
}
-static inline int thermal_notify_tz_trip_up(int tz_id, int id, int temp)
+static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
+ const struct thermal_trip *trip)
{
return 0;
}
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
2023-12-15 19:51 [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
` (2 preceding siblings ...)
2023-12-15 19:57 ` [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down() Rafael J. Wysocki
@ 2023-12-15 19:59 ` Rafael J. Wysocki
2024-01-03 20:07 ` Lukasz Luba
2023-12-15 20:00 ` [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines Rafael J. Wysocki
` (2 subsequent siblings)
6 siblings, 1 reply; 28+ messages in thread
From: Rafael J. Wysocki @ 2023-12-15 19:59 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Because thermal_notify_tz_trip_add/delete() are never used, drop them
entirely along with the related code.
The addition or removal of trip points is not supported by the thermal
core and is unlikely to be supported in the future, so it is also
unlikely that these functions will ever be needed.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_netlink.c | 33 +--------------------------------
drivers/thermal/thermal_netlink.h | 14 --------------
2 files changed, 1 insertion(+), 46 deletions(-)
Index: linux-pm/drivers/thermal/thermal_netlink.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_netlink.c
+++ linux-pm/drivers/thermal/thermal_netlink.c
@@ -135,7 +135,7 @@ static int thermal_genl_event_tz_trip_up
return 0;
}
-static int thermal_genl_event_tz_trip_add(struct param *p)
+static int thermal_genl_event_tz_trip_change(struct param *p)
{
if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) ||
nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id) ||
@@ -147,15 +147,6 @@ static int thermal_genl_event_tz_trip_ad
return 0;
}
-static int thermal_genl_event_tz_trip_delete(struct param *p)
-{
- if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) ||
- nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id))
- return -EMSGSIZE;
-
- return 0;
-}
-
static int thermal_genl_event_cdev_add(struct param *p)
{
if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME,
@@ -245,9 +236,6 @@ int thermal_genl_event_tz_disable(struct
int thermal_genl_event_tz_trip_down(struct param *p)
__attribute__((alias("thermal_genl_event_tz_trip_up")));
-int thermal_genl_event_tz_trip_change(struct param *p)
- __attribute__((alias("thermal_genl_event_tz_trip_add")));
-
static cb_t event_cb[] = {
[THERMAL_GENL_EVENT_TZ_CREATE] = thermal_genl_event_tz_create,
[THERMAL_GENL_EVENT_TZ_DELETE] = thermal_genl_event_tz_delete,
@@ -256,8 +244,6 @@ static cb_t event_cb[] = {
[THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up,
[THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down,
[THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change,
- [THERMAL_GENL_EVENT_TZ_TRIP_ADD] = thermal_genl_event_tz_trip_add,
- [THERMAL_GENL_EVENT_TZ_TRIP_DELETE] = thermal_genl_event_tz_trip_delete,
[THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add,
[THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete,
[THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update,
@@ -350,23 +336,6 @@ int thermal_notify_tz_trip_up(const stru
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p);
}
-int thermal_notify_tz_trip_add(int tz_id, int trip_id, int trip_type,
- int trip_temp, int trip_hyst)
-{
- struct param p = { .tz_id = tz_id, .trip_id = trip_id,
- .trip_type = trip_type, .trip_temp = trip_temp,
- .trip_hyst = trip_hyst };
-
- return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_ADD, &p);
-}
-
-int thermal_notify_tz_trip_delete(int tz_id, int trip_id)
-{
- struct param p = { .tz_id = tz_id, .trip_id = trip_id };
-
- return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p);
-}
-
int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
const struct thermal_trip *trip)
{
Index: linux-pm/drivers/thermal/thermal_netlink.h
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_netlink.h
+++ linux-pm/drivers/thermal/thermal_netlink.h
@@ -22,9 +22,6 @@ int thermal_notify_tz_trip_down(const st
const struct thermal_trip *trip);
int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
const struct thermal_trip *trip);
-int thermal_notify_tz_trip_delete(int tz_id, int id);
-int thermal_notify_tz_trip_add(int tz_id, int id, int type,
- int temp, int hyst);
int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
const struct thermal_trip *trip);
int thermal_notify_cdev_state_update(int cdev_id, int state);
@@ -71,17 +68,6 @@ static inline int thermal_notify_tz_trip
{
return 0;
}
-
-static inline int thermal_notify_tz_trip_delete(int tz_id, int id)
-{
- return 0;
-}
-
-static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type,
- int temp, int hyst)
-{
- return 0;
-}
static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
const struct thermal_trip *trip)
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines
2023-12-15 19:51 [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
` (3 preceding siblings ...)
2023-12-15 19:59 ` [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete() Rafael J. Wysocki
@ 2023-12-15 20:00 ` Rafael J. Wysocki
2024-01-03 20:08 ` Lukasz Luba
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-02 13:24 ` [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
6 siblings, 2 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2023-12-15 20:00 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
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;
}
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API
2023-12-15 19:51 [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
` (4 preceding siblings ...)
2023-12-15 20:00 ` [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines Rafael J. Wysocki
@ 2023-12-15 20:02 ` Rafael J. Wysocki
2024-01-03 20:10 ` Lukasz Luba
2024-01-09 11:36 ` Daniel Lezcano
2024-01-02 13:24 ` [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
6 siblings, 2 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2023-12-15 20:02 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The only actually used thermal netlink notification routine related
to cooling devices is thermal_notify_cdev_state_update(). The other
two, thermal_notify_cdev_add() and thermal_notify_cdev_delete(), are
never used.
So as to get rid of dead code, drop thermal_notify_cdev_add/delete(),
which can be added back if they turn out to be ever needed, along with
the related code.
In analogy with the previous thermal netlink API changes, redefine
thermal_notify_cdev_state_update() to take a const cdev pointer as its
first argument and let it extract the requisite information from there
by itself.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_helpers.c | 2 -
drivers/thermal/thermal_netlink.c | 43 ++------------------------------------
drivers/thermal/thermal_netlink.h | 19 +++-------------
3 files changed, 8 insertions(+), 56 deletions(-)
Index: linux-pm/drivers/thermal/thermal_netlink.h
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_netlink.h
+++ linux-pm/drivers/thermal/thermal_netlink.h
@@ -24,9 +24,8 @@ int thermal_notify_tz_trip_up(const stru
const struct thermal_trip *trip);
int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
const struct thermal_trip *trip);
-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_cdev_state_update(const struct thermal_cooling_device *cdev,
+ int state);
int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
const char *name);
int thermal_genl_sampling_temp(int id, int temp);
@@ -76,18 +75,8 @@ static inline int thermal_notify_tz_trip
return 0;
}
-static inline int thermal_notify_cdev_state_update(int cdev_id, int state)
-{
- return 0;
-}
-
-static inline int thermal_notify_cdev_add(int cdev_id, const char *name,
- int max_state)
-{
- return 0;
-}
-
-static inline int thermal_notify_cdev_delete(int cdev_id)
+static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
+ int state)
{
return 0;
}
Index: linux-pm/drivers/thermal/thermal_helpers.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_helpers.c
+++ linux-pm/drivers/thermal/thermal_helpers.c
@@ -152,7 +152,7 @@ static void thermal_cdev_set_cur_state(s
if (cdev->ops->set_cur_state(cdev, target))
return;
- thermal_notify_cdev_state_update(cdev->id, target);
+ thermal_notify_cdev_state_update(cdev, target);
thermal_cooling_device_stats_update(cdev, target);
}
Index: linux-pm/drivers/thermal/thermal_netlink.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_netlink.c
+++ linux-pm/drivers/thermal/thermal_netlink.c
@@ -147,27 +147,6 @@ static int thermal_genl_event_tz_trip_ch
return 0;
}
-static int thermal_genl_event_cdev_add(struct param *p)
-{
- if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME,
- p->name) ||
- nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID,
- p->cdev_id) ||
- nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_MAX_STATE,
- p->cdev_max_state))
- return -EMSGSIZE;
-
- return 0;
-}
-
-static int thermal_genl_event_cdev_delete(struct param *p)
-{
- if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID, p->cdev_id))
- return -EMSGSIZE;
-
- return 0;
-}
-
static int thermal_genl_event_cdev_state_update(struct param *p)
{
if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID,
@@ -244,8 +223,6 @@ static cb_t event_cb[] = {
[THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up,
[THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down,
[THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change,
- [THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add,
- [THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete,
[THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update,
[THERMAL_GENL_EVENT_TZ_GOV_CHANGE] = thermal_genl_event_gov_change,
[THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE] = thermal_genl_event_cpu_capability_change,
@@ -348,28 +325,14 @@ int thermal_notify_tz_trip_change(const
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, &p);
}
-int thermal_notify_cdev_state_update(int cdev_id, int cdev_state)
+int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
+ int state)
{
- struct param p = { .cdev_id = cdev_id, .cdev_state = cdev_state };
+ struct param p = { .cdev_id = cdev->id, .cdev_state = state };
return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_STATE_UPDATE, &p);
}
-int thermal_notify_cdev_add(int cdev_id, const char *name, int cdev_max_state)
-{
- struct param p = { .cdev_id = cdev_id, .name = name,
- .cdev_max_state = cdev_max_state };
-
- return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_ADD, &p);
-}
-
-int thermal_notify_cdev_delete(int cdev_id)
-{
- struct param p = { .cdev_id = cdev_id };
-
- return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_DELETE, &p);
-}
-
int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
const char *name)
{
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code
2023-12-15 19:51 [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code Rafael J. Wysocki
` (5 preceding siblings ...)
2023-12-15 20:02 ` [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API Rafael J. Wysocki
@ 2024-01-02 13:24 ` Rafael J. Wysocki
2024-01-03 8:11 ` Lukasz Luba
2024-01-03 9:53 ` Daniel Lezcano
6 siblings, 2 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2024-01-02 13:24 UTC (permalink / raw)
To: Linux PM
Cc: Srinivas Pandruvada, Daniel Lezcano, Zhang Rui, Linux ACPI, LKML,
Lukasz Luba
On Fri, Dec 15, 2023 at 9:02 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> Hi Everyone,
>
> This patch series redefines the thermal netlink API to be somewhat more
> convenient to use on the caller side and drops some unused code from
> the thermal netlink library.
>
> Please refer to the individual patch changelogs for details.
No feedback, so this series doesn't appear to be controversial, and I
would like to get it into 6.8.
Tentatively queuing it up and please let me know if it is problematic.
Thanks!
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code
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 9:53 ` Daniel Lezcano
1 sibling, 1 reply; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 8:11 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Srinivas Pandruvada, Linux PM, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
Hi Rafael,
On 1/2/24 13:24, Rafael J. Wysocki wrote:
> On Fri, Dec 15, 2023 at 9:02 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>
>> Hi Everyone,
>>
>> This patch series redefines the thermal netlink API to be somewhat more
>> convenient to use on the caller side and drops some unused code from
>> the thermal netlink library.
>>
>> Please refer to the individual patch changelogs for details.
>
> No feedback, so this series doesn't appear to be controversial, and I
> would like to get it into 6.8.
>
> Tentatively queuing it up and please let me know if it is problematic.
>
> Thanks!
>
I agree, these are not controversial patches, so IMO queuing them is OK.
I took a glance at them, but I can do the proper review today if you
like.
Regards,
Lukasz
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code
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 9:53 ` Daniel Lezcano
2024-01-03 10:26 ` Rafael J. Wysocki
1 sibling, 1 reply; 28+ messages in thread
From: Daniel Lezcano @ 2024-01-03 9:53 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux PM
Cc: Srinivas Pandruvada, Zhang Rui, Linux ACPI, LKML, Lukasz Luba
Hi Rafael,
On 02/01/2024 14:24, Rafael J. Wysocki wrote:
> On Fri, Dec 15, 2023 at 9:02 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>
>> Hi Everyone,
>>
>> This patch series redefines the thermal netlink API to be somewhat more
>> convenient to use on the caller side and drops some unused code from
>> the thermal netlink library.
>>
>> Please refer to the individual patch changelogs for details.
>
> No feedback, so this series doesn't appear to be controversial, and I
> would like to get it into 6.8.
>
> Tentatively queuing it up and please let me know if it is problematic.
I did not have time to review them properly and I'm OoO until next week.
Is it possible to wait for the next time so I can review them ?
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code
2024-01-03 8:11 ` Lukasz Luba
@ 2024-01-03 10:24 ` Rafael J. Wysocki
2024-01-03 11:14 ` Lukasz Luba
0 siblings, 1 reply; 28+ messages in thread
From: Rafael J. Wysocki @ 2024-01-03 10:24 UTC (permalink / raw)
To: Lukasz Luba
Cc: Rafael J. Wysocki, Srinivas Pandruvada, Linux PM, Daniel Lezcano,
Zhang Rui, Linux ACPI, LKML
Hi Lukasz,
On Wed, Jan 3, 2024 at 9:10 AM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
> Hi Rafael,
>
> On 1/2/24 13:24, Rafael J. Wysocki wrote:
> > On Fri, Dec 15, 2023 at 9:02 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> >>
> >> Hi Everyone,
> >>
> >> This patch series redefines the thermal netlink API to be somewhat more
> >> convenient to use on the caller side and drops some unused code from
> >> the thermal netlink library.
> >>
> >> Please refer to the individual patch changelogs for details.
> >
> > No feedback, so this series doesn't appear to be controversial, and I
> > would like to get it into 6.8.
> >
> > Tentatively queuing it up and please let me know if it is problematic.
> >
> > Thanks!
> >
>
> I agree, these are not controversial patches, so IMO queuing them is OK.
> I took a glance at them, but I can do the proper review today if you
> like.
Well, if you can allocate some time for that, it would be appreciated!
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code
2024-01-03 9:53 ` Daniel Lezcano
@ 2024-01-03 10:26 ` Rafael J. Wysocki
0 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2024-01-03 10:26 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Rafael J. Wysocki, Linux PM, Srinivas Pandruvada, Zhang Rui,
Linux ACPI, LKML, Lukasz Luba
Hi Daniel,
On Wed, Jan 3, 2024 at 10:54 AM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
>
> Hi Rafael,
>
> On 02/01/2024 14:24, Rafael J. Wysocki wrote:
> > On Fri, Dec 15, 2023 at 9:02 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> >>
> >> Hi Everyone,
> >>
> >> This patch series redefines the thermal netlink API to be somewhat more
> >> convenient to use on the caller side and drops some unused code from
> >> the thermal netlink library.
> >>
> >> Please refer to the individual patch changelogs for details.
> >
> > No feedback, so this series doesn't appear to be controversial, and I
> > would like to get it into 6.8.
> >
> > Tentatively queuing it up and please let me know if it is problematic.
>
> I did not have time to review them properly and I'm OoO until next week.
> Is it possible to wait for the next time so I can review them ?
I can defer them a few days of course, but if Lukasz can review them
in the meantime, I think that should be sufficient?
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 0/6] thermal: netlink: Redefine the API and drop unused code
2024-01-03 10:24 ` Rafael J. Wysocki
@ 2024-01-03 11:14 ` Lukasz Luba
0 siblings, 0 replies; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 11:14 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Srinivas Pandruvada, Linux PM, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
On 1/3/24 10:24, Rafael J. Wysocki wrote:
> Hi Lukasz,
>
> On Wed, Jan 3, 2024 at 9:10 AM Lukasz Luba <lukasz.luba@arm.com> wrote:
>>
>> Hi Rafael,
>>
>> On 1/2/24 13:24, Rafael J. Wysocki wrote:
>>> On Fri, Dec 15, 2023 at 9:02 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>>>
>>>> Hi Everyone,
>>>>
>>>> This patch series redefines the thermal netlink API to be somewhat more
>>>> convenient to use on the caller side and drops some unused code from
>>>> the thermal netlink library.
>>>>
>>>> Please refer to the individual patch changelogs for details.
>>>
>>> No feedback, so this series doesn't appear to be controversial, and I
>>> would like to get it into 6.8.
>>>
>>> Tentatively queuing it up and please let me know if it is problematic.
>>>
>>> Thanks!
>>>
>>
>> I agree, these are not controversial patches, so IMO queuing them is OK.
>> I took a glance at them, but I can do the proper review today if you
>> like.
>
> Well, if you can allocate some time for that, it would be appreciated!
Sure, no problem, I'll do that today.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 1/6] thermal: trip: Constify thermal zone argument of thermal_zone_trip_id()
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
1 sibling, 0 replies; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 19:48 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM, Srinivas Pandruvada, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
On 12/15/23 19:53, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Because thermal_zone_trip_id() does not update the thermal zone object
> passed to it, its pointer argument representing the thermal zone can be
> const, so adjust its definition accordingly.
>
> No functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_core.h | 2 +-
> drivers/thermal/thermal_trip.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_core.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.h
> +++ linux-pm/drivers/thermal/thermal_core.h
> @@ -120,7 +120,7 @@ void __thermal_zone_device_update(struct
> for (__trip = __tz->trips; __trip - __tz->trips < __tz->num_trips; __trip++)
>
> void __thermal_zone_set_trips(struct thermal_zone_device *tz);
> -int thermal_zone_trip_id(struct thermal_zone_device *tz,
> +int thermal_zone_trip_id(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip);
> void thermal_zone_trip_updated(struct thermal_zone_device *tz,
> const 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
> @@ -143,7 +143,7 @@ int thermal_zone_get_trip(struct thermal
> }
> EXPORT_SYMBOL_GPL(thermal_zone_get_trip);
>
> -int thermal_zone_trip_id(struct thermal_zone_device *tz,
> +int thermal_zone_trip_id(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip)
> {
> /*
>
>
>
LGTM,
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
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
1 sibling, 1 reply; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 19:58 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Srinivas Pandruvada, Linux PM, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
On 12/15/23 19:56, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Instead of requiring the caller of thermal_notify_tz_trip_change() to
> provide specific values needed to populate struct param in it, make it
> extract those values from objects passed to it by the caller via const
> pointers.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_netlink.c | 12 +++++++-----
> drivers/thermal/thermal_netlink.h | 8 ++++----
> drivers/thermal/thermal_trip.c | 8 ++------
> 3 files changed, 13 insertions(+), 15 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_netlink.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> +++ linux-pm/drivers/thermal/thermal_netlink.c
> @@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tz
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p);
> }
>
> -int thermal_notify_tz_trip_change(int tz_id, int trip_id, int trip_type,
> - int trip_temp, int trip_hyst)
> +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> + const struct thermal_trip *trip)
> {
> - struct param p = { .tz_id = tz_id, .trip_id = trip_id,
> - .trip_type = trip_type, .trip_temp = trip_temp,
> - .trip_hyst = trip_hyst };
> + struct param p = { .tz_id = tz->id,
> + .trip_id = thermal_zone_trip_id(tz, trip),
> + .trip_type = trip->type,
> + .trip_temp = trip->temperature,
> + .trip_hyst = trip->hysteresis };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_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
> @@ -23,8 +23,8 @@ int thermal_notify_tz_trip_up(int tz_id,
> int thermal_notify_tz_trip_delete(int tz_id, int id);
> int thermal_notify_tz_trip_add(int tz_id, int id, int type,
> int temp, int hyst);
> -int thermal_notify_tz_trip_change(int tz_id, int id, int type,
> - int temp, int hyst);
> +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> + const struct thermal_trip *trip);
> 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);
> @@ -79,8 +79,8 @@ static inline int thermal_notify_tz_trip
> return 0;
> }
>
> -static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type,
> - int temp, int hyst)
> +static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
I was wondering if it's not too long line, but I can see it's common
in that header file. Shouldn't we break such lines like:
static inline
int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
const struct thermal_trip *trip)
?
Although, it would apply to all other long lines in that header, so not
particularly to this $subject.
> + const struct thermal_trip *trip)
> {
> return 0;
> }
> Index: linux-pm/drivers/thermal/thermal_trip.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_trip.c
> +++ linux-pm/drivers/thermal/thermal_trip.c
> @@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct th
> void thermal_zone_trip_updated(struct thermal_zone_device *tz,
> const struct thermal_trip *trip)
> {
> - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
> - trip->type, trip->temperature,
> - trip->hysteresis);
> + thermal_notify_tz_trip_change(tz, trip);
> __thermal_zone_device_update(tz, THERMAL_TRIP_CHANGED);
> }
>
> @@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct t
> return;
>
> trip->temperature = temp;
> - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
> - trip->type, trip->temperature,
> - trip->hysteresis);
> + thermal_notify_tz_trip_change(tz, trip);
> }
> EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);
>
>
>
Other than the comment above, LGTM.
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down()
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
1 sibling, 0 replies; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 20:00 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM, Srinivas Pandruvada, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
On 12/15/23 19:57, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Instead of requiring the callers of thermal_notify_tz_trip_up/down() to
> provide specific values needed to populate struct param in them, make
> them extract those values from objects passed by the callers via const
> pointers.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_core.c | 8 ++------
> drivers/thermal/thermal_netlink.c | 14 ++++++++++----
> drivers/thermal/thermal_netlink.h | 12 ++++++++----
> 3 files changed, 20 insertions(+), 14 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -361,9 +361,7 @@ static void handle_thermal_trip(struct t
> * the threshold and the trip temperature will be equal.
> */
> if (tz->temperature >= trip->temperature) {
> - thermal_notify_tz_trip_up(tz->id,
> - thermal_zone_trip_id(tz, trip),
> - tz->temperature);
> + thermal_notify_tz_trip_up(tz, trip);
> trip->threshold = trip->temperature - trip->hysteresis;
> } else {
> trip->threshold = trip->temperature;
> @@ -380,9 +378,7 @@ static void handle_thermal_trip(struct t
> * the trip.
> */
> if (tz->temperature < trip->temperature - trip->hysteresis) {
> - thermal_notify_tz_trip_down(tz->id,
> - thermal_zone_trip_id(tz, trip),
> - tz->temperature);
> + thermal_notify_tz_trip_down(tz, trip);
> trip->threshold = trip->temperature;
> } else {
> trip->threshold = trip->temperature - trip->hysteresis;
> Index: linux-pm/drivers/thermal/thermal_netlink.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> +++ linux-pm/drivers/thermal/thermal_netlink.c
> @@ -330,16 +330,22 @@ int thermal_notify_tz_disable(int tz_id)
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DISABLE, &p);
> }
>
> -int thermal_notify_tz_trip_down(int tz_id, int trip_id, int temp)
> +int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
> + const struct thermal_trip *trip)
> {
> - struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp };
> + struct param p = { .tz_id = tz->id,
> + .trip_id = thermal_zone_trip_id(tz, trip),
> + .temp = tz->temperature };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DOWN, &p);
> }
>
> -int thermal_notify_tz_trip_up(int tz_id, int trip_id, int temp)
> +int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
> + const struct thermal_trip *trip)
> {
> - struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp };
> + struct param p = { .tz_id = tz->id,
> + .trip_id = thermal_zone_trip_id(tz, trip),
> + .temp = tz->temperature };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p);
> }
> Index: linux-pm/drivers/thermal/thermal_netlink.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.h
> +++ linux-pm/drivers/thermal/thermal_netlink.h
> @@ -18,8 +18,10 @@ int thermal_notify_tz_create(int tz_id,
> 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_trip_down(int tz_id, int id, int temp);
> -int thermal_notify_tz_trip_up(int tz_id, int id, int temp);
> +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,
> + const struct thermal_trip *trip);
> int thermal_notify_tz_trip_delete(int tz_id, int id);
> int thermal_notify_tz_trip_add(int tz_id, int id, int type,
> int temp, int hyst);
> @@ -58,12 +60,14 @@ static inline int thermal_notify_tz_disa
> return 0;
> }
>
> -static inline int thermal_notify_tz_trip_down(int tz_id, int id, int temp)
> +static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
> + const struct thermal_trip *trip)
> {
> return 0;
> }
>
> -static inline int thermal_notify_tz_trip_up(int tz_id, int id, int temp)
> +static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
> + const struct thermal_trip *trip)
> {
> return 0;
> }
>
>
>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
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
0 siblings, 1 reply; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 20:07 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Srinivas Pandruvada, Linux PM, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
On 12/15/23 19:59, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Because thermal_notify_tz_trip_add/delete() are never used, drop them
> entirely along with the related code.
>
> The addition or removal of trip points is not supported by the thermal
> core and is unlikely to be supported in the future, so it is also
> unlikely that these functions will ever be needed.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_netlink.c | 33 +--------------------------------
> drivers/thermal/thermal_netlink.h | 14 --------------
> 2 files changed, 1 insertion(+), 46 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_netlink.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> +++ linux-pm/drivers/thermal/thermal_netlink.c
> @@ -135,7 +135,7 @@ static int thermal_genl_event_tz_trip_up
> return 0;
> }
>
> -static int thermal_genl_event_tz_trip_add(struct param *p)
> +static int thermal_genl_event_tz_trip_change(struct param *p)
> {
> if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) ||
> nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id) ||
> @@ -147,15 +147,6 @@ static int thermal_genl_event_tz_trip_ad
> return 0;
> }
>
> -static int thermal_genl_event_tz_trip_delete(struct param *p)
> -{
> - if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) ||
> - nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id))
> - return -EMSGSIZE;
> -
> - return 0;
> -}
> -
> static int thermal_genl_event_cdev_add(struct param *p)
> {
> if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME,
> @@ -245,9 +236,6 @@ int thermal_genl_event_tz_disable(struct
> int thermal_genl_event_tz_trip_down(struct param *p)
> __attribute__((alias("thermal_genl_event_tz_trip_up")));
>
> -int thermal_genl_event_tz_trip_change(struct param *p)
> - __attribute__((alias("thermal_genl_event_tz_trip_add")));
> -
> static cb_t event_cb[] = {
> [THERMAL_GENL_EVENT_TZ_CREATE] = thermal_genl_event_tz_create,
> [THERMAL_GENL_EVENT_TZ_DELETE] = thermal_genl_event_tz_delete,
> @@ -256,8 +244,6 @@ static cb_t event_cb[] = {
> [THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up,
> [THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down,
> [THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change,
> - [THERMAL_GENL_EVENT_TZ_TRIP_ADD] = thermal_genl_event_tz_trip_add,
> - [THERMAL_GENL_EVENT_TZ_TRIP_DELETE] = thermal_genl_event_tz_trip_delete,
> [THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add,
> [THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete,
> [THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update,
> @@ -350,23 +336,6 @@ int thermal_notify_tz_trip_up(const stru
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p);
> }
>
> -int thermal_notify_tz_trip_add(int tz_id, int trip_id, int trip_type,
> - int trip_temp, int trip_hyst)
> -{
> - struct param p = { .tz_id = tz_id, .trip_id = trip_id,
> - .trip_type = trip_type, .trip_temp = trip_temp,
> - .trip_hyst = trip_hyst };
> -
> - return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_ADD, &p);
> -}
> -
> -int thermal_notify_tz_trip_delete(int tz_id, int trip_id)
> -{
> - struct param p = { .tz_id = tz_id, .trip_id = trip_id };
> -
> - return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p);
> -}
> -
> int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip)
> {
> Index: linux-pm/drivers/thermal/thermal_netlink.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.h
> +++ linux-pm/drivers/thermal/thermal_netlink.h
> @@ -22,9 +22,6 @@ int thermal_notify_tz_trip_down(const st
> const struct thermal_trip *trip);
> int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip);
> -int thermal_notify_tz_trip_delete(int tz_id, int id);
> -int thermal_notify_tz_trip_add(int tz_id, int id, int type,
> - int temp, int hyst);
> int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip);
> int thermal_notify_cdev_state_update(int cdev_id, int state);
> @@ -71,17 +68,6 @@ static inline int thermal_notify_tz_trip
> {
> return 0;
> }
> -
> -static inline int thermal_notify_tz_trip_delete(int tz_id, int id)
> -{
> - return 0;
> -}
> -
> -static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type,
> - int temp, int hyst)
> -{
> - return 0;
> -}
>
> static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip)
>
>
>
We could also add a comment that these two
(THERMAL_GENL_EVENT_TZ_TRIP_ADD/DELETE) in the uapi header are obsolete.
Other than that this looks good.
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines
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
2024-01-09 11:31 ` Daniel Lezcano
1 sibling, 0 replies; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 20:08 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM, Srinivas Pandruvada, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
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>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
2024-01-03 19:58 ` Lukasz Luba
@ 2024-01-03 20:09 ` Rafael J. Wysocki
0 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2024-01-03 20:09 UTC (permalink / raw)
To: Lukasz Luba
Cc: Rafael J. Wysocki, Srinivas Pandruvada, Linux PM, Daniel Lezcano,
Zhang Rui, Linux ACPI, LKML
On Wed, Jan 3, 2024 at 8:57 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
>
>
> On 12/15/23 19:56, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > Instead of requiring the caller of thermal_notify_tz_trip_change() to
> > provide specific values needed to populate struct param in it, make it
> > extract those values from objects passed to it by the caller via const
> > pointers.
> >
> > No intentional functional impact.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> > drivers/thermal/thermal_netlink.c | 12 +++++++-----
> > drivers/thermal/thermal_netlink.h | 8 ++++----
> > drivers/thermal/thermal_trip.c | 8 ++------
> > 3 files changed, 13 insertions(+), 15 deletions(-)
> >
> > Index: linux-pm/drivers/thermal/thermal_netlink.c
> > ===================================================================
> > --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> > +++ linux-pm/drivers/thermal/thermal_netlink.c
> > @@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tz
> > return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p);
> > }
> >
> > -int thermal_notify_tz_trip_change(int tz_id, int trip_id, int trip_type,
> > - int trip_temp, int trip_hyst)
> > +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> > + const struct thermal_trip *trip)
> > {
> > - struct param p = { .tz_id = tz_id, .trip_id = trip_id,
> > - .trip_type = trip_type, .trip_temp = trip_temp,
> > - .trip_hyst = trip_hyst };
> > + struct param p = { .tz_id = tz->id,
> > + .trip_id = thermal_zone_trip_id(tz, trip),
> > + .trip_type = trip->type,
> > + .trip_temp = trip->temperature,
> > + .trip_hyst = trip->hysteresis };
> >
> > return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_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
> > @@ -23,8 +23,8 @@ int thermal_notify_tz_trip_up(int tz_id,
> > int thermal_notify_tz_trip_delete(int tz_id, int id);
> > int thermal_notify_tz_trip_add(int tz_id, int id, int type,
> > int temp, int hyst);
> > -int thermal_notify_tz_trip_change(int tz_id, int id, int type,
> > - int temp, int hyst);
> > +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> > + const struct thermal_trip *trip);
> > 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);
> > @@ -79,8 +79,8 @@ static inline int thermal_notify_tz_trip
> > return 0;
> > }
> >
> > -static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type,
> > - int temp, int hyst)
> > +static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
>
> I was wondering if it's not too long line, but I can see it's common
> in that header file. Shouldn't we break such lines like:
>
> static inline
> int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip)
>
> ?
IMO the additional line break doesn't really make it easier to read.
And note that it is OK now to have code lines longer than 80 chars (as
long as they are not longer than 100 chars IIRC), although it is still
recommended (but not required any more) to observe the "old" 80 chars
length limit.
> Although, it would apply to all other long lines in that header, so not
> particularly to this $subject.
Well, right.
> > + const struct thermal_trip *trip)
> > {
> > return 0;
> > }
> > Index: linux-pm/drivers/thermal/thermal_trip.c
> > ===================================================================
> > --- linux-pm.orig/drivers/thermal/thermal_trip.c
> > +++ linux-pm/drivers/thermal/thermal_trip.c
> > @@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct th
> > void thermal_zone_trip_updated(struct thermal_zone_device *tz,
> > const struct thermal_trip *trip)
> > {
> > - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
> > - trip->type, trip->temperature,
> > - trip->hysteresis);
> > + thermal_notify_tz_trip_change(tz, trip);
> > __thermal_zone_device_update(tz, THERMAL_TRIP_CHANGED);
> > }
> >
> > @@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct t
> > return;
> >
> > trip->temperature = temp;
> > - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
> > - trip->type, trip->temperature,
> > - trip->hysteresis);
> > + thermal_notify_tz_trip_change(tz, trip);
> > }
> > EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);
> >
> >
> >
>
> Other than the comment above, LGTM.
>
> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Thanks!
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API
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
1 sibling, 0 replies; 28+ messages in thread
From: Lukasz Luba @ 2024-01-03 20:10 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Srinivas Pandruvada, Linux PM, Daniel Lezcano, Zhang Rui,
Linux ACPI, LKML
On 12/15/23 20:02, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> The only actually used thermal netlink notification routine related
> to cooling devices is thermal_notify_cdev_state_update(). The other
> two, thermal_notify_cdev_add() and thermal_notify_cdev_delete(), are
> never used.
>
> So as to get rid of dead code, drop thermal_notify_cdev_add/delete(),
> which can be added back if they turn out to be ever needed, along with
> the related code.
>
> In analogy with the previous thermal netlink API changes, redefine
> thermal_notify_cdev_state_update() to take a const cdev pointer as its
> first argument and let it extract the requisite information from there
> by itself.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_helpers.c | 2 -
> drivers/thermal/thermal_netlink.c | 43 ++------------------------------------
> drivers/thermal/thermal_netlink.h | 19 +++-------------
> 3 files changed, 8 insertions(+), 56 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_netlink.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.h
> +++ linux-pm/drivers/thermal/thermal_netlink.h
> @@ -24,9 +24,8 @@ int thermal_notify_tz_trip_up(const stru
> const struct thermal_trip *trip);
> int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip);
> -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_cdev_state_update(const struct thermal_cooling_device *cdev,
> + int state);
> int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
> const char *name);
> int thermal_genl_sampling_temp(int id, int temp);
> @@ -76,18 +75,8 @@ static inline int thermal_notify_tz_trip
> return 0;
> }
>
> -static inline int thermal_notify_cdev_state_update(int cdev_id, int state)
> -{
> - return 0;
> -}
> -
> -static inline int thermal_notify_cdev_add(int cdev_id, const char *name,
> - int max_state)
> -{
> - return 0;
> -}
> -
> -static inline int thermal_notify_cdev_delete(int cdev_id)
> +static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
> + int state)
> {
> return 0;
> }
> Index: linux-pm/drivers/thermal/thermal_helpers.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_helpers.c
> +++ linux-pm/drivers/thermal/thermal_helpers.c
> @@ -152,7 +152,7 @@ static void thermal_cdev_set_cur_state(s
> if (cdev->ops->set_cur_state(cdev, target))
> return;
>
> - thermal_notify_cdev_state_update(cdev->id, target);
> + thermal_notify_cdev_state_update(cdev, target);
> thermal_cooling_device_stats_update(cdev, target);
> }
>
> Index: linux-pm/drivers/thermal/thermal_netlink.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> +++ linux-pm/drivers/thermal/thermal_netlink.c
> @@ -147,27 +147,6 @@ static int thermal_genl_event_tz_trip_ch
> return 0;
> }
>
> -static int thermal_genl_event_cdev_add(struct param *p)
> -{
> - if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME,
> - p->name) ||
> - nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID,
> - p->cdev_id) ||
> - nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_MAX_STATE,
> - p->cdev_max_state))
> - return -EMSGSIZE;
> -
> - return 0;
> -}
> -
> -static int thermal_genl_event_cdev_delete(struct param *p)
> -{
> - if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID, p->cdev_id))
> - return -EMSGSIZE;
> -
> - return 0;
> -}
> -
> static int thermal_genl_event_cdev_state_update(struct param *p)
> {
> if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID,
> @@ -244,8 +223,6 @@ static cb_t event_cb[] = {
> [THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up,
> [THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down,
> [THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change,
> - [THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add,
> - [THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete,
> [THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update,
> [THERMAL_GENL_EVENT_TZ_GOV_CHANGE] = thermal_genl_event_gov_change,
> [THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE] = thermal_genl_event_cpu_capability_change,
> @@ -348,28 +325,14 @@ int thermal_notify_tz_trip_change(const
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, &p);
> }
>
> -int thermal_notify_cdev_state_update(int cdev_id, int cdev_state)
> +int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
> + int state)
> {
> - struct param p = { .cdev_id = cdev_id, .cdev_state = cdev_state };
> + struct param p = { .cdev_id = cdev->id, .cdev_state = state };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_STATE_UPDATE, &p);
> }
>
> -int thermal_notify_cdev_add(int cdev_id, const char *name, int cdev_max_state)
> -{
> - struct param p = { .cdev_id = cdev_id, .name = name,
> - .cdev_max_state = cdev_max_state };
> -
> - return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_ADD, &p);
> -}
> -
> -int thermal_notify_cdev_delete(int cdev_id)
> -{
> - struct param p = { .cdev_id = cdev_id };
> -
> - return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_DELETE, &p);
> -}
> -
> int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
> const char *name)
> {
>
>
>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
2024-01-03 20:07 ` Lukasz Luba
@ 2024-01-04 11:12 ` Rafael J. Wysocki
2024-01-09 11:29 ` Daniel Lezcano
0 siblings, 1 reply; 28+ messages in thread
From: Rafael J. Wysocki @ 2024-01-04 11:12 UTC (permalink / raw)
To: Lukasz Luba
Cc: Rafael J. Wysocki, Srinivas Pandruvada, Linux PM, Daniel Lezcano,
Zhang Rui, Linux ACPI, LKML
On Wed, Jan 3, 2024 at 9:06 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
>
>
> On 12/15/23 19:59, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > Because thermal_notify_tz_trip_add/delete() are never used, drop them
> > entirely along with the related code.
> >
> > The addition or removal of trip points is not supported by the thermal
> > core and is unlikely to be supported in the future, so it is also
> > unlikely that these functions will ever be needed.
> >
> > No intentional functional impact.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> > drivers/thermal/thermal_netlink.c | 33 +--------------------------------
> > drivers/thermal/thermal_netlink.h | 14 --------------
> > 2 files changed, 1 insertion(+), 46 deletions(-)
> >
> > Index: linux-pm/drivers/thermal/thermal_netlink.c
> > ===================================================================
> > --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> > +++ linux-pm/drivers/thermal/thermal_netlink.c
> > @@ -135,7 +135,7 @@ static int thermal_genl_event_tz_trip_up
> > return 0;
> > }
> >
> > -static int thermal_genl_event_tz_trip_add(struct param *p)
> > +static int thermal_genl_event_tz_trip_change(struct param *p)
> > {
> > if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) ||
> > nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id) ||
> > @@ -147,15 +147,6 @@ static int thermal_genl_event_tz_trip_ad
> > return 0;
> > }
> >
> > -static int thermal_genl_event_tz_trip_delete(struct param *p)
> > -{
> > - if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) ||
> > - nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id))
> > - return -EMSGSIZE;
> > -
> > - return 0;
> > -}
> > -
> > static int thermal_genl_event_cdev_add(struct param *p)
> > {
> > if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME,
> > @@ -245,9 +236,6 @@ int thermal_genl_event_tz_disable(struct
> > int thermal_genl_event_tz_trip_down(struct param *p)
> > __attribute__((alias("thermal_genl_event_tz_trip_up")));
> >
> > -int thermal_genl_event_tz_trip_change(struct param *p)
> > - __attribute__((alias("thermal_genl_event_tz_trip_add")));
> > -
> > static cb_t event_cb[] = {
> > [THERMAL_GENL_EVENT_TZ_CREATE] = thermal_genl_event_tz_create,
> > [THERMAL_GENL_EVENT_TZ_DELETE] = thermal_genl_event_tz_delete,
> > @@ -256,8 +244,6 @@ static cb_t event_cb[] = {
> > [THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up,
> > [THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down,
> > [THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change,
> > - [THERMAL_GENL_EVENT_TZ_TRIP_ADD] = thermal_genl_event_tz_trip_add,
> > - [THERMAL_GENL_EVENT_TZ_TRIP_DELETE] = thermal_genl_event_tz_trip_delete,
> > [THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add,
> > [THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete,
> > [THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update,
> > @@ -350,23 +336,6 @@ int thermal_notify_tz_trip_up(const stru
> > return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p);
> > }
> >
> > -int thermal_notify_tz_trip_add(int tz_id, int trip_id, int trip_type,
> > - int trip_temp, int trip_hyst)
> > -{
> > - struct param p = { .tz_id = tz_id, .trip_id = trip_id,
> > - .trip_type = trip_type, .trip_temp = trip_temp,
> > - .trip_hyst = trip_hyst };
> > -
> > - return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_ADD, &p);
> > -}
> > -
> > -int thermal_notify_tz_trip_delete(int tz_id, int trip_id)
> > -{
> > - struct param p = { .tz_id = tz_id, .trip_id = trip_id };
> > -
> > - return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p);
> > -}
> > -
> > int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> > const struct thermal_trip *trip)
> > {
> > Index: linux-pm/drivers/thermal/thermal_netlink.h
> > ===================================================================
> > --- linux-pm.orig/drivers/thermal/thermal_netlink.h
> > +++ linux-pm/drivers/thermal/thermal_netlink.h
> > @@ -22,9 +22,6 @@ int thermal_notify_tz_trip_down(const st
> > const struct thermal_trip *trip);
> > int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
> > const struct thermal_trip *trip);
> > -int thermal_notify_tz_trip_delete(int tz_id, int id);
> > -int thermal_notify_tz_trip_add(int tz_id, int id, int type,
> > - int temp, int hyst);
> > int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> > const struct thermal_trip *trip);
> > int thermal_notify_cdev_state_update(int cdev_id, int state);
> > @@ -71,17 +68,6 @@ static inline int thermal_notify_tz_trip
> > {
> > return 0;
> > }
> > -
> > -static inline int thermal_notify_tz_trip_delete(int tz_id, int id)
> > -{
> > - return 0;
> > -}
> > -
> > -static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type,
> > - int temp, int hyst)
> > -{
> > - return 0;
> > -}
> >
> > static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> > const struct thermal_trip *trip)
> >
> >
> >
>
> We could also add a comment that these two
> (THERMAL_GENL_EVENT_TZ_TRIP_ADD/DELETE) in the uapi header are obsolete.
I'd rather say they are placeholders for message types that have never
been sent by the kernel - and nothing changes in that respect after
the $subject patch. They have been unused so far and they are still
unused (it is easier to figure that out through code inspection,
however).
And even though it is unlikely that they will be used in the future,
it is not entirely unimaginable.
> Other than that this looks good.
>
> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Thanks a lot for all of the reviews!
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
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-09 11:11 ` Daniel Lezcano
1 sibling, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2024-01-09 11:11 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux PM
Cc: Srinivas Pandruvada, Zhang Rui, Linux ACPI, LKML, Lukasz Luba
On 15/12/2023 20:56, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Instead of requiring the caller of thermal_notify_tz_trip_change() to
> provide specific values needed to populate struct param in it, make it
> extract those values from objects passed to it by the caller via const
> pointers.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 1/6] thermal: trip: Constify thermal zone argument of thermal_zone_trip_id()
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
1 sibling, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2024-01-09 11:12 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux PM
Cc: Srinivas Pandruvada, Zhang Rui, Linux ACPI, LKML, Lukasz Luba
On 15/12/2023 20:53, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Because thermal_zone_trip_id() does not update the thermal zone object
> passed to it, its pointer argument representing the thermal zone can be
> const, so adjust its definition accordingly.
>
> No functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down()
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
1 sibling, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2024-01-09 11:28 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux PM
Cc: Srinivas Pandruvada, Zhang Rui, Linux ACPI, LKML, Lukasz Luba
On 15/12/2023 20:57, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Instead of requiring the callers of thermal_notify_tz_trip_up/down() to
> provide specific values needed to populate struct param in them, make
> them extract those values from objects passed by the callers via const
> pointers.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
2024-01-04 11:12 ` Rafael J. Wysocki
@ 2024-01-09 11:29 ` Daniel Lezcano
0 siblings, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2024-01-09 11:29 UTC (permalink / raw)
To: Rafael J. Wysocki, Lukasz Luba
Cc: Rafael J. Wysocki, Srinivas Pandruvada, Linux PM, Zhang Rui,
Linux ACPI, LKML
On 04/01/2024 12:12, Rafael J. Wysocki wrote:
> On Wed, Jan 3, 2024 at 9:06 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>>
>>
>>
>> On 12/15/23 19:59, Rafael J. Wysocki wrote:
>>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>
>>> Because thermal_notify_tz_trip_add/delete() are never used, drop them
>>> entirely along with the related code.
>>>
>>> The addition or removal of trip points is not supported by the thermal
>>> core and is unlikely to be supported in the future, so it is also
>>> unlikely that these functions will ever be needed.
>>>
>>> No intentional functional impact.
>>>
>>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines
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
@ 2024-01-09 11:31 ` Daniel Lezcano
1 sibling, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2024-01-09 11:31 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux PM
Cc: Srinivas Pandruvada, Zhang Rui, Linux ACPI, LKML, Lukasz Luba
On 15/12/2023 21: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>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API
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
1 sibling, 1 reply; 28+ messages in thread
From: Daniel Lezcano @ 2024-01-09 11:36 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux PM
Cc: Srinivas Pandruvada, Zhang Rui, Linux ACPI, LKML, Lukasz Luba
On 15/12/2023 21:02, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> The only actually used thermal netlink notification routine related
> to cooling devices is thermal_notify_cdev_state_update(). The other
> two, thermal_notify_cdev_add() and thermal_notify_cdev_delete(), are
> never used.
I think it is an oversight. These should be called in
thermal_cooling_device_[un]register()
> So as to get rid of dead code, drop thermal_notify_cdev_add/delete(),
> which can be added back if they turn out to be ever needed, along with
> the related code.
>
> In analogy with the previous thermal netlink API changes, redefine
> thermal_notify_cdev_state_update() to take a const cdev pointer as its
> first argument and let it extract the requisite information from there
> by itself.
>
> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_helpers.c | 2 -
> drivers/thermal/thermal_netlink.c | 43 ++------------------------------------
> drivers/thermal/thermal_netlink.h | 19 +++-------------
> 3 files changed, 8 insertions(+), 56 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_netlink.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.h
> +++ linux-pm/drivers/thermal/thermal_netlink.h
> @@ -24,9 +24,8 @@ int thermal_notify_tz_trip_up(const stru
> const struct thermal_trip *trip);
> int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
> const struct thermal_trip *trip);
> -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_cdev_state_update(const struct thermal_cooling_device *cdev,
> + int state);
> int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
> const char *name);
> int thermal_genl_sampling_temp(int id, int temp);
> @@ -76,18 +75,8 @@ static inline int thermal_notify_tz_trip
> return 0;
> }
>
> -static inline int thermal_notify_cdev_state_update(int cdev_id, int state)
> -{
> - return 0;
> -}
> -
> -static inline int thermal_notify_cdev_add(int cdev_id, const char *name,
> - int max_state)
> -{
> - return 0;
> -}
> -
> -static inline int thermal_notify_cdev_delete(int cdev_id)
> +static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
> + int state)
> {
> return 0;
> }
> Index: linux-pm/drivers/thermal/thermal_helpers.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_helpers.c
> +++ linux-pm/drivers/thermal/thermal_helpers.c
> @@ -152,7 +152,7 @@ static void thermal_cdev_set_cur_state(s
> if (cdev->ops->set_cur_state(cdev, target))
> return;
>
> - thermal_notify_cdev_state_update(cdev->id, target);
> + thermal_notify_cdev_state_update(cdev, target);
> thermal_cooling_device_stats_update(cdev, target);
> }
>
> Index: linux-pm/drivers/thermal/thermal_netlink.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_netlink.c
> +++ linux-pm/drivers/thermal/thermal_netlink.c
> @@ -147,27 +147,6 @@ static int thermal_genl_event_tz_trip_ch
> return 0;
> }
>
> -static int thermal_genl_event_cdev_add(struct param *p)
> -{
> - if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME,
> - p->name) ||
> - nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID,
> - p->cdev_id) ||
> - nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_MAX_STATE,
> - p->cdev_max_state))
> - return -EMSGSIZE;
> -
> - return 0;
> -}
> -
> -static int thermal_genl_event_cdev_delete(struct param *p)
> -{
> - if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID, p->cdev_id))
> - return -EMSGSIZE;
> -
> - return 0;
> -}
> -
> static int thermal_genl_event_cdev_state_update(struct param *p)
> {
> if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID,
> @@ -244,8 +223,6 @@ static cb_t event_cb[] = {
> [THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up,
> [THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down,
> [THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change,
> - [THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add,
> - [THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete,
> [THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update,
> [THERMAL_GENL_EVENT_TZ_GOV_CHANGE] = thermal_genl_event_gov_change,
> [THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE] = thermal_genl_event_cpu_capability_change,
> @@ -348,28 +325,14 @@ int thermal_notify_tz_trip_change(const
> return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, &p);
> }
>
> -int thermal_notify_cdev_state_update(int cdev_id, int cdev_state)
> +int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
> + int state)
> {
> - struct param p = { .cdev_id = cdev_id, .cdev_state = cdev_state };
> + struct param p = { .cdev_id = cdev->id, .cdev_state = state };
>
> return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_STATE_UPDATE, &p);
> }
>
> -int thermal_notify_cdev_add(int cdev_id, const char *name, int cdev_max_state)
> -{
> - struct param p = { .cdev_id = cdev_id, .name = name,
> - .cdev_max_state = cdev_max_state };
> -
> - return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_ADD, &p);
> -}
> -
> -int thermal_notify_cdev_delete(int cdev_id)
> -{
> - struct param p = { .cdev_id = cdev_id };
> -
> - return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_DELETE, &p);
> -}
> -
> int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
> const char *name)
> {
>
>
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API
2024-01-09 11:36 ` Daniel Lezcano
@ 2024-01-09 12:23 ` Rafael J. Wysocki
0 siblings, 0 replies; 28+ messages in thread
From: Rafael J. Wysocki @ 2024-01-09 12:23 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Rafael J. Wysocki, Linux PM, Srinivas Pandruvada, Zhang Rui,
Linux ACPI, LKML, Lukasz Luba
On Tue, Jan 9, 2024 at 12:36 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 15/12/2023 21:02, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > The only actually used thermal netlink notification routine related
> > to cooling devices is thermal_notify_cdev_state_update(). The other
> > two, thermal_notify_cdev_add() and thermal_notify_cdev_delete(), are
> > never used.
>
> I think it is an oversight. These should be called in
> thermal_cooling_device_[un]register()
OK, so for now I'll just change them to take a (const) pointer to the
cdev as the argument - the rest they can get from there.
A patch adding them to thermal_cooling_device_[un]register() would be
separate, for the next cycle. Where should they be called in there?
Under thermal_list_lock I suppose?
I'll send a replacement for the $subject patch later and I'll queue up
the rest of the series.
Thanks for the reviews!
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2024-01-09 12:24 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox