thermal: netlink: Redefine the API and drop unused code
cover thermal: netlink: Redefine the API and drop unused code
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!
PATCH 1/6 thermal: trip: Constify thermal zone argument of thermal_zone_trip_id()
From: Rafael J. Wysocki <[email protected]>
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.
--- drivers/thermal/thermal_core.h | 2 +- drivers/thermal/thermal_trip.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/thermal_core.h +1 -1
@@ -120,7 +120,7 @@ void __thermal_zone_device_update(structfor (__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);
drivers/thermal/thermal_trip.c +1 -1
@@ -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) {/*
Re: [PATCH v1 1/6] thermal: trip: Constify thermal zone argument of thermal_zone_trip_id()
Quoted 35 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_core.h +1
-1@@ -120,7 +120,7 @@ void __thermal_zone_device_update(structfor (__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
===================================================================
drivers/thermal/thermal_trip.c int thermal_zone_get_trip(struct thermal · line 149
Quoted 8 lines
drivers/thermal/thermal_trip.c +1
-1@@ -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,
Re: [PATCH v1 1/6] thermal: trip: Constify thermal zone argument of thermal_zone_trip_id()
In reply to Rafael J. WysockiQuoted 9 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>
Signature · 5 lines
<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
PATCH 2/6 thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- 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(-)
drivers/thermal/thermal_netlink.c +7 -5
@@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tzreturn 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); }
drivers/thermal/thermal_netlink.h +4 -4
@@ -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_tripreturn 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 ; }
drivers/thermal/thermal_trip.c +2 -6
@@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct thvoid 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 treturn ; 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);
Re: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
Quoted 56 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_netlink.c +7
-5@@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tzreturn 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
===================================================================drivers/thermal/thermal_netlink.h +2
-2@@ -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);
drivers/thermal/thermal_netlink.h static inline int thermal_notify_tz_trip · line 82
Quoted 6 lines
drivers/thermal/thermal_netlink.h +1
-2@@ -79,8 +79,8 @@ static inline int thermal_notify_tz_tripreturn 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.
Quoted 23 lines
drivers/thermal/thermal_netlink.h +1
-0+ const struct thermal_trip *trip) {return 0 ; }Index:
linux-pm/drivers/thermal/thermal_trip.c
===================================================================drivers/thermal/thermal_trip.c +1
-3@@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct thvoid 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 ); }
drivers/thermal/thermal_trip.c void thermal_zone_set_trip_temp(struct t · line 171
Quoted 9 lines
drivers/thermal/thermal_trip.c +1
-3@@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct treturn ; 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.
Rafael J. Wysocki
maintainerRe: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
Quoted 70 lines · Lukasz Luba
Quoted 56 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_netlink.c +7
-5@@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tzreturn 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
===================================================================drivers/thermal/thermal_netlink.h +2
-2@@ -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);drivers/thermal/thermal_netlink.h static inline int thermal_notify_tz_trip · line 82
Quoted 6 lines
drivers/thermal/thermal_netlink.h +1
-2@@ -79,8 +79,8 @@ static inline int thermal_notify_tz_tripreturn 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:
Quoted 5 lines
static inline
int thermal_notify_tz_trip_change(const structthermal_zone_device*tz,
const structthermal_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.
Quoted 2 lines
Although, it would apply to all other long lines in that header, so not particularly to this $subject.
Well, right.
Quoted 35 lines
Quoted 23 lines
drivers/thermal/thermal_netlink.h +1
-0+ const struct thermal_trip *trip) {return 0 ; }Index:
linux-pm/drivers/thermal/thermal_trip.c
===================================================================drivers/thermal/thermal_trip.c +1
-3@@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct thvoid 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 ); }drivers/thermal/thermal_trip.c void thermal_zone_set_trip_temp(struct t · line 171
Quoted 9 lines
drivers/thermal/thermal_trip.c +1
-3@@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct treturn ; 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.
Quoted 1 line
Reviewed-by Lukasz Luba <[email protected]>
Thanks!
Re: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
In reply to Rafael J. WysockiQuoted 10 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>
Signature · 5 lines
<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
PATCH 3/6 thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- 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(-)
drivers/thermal/thermal_core.c +2 -6
@@ -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;
drivers/thermal/thermal_netlink.c +10 -4
@@ -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); }
drivers/thermal/thermal_netlink.h +8 -4
@@ -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_disareturn 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 ; }
Re: [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down()
Quoted 100 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_core.c +2
-6@@ -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
===================================================================drivers/thermal/thermal_netlink.c +10
-4@@ -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
===================================================================drivers/thermal/thermal_netlink.h +6
-3@@ -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_disareturn 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)
drivers/thermal/thermal_netlink.h static inline int thermal_notify_tz_disa · line 73
Quoted 10 lines
drivers/thermal/thermal_netlink.h +2
-1{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 ; }
Re: [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down()
In reply to Rafael J. WysockiQuoted 11 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>---
Signature · 5 lines
<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
PATCH 4/6 thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- drivers/thermal/thermal_netlink.c | 33 +-------------------------------- drivers/thermal/thermal_netlink.h | 14 -------------- 2 files changed, 1 insertion(+), 46 deletions(-)
drivers/thermal/thermal_netlink.c +1 -32
@@ -135,7 +135,7 @@ static int thermal_genl_event_tz_trip_upreturn 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_adreturn 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(structint 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 strureturn 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) {
drivers/thermal/thermal_netlink.h +0 -14
@@ -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)
Re: [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
Quoted 114 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_netlink.c +1
-32@@ -135,7 +135,7 @@ static int thermal_genl_event_tz_trip_upreturn 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_adreturn 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(structint 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 strureturn 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
===================================================================drivers/thermal/thermal_netlink.h +0
-7@@ -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 ;
drivers/thermal/thermal_netlink.h static inline int thermal_notify_tz_trip · line 73
Quoted 10 lines
drivers/thermal/thermal_netlink.h +0
-7-} - -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.
Rafael J. Wysocki
maintainerRe: [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
Quoted 123 lines · Lukasz Luba
Quoted 119 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_netlink.c +1
-32@@ -135,7 +135,7 @@ static int thermal_genl_event_tz_trip_upreturn 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_adreturn 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(structint 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 strureturn 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
===================================================================drivers/thermal/thermal_netlink.h +0
-14@@ -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 ; -}
Quoted 8 lines
drivers/thermal/thermal_netlink.h static inline int thermal_notify_tz_trip · line 73
Quoted 5 lines
drivers/thermal/thermal_netlink.h +0
-0static 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.
Quoted 3 lines
Other than that this looks good.
Reviewed-by Lukasz Luba <[email protected]>
Thanks a lot for all of the reviews!
Daniel Lezcano
Acked-byRe: [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete()
Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Lukasz Luba
Quoted 5 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Because thermal_notify_tz_trip_add/delete() are never used, drop them entirely along with the related code.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
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 <[email protected]>
Signature · 5 lines
<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
PATCH 5/6 thermal: netlink: Pass thermal zone pointer to notify routines
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- 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(-)
drivers/thermal/thermal_core.c +5 -5
@@ -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(struput_device (&tz->device); -thermal_notify_tz_delete (tz_id); +thermal_notify_tz_delete (tz);wait_for_completion (&tz->removal);kfree (tz);
drivers/thermal/thermal_netlink.c +11 -10
@@ -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); }
drivers/thermal/thermal_netlink.h +12 -10
@@ -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(constint 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(vreturn 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_dereturn 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 ; }
Re: [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines
Quoted 178 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_core.c +5
-5@@ -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(struput_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
===================================================================drivers/thermal/thermal_netlink.c +11
-10@@ -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
===================================================================drivers/thermal/thermal_netlink.h +10
-9@@ -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(constint 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(vreturn 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 ; }
drivers/thermal/thermal_netlink.h static inline int thermal_notify_cdev_de · line 99
Quoted 9 lines
drivers/thermal/thermal_netlink.h +2
-1@@ -91,7 +92,8 @@ static inline int thermal_notify_cdev_dereturn 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 ; }
Re: [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines
In reply to Rafael J. WysockiQuoted 8 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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.
Quoted 5 lines
Modify the code accordingly.
No intentional functional impact.
Signed-off-by Rafael J. Wysocki <[email protected]>
Signature · 5 lines
<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
PATCH 6/6 thermal: netlink: Rework cdev-related notify API
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
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.
--- 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(-)
drivers/thermal/thermal_netlink.h +4 -15
@@ -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_tripreturn 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 ; }
drivers/thermal/thermal_helpers.c +1 -1
@@ -152,7 +152,7 @@ static void thermal_cdev_set_cur_state(sif (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); }
drivers/thermal/thermal_netlink.c +3 -40
66 lines not on this page · raw message
Re: [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API
Quoted 141 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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()andthermal_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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_netlink.h +4
-15@@ -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_tripreturn 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
===================================================================drivers/thermal/thermal_helpers.c +1
-1@@ -152,7 +152,7 @@ static void thermal_cdev_set_cur_state(sif (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
===================================================================drivers/thermal/thermal_netlink.c +3
-33@@ -147,27 +147,6 @@ static int thermal_genl_event_tz_trip_chreturn 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(constreturn 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); -} -
drivers/thermal/thermal_netlink.c int thermal_notify_tz_trip_change(const · line 338
Quoted 10 lines
drivers/thermal/thermal_netlink.c +0
-7-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) {
Re: [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API
In reply to Rafael J. WysockiQuoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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()andthermal_notify_cdev_delete(), are never used.
I think it is an oversight. These should be called in thermal_cooling_device_[un]register()
Quoted 144 lines
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 <[email protected]>--- 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
===================================================================drivers/thermal/thermal_netlink.h +4
-15@@ -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_tripreturn 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
===================================================================drivers/thermal/thermal_helpers.c +1
-1@@ -152,7 +152,7 @@ static void thermal_cdev_set_cur_state(sif (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
===================================================================drivers/thermal/thermal_netlink.c +3
-40@@ -147,27 +147,6 @@ static int thermal_genl_event_tz_trip_chreturn 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(constreturn 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) {
Signature · 5 lines
<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
Rafael J. Wysocki
maintainerRe: [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API
Quoted 11 lines · Daniel Lezcano
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
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()andthermal_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!
Rafael J. Wysocki
maintainerQuoted 8 lines · Rafael J. Wysocki
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!
Lukasz Luba
reviewerHi Rafael,
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Rafael J. Wysocki
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.
Quoted 9 lines
Quoted 1 line
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
Rafael J. Wysocki
maintainerHi Lukasz,
Quoted 17 lines · Lukasz Luba
Hi Rafael,
Quoted 13 lines · Rafael J. Wysocki
Quoted 8 lines · Rafael J. Wysocki
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.
Quoted 8 lines
Quoted 4 lines
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!
Lukasz Luba
reviewerQuoted 22 lines · Rafael J. Wysocki
Hi Lukasz,
Quoted 19 lines · Lukasz Luba
Hi Rafael,
Quoted 15 lines · Rafael J. Wysocki
Quoted 8 lines · Rafael J. Wysocki
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.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
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.
Hi Rafael,
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Rafael J. Wysocki
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.
Quoted 6 lines
Quoted 1 line
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 ?
Signature · 5 lines
<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
Rafael J. Wysocki
maintainerHi Daniel,
Quoted 15 lines · Daniel Lezcano
Hi Rafael,
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Rafael J. Wysocki
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.
Quoted 7 lines
Quoted 4 lines
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?