On 4/9/20 1:10 PM, Andrzej Pietrasiewicz wrote: > Hi Daniel, > > W dniu 09.04.2020 o 12:29, Daniel Lezcano pisze: >> On 07/04/2020 19:49, Andrzej Pietrasiewicz wrote: >>> The current kernel behavior is to keep polling the thermal zone devices >>> regardless of their current mode. This is not desired, as all such "disabled" >>> devices are meant to be handled by userspace,> so polling them makes no sense. >> >> Thanks for proposing these changes. >> >> I've been (quickly) through the series and the description below. I have >> the feeling the series makes more complex while the current code which >> would deserve a cleanup. >> >> Why not first: >> >> - Add a 'mode' field in the thermal zone device >> - Kill all set/get_mode callbacks in the drivers which are duplicated code. >> - Add a function: >> >> enum thermal_device_mode thermal_zone_get_mode( *tz) >> { >> ... >> if (tz->ops->get_mode) >> return tz->ops->get_mode(); >> >> return tz->mode; >> } >> >> >> int thermal_zone_set_mode(..*tz, enum thermal_device_mode mode) >> { >> ... >> if (tz->ops->set_mode) >> return tz->ops->set_mode(tz, mode); >> >> tz->mode = mode; >> >> return 0; >> } >> >> static inline thermal_zone_enable(... *tz) >> { >> thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); >> } >> >> static inline thermal_zone_disable(... *tz) { >> thermal_zone_set_mode(tz, THERMAL_DEVICE_DISABLED); >> } >> >> And then when the code is consolidated, use the mode to enable/disable >> the polling and continue killing the duplicated code in of-thermal.c and >> anywhere else. >> >> > > Thanks for feedback. > > Anyone else? Yes. :) Please take a look at the following patchset (which I'm reviving currently): https://lkml.org/lkml/2018/10/17/926 It overlaps partially with your work so we need to coordinate our efforts. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics