Re: [RFC 0/8] Stop monitoring disabled devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

Andrzej



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux