]> git.ipfire.org Git - thirdparty/linux.git/commit
thermal: hwmon: Use extra_groups for adding temperature attributes
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 5 May 2026 11:47:01 +0000 (13:47 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 13 May 2026 19:04:00 +0000 (21:04 +0200)
commitcfb5dc0f60fbe95a10cb307cc6dae5c47f160abb
treeec032c3ea13db9633f7f69fea4928bb9a496201c
parentd6323469bcfbda91f0aa89b7b39ad45fe822ca5d
thermal: hwmon: Use extra_groups for adding temperature attributes

Instead of passing NULL as the last argument to __hwmon_device_register()
in hwmon_device_register_for_thermal() and then adding each temperature
sysfs attribute to the hwmon device via device_create_file(), redefine
hwmon_device_register_for_thermal() to take an extra_groups argument
that will be passed to __hwmon_device_register(), define an attribute
group with a proper .is_visible() callback for the temperature
attributes and a related attribute groups pointer, and pass the latter
to hwmon_device_register_for_thermal().

This causes the code to be way more straightforward and closer to
what the other users of the hwmon subsystem do.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/8704209.T7Z3S40VBb@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/hwmon/hwmon.c
drivers/thermal/thermal_hwmon.c
include/linux/hwmon.h