Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: gov_user_space: Use .trip_crossed() instead of .throttle()

Notifying user space about trip points that have not been crossed is
not particularly useful, so modify the User Space governor to use the
.trip_crossed() callback, which is only invoked for trips that have been
crossed, instead of .throttle() that is invoked for all trips in a
thermal zone every time the zone is updated.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

+5 -5
+5 -5
drivers/thermal/gov_user_space.c
··· 26 26 * notify_user_space - Notifies user space about thermal events 27 27 * @tz: thermal_zone_device 28 28 * @trip: trip point 29 + * @crossed_up: whether or not the trip has been crossed on the way up 29 30 * 30 31 * This function notifies the user space through UEvents. 31 32 */ 32 - static int notify_user_space(struct thermal_zone_device *tz, 33 - const struct thermal_trip *trip) 33 + static void notify_user_space(struct thermal_zone_device *tz, 34 + const struct thermal_trip *trip, 35 + bool crossed_up) 34 36 { 35 37 char *thermal_prop[5]; 36 38 int i; ··· 48 46 kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, thermal_prop); 49 47 for (i = 0; i < 4; ++i) 50 48 kfree(thermal_prop[i]); 51 - 52 - return 0; 53 49 } 54 50 55 51 static struct thermal_governor thermal_gov_user_space = { 56 52 .name = "user_space", 57 - .throttle = notify_user_space, 53 + .trip_crossed = notify_user_space, 58 54 .bind_to_tz = user_space_bind, 59 55 }; 60 56 THERMAL_GOVERNOR_DECLARE(thermal_gov_user_space);