Skip to content

Commit 7e72fc4

Browse files
committed
thermal: netlink: Pass pointers to thermal_notify_tz_trip_change()
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: Lukasz Luba <lukasz.luba@arm.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent f380846 commit 7e72fc4

3 files changed

Lines changed: 17 additions & 16 deletions

File tree

drivers/thermal/thermal_netlink.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,14 @@ int thermal_notify_tz_trip_delete(int tz_id, int trip_id)
377377
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p);
378378
}
379379

380-
int thermal_notify_tz_trip_change(int tz_id, int trip_id, int trip_type,
381-
int trip_temp, int trip_hyst)
382-
{
383-
struct param p = { .tz_id = tz_id, .trip_id = trip_id,
384-
.trip_type = trip_type, .trip_temp = trip_temp,
385-
.trip_hyst = trip_hyst };
380+
int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
381+
const struct thermal_trip *trip)
382+
{
383+
struct param p = { .tz_id = tz->id,
384+
.trip_id = thermal_zone_trip_id(tz, trip),
385+
.trip_type = trip->type,
386+
.trip_temp = trip->temperature,
387+
.trip_hyst = trip->hysteresis };
386388

387389
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, &p);
388390
}

drivers/thermal/thermal_netlink.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ struct thermal_genl_cpu_caps {
1010
int efficiency;
1111
};
1212

13+
struct thermal_zone_device;
14+
struct thermal_trip;
15+
1316
/* Netlink notification function */
1417
#ifdef CONFIG_THERMAL_NETLINK
1518
int __init thermal_netlink_init(void);
@@ -23,8 +26,8 @@ int thermal_notify_tz_trip_up(int tz_id, int id, int temp);
2326
int thermal_notify_tz_trip_delete(int tz_id, int id);
2427
int thermal_notify_tz_trip_add(int tz_id, int id, int type,
2528
int temp, int hyst);
26-
int thermal_notify_tz_trip_change(int tz_id, int id, int type,
27-
int temp, int hyst);
29+
int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
30+
const struct thermal_trip *trip);
2831
int thermal_notify_cdev_state_update(int cdev_id, int state);
2932
int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state);
3033
int thermal_notify_cdev_delete(int cdev_id);
@@ -79,8 +82,8 @@ static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type,
7982
return 0;
8083
}
8184

82-
static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type,
83-
int temp, int hyst)
85+
static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz,
86+
const struct thermal_trip *trip)
8487
{
8588
return 0;
8689
}

drivers/thermal/thermal_trip.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct thermal_zone_device *tz,
155155
void thermal_zone_trip_updated(struct thermal_zone_device *tz,
156156
const struct thermal_trip *trip)
157157
{
158-
thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
159-
trip->type, trip->temperature,
160-
trip->hysteresis);
158+
thermal_notify_tz_trip_change(tz, trip);
161159
__thermal_zone_device_update(tz, THERMAL_TRIP_CHANGED);
162160
}
163161

@@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
168166
return;
169167

170168
trip->temperature = temp;
171-
thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip),
172-
trip->type, trip->temperature,
173-
trip->hysteresis);
169+
thermal_notify_tz_trip_change(tz, trip);
174170
}
175171
EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);

0 commit comments

Comments
 (0)