[PATCH 1/4] hwmon: Add label support for 64-bit energy attributes

Rong Zhang posted 4 patches 6 days, 23 hours ago
[PATCH 1/4] hwmon: Add label support for 64-bit energy attributes
Posted by Rong Zhang 6 days, 23 hours ago
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>
---
 drivers/hwmon/hwmon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 9695dca62a7e..6812d1fd7c28 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -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);
 }

-- 
2.53.0
Re: [PATCH 1/4] hwmon: Add label support for 64-bit energy attributes
Posted by Guenter Roeck 6 days, 19 hours ago
On Fri, Mar 27, 2026 at 03:19:50AM +0800, Rong Zhang wrote:
> 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>

Applied.

Thanks,
Guenter