Skip to content

Commit 11fde93

Browse files
committed
thermal: netlink: Rework notify API for cooling devices
In analogy with some previous thermal netlink API changes, redefine thermal_notify_cdev_state_update(), thermal_notify_cdev_add() and thermal_notify_cdev_delete() to take a const cdev pointer as their first argument and let them extract the requisite information from there by themselves. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
1 parent 57a427c commit 11fde93

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

drivers/thermal/thermal_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static int thermal_cdev_set_cur_state(struct thermal_cooling_device *cdev, int s
156156
*/
157157
ret = cdev->ops->set_cur_state(cdev, state);
158158
if (!ret) {
159-
thermal_notify_cdev_state_update(cdev->id, state);
159+
thermal_notify_cdev_state_update(cdev, state);
160160
thermal_cooling_device_stats_update(cdev, state);
161161
thermal_debug_cdev_state_update(cdev, state);
162162
}

drivers/thermal/thermal_netlink.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,24 +364,25 @@ int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
364364
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, &p);
365365
}
366366

367-
int thermal_notify_cdev_state_update(int cdev_id, int cdev_state)
367+
int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
368+
int state)
368369
{
369-
struct param p = { .cdev_id = cdev_id, .cdev_state = cdev_state };
370+
struct param p = { .cdev_id = cdev->id, .cdev_state = state };
370371

371372
return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_STATE_UPDATE, &p);
372373
}
373374

374-
int thermal_notify_cdev_add(int cdev_id, const char *name, int cdev_max_state)
375+
int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
375376
{
376-
struct param p = { .cdev_id = cdev_id, .name = name,
377-
.cdev_max_state = cdev_max_state };
377+
struct param p = { .cdev_id = cdev->id, .name = cdev->type,
378+
.cdev_max_state = cdev->max_state };
378379

379380
return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_ADD, &p);
380381
}
381382

382-
int thermal_notify_cdev_delete(int cdev_id)
383+
int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
383384
{
384-
struct param p = { .cdev_id = cdev_id };
385+
struct param p = { .cdev_id = cdev->id };
385386

386387
return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_DELETE, &p);
387388
}

drivers/thermal/thermal_netlink.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct thermal_genl_cpu_caps {
1212

1313
struct thermal_zone_device;
1414
struct thermal_trip;
15+
struct thermal_cooling_device;
1516

1617
/* Netlink notification function */
1718
#ifdef CONFIG_THERMAL_NETLINK
@@ -27,9 +28,10 @@ int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
2728
const struct thermal_trip *trip);
2829
int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
2930
const struct thermal_trip *trip);
30-
int thermal_notify_cdev_state_update(int cdev_id, int state);
31-
int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state);
32-
int thermal_notify_cdev_delete(int cdev_id);
31+
int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
32+
int state);
33+
int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev);
34+
int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev);
3335
int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz,
3436
const char *name);
3537
int thermal_genl_sampling_temp(int id, int temp);
@@ -79,18 +81,18 @@ static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device
7981
return 0;
8082
}
8183

82-
static inline int thermal_notify_cdev_state_update(int cdev_id, int state)
84+
static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev,
85+
int state)
8386
{
8487
return 0;
8588
}
8689

87-
static inline int thermal_notify_cdev_add(int cdev_id, const char *name,
88-
int max_state)
90+
static inline int thermal_notify_cdev_add(const struct thermal_cooling_device *cdev)
8991
{
9092
return 0;
9193
}
9294

93-
static inline int thermal_notify_cdev_delete(int cdev_id)
95+
static inline int thermal_notify_cdev_delete(const struct thermal_cooling_device *cdev)
9496
{
9597
return 0;
9698
}

0 commit comments

Comments
 (0)