]> git.ipfire.org Git - thirdparty/linux.git/commit
thermal: sysfs: Get to trips via attribute pointers
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 29 Jul 2024 16:25:59 +0000 (18:25 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 13 Aug 2024 18:53:18 +0000 (20:53 +0200)
commitafd84fb10ced3caf53769ba734ea237bde0f69e3
treecb33258a1904234c368665c9febcd5faf8c0e4c4
parent66b263306a86c0f2d3cdb44e3722db6cff3a32b3
thermal: sysfs: Get to trips via attribute pointers

The  _store() and _show() functions for sysfs attributes corresponding
to trip point parameters (type, temperature and hysteresis) read the
trip ID from the attribute name and then use the trip ID as the index
in the given thermal zone's trips table to get to the trip object they
want.

Instead of doing this, make them use the attribute pointer they get
as the second argument to get to the trip object embedded in the same
struct thermal_trip_desc as the struct device_attribute pointed to by
it, which is much more straightforward and less overhead.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/114841552.nniJfEyVGO@rjwysocki.net
drivers/thermal/thermal_sysfs.c