Skip to content

Commit f52557e

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

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

drivers/thermal/thermal_core.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz,
381381
* the threshold and the trip temperature will be equal.
382382
*/
383383
if (tz->temperature >= trip->temperature) {
384-
thermal_notify_tz_trip_up(tz->id,
385-
thermal_zone_trip_id(tz, trip),
386-
tz->temperature);
384+
thermal_notify_tz_trip_up(tz, trip);
387385
trip->threshold = trip->temperature - trip->hysteresis;
388386
} else {
389387
trip->threshold = trip->temperature;
@@ -400,9 +398,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz,
400398
* the trip.
401399
*/
402400
if (tz->temperature < trip->temperature - trip->hysteresis) {
403-
thermal_notify_tz_trip_down(tz->id,
404-
thermal_zone_trip_id(tz, trip),
405-
tz->temperature);
401+
thermal_notify_tz_trip_down(tz, trip);
406402
trip->threshold = trip->temperature;
407403
} else {
408404
trip->threshold = trip->temperature - trip->hysteresis;

drivers/thermal/thermal_netlink.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,16 +346,22 @@ int thermal_notify_tz_disable(int tz_id)
346346
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DISABLE, &p);
347347
}
348348

349-
int thermal_notify_tz_trip_down(int tz_id, int trip_id, int temp)
349+
int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
350+
const struct thermal_trip *trip)
350351
{
351-
struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp };
352+
struct param p = { .tz_id = tz->id,
353+
.trip_id = thermal_zone_trip_id(tz, trip),
354+
.temp = tz->temperature };
352355

353356
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DOWN, &p);
354357
}
355358

356-
int thermal_notify_tz_trip_up(int tz_id, int trip_id, int temp)
359+
int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
360+
const struct thermal_trip *trip)
357361
{
358-
struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp };
362+
struct param p = { .tz_id = tz->id,
363+
.trip_id = thermal_zone_trip_id(tz, trip),
364+
.temp = tz->temperature };
359365

360366
return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p);
361367
}

drivers/thermal/thermal_netlink.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ int thermal_notify_tz_create(int tz_id, const char *name);
2121
int thermal_notify_tz_delete(int tz_id);
2222
int thermal_notify_tz_enable(int tz_id);
2323
int thermal_notify_tz_disable(int tz_id);
24-
int thermal_notify_tz_trip_down(int tz_id, int id, int temp);
25-
int thermal_notify_tz_trip_up(int tz_id, int id, int temp);
24+
int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
25+
const struct thermal_trip *trip);
26+
int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
27+
const struct thermal_trip *trip);
2628
int thermal_notify_tz_trip_delete(int tz_id, int id);
2729
int thermal_notify_tz_trip_add(int tz_id, int id, int type,
2830
int temp, int hyst);
@@ -61,12 +63,14 @@ static inline int thermal_notify_tz_disable(int tz_id)
6163
return 0;
6264
}
6365

64-
static inline int thermal_notify_tz_trip_down(int tz_id, int id, int temp)
66+
static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz,
67+
const struct thermal_trip *trip)
6568
{
6669
return 0;
6770
}
6871

69-
static inline int thermal_notify_tz_trip_up(int tz_id, int id, int temp)
72+
static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz,
73+
const struct thermal_trip *trip)
7074
{
7175
return 0;
7276
}

0 commit comments

Comments
 (0)