]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: Add label support for 64-bit energy attributes
authorRong Zhang <i@rong.moe>
Thu, 26 Mar 2026 19:19:50 +0000 (03:19 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 31 Mar 2026 02:45:06 +0000 (19:45 -0700)
Since commit 0bcd01f757bc ("hwmon: Introduce 64-bit energy attribute
support"), devices can report 64-bit energy values by selecting the
sensor type "energy64". However, such sensors can't report their labels
since is_string_attr() was not updated to match it.

Add label support for 64-bit energy attributes by updating
is_string_attr() to match hwmon_energy64 in addition to hwmon_energy.

Signed-off-by: Rong Zhang <i@rong.moe>
Link: https://lore.kernel.org/r/20260327-b4-hwmon-witrn-v1-1-8d2f1896c045@rong.moe
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/hwmon.c

index 9695dca62a7e4d2372402f076637cf0ecc1ec3f5..6812d1fd7c283a3282d16b5169b7a6aadbf3b4bc 100644 (file)
@@ -505,6 +505,7 @@ static bool is_string_attr(enum hwmon_sensor_types type, u32 attr)
               (type == hwmon_curr && attr == hwmon_curr_label) ||
               (type == hwmon_power && attr == hwmon_power_label) ||
               (type == hwmon_energy && attr == hwmon_energy_label) ||
+              (type == hwmon_energy64 && attr == hwmon_energy_label) ||
               (type == hwmon_humidity && attr == hwmon_humidity_label) ||
               (type == hwmon_fan && attr == hwmon_fan_label);
 }