Re: [RFC] hwmon: (acpi_power_meter) Replace hwmon_device_register

From: Guenter Roeck
Date: Tue Feb 25 2025 - 08:03:29 EST


On 2/25/25 00:51, Huisong Li wrote:
When load this mode, we can see the following log:
"power_meter ACPI000D:00: hwmon_device_register() is deprecated. Please
convert the driver to use hwmon_device_register_with_info()."

So replace hwmon_device_register with hwmon_device_register_with_info.

To avoid any changes in the display of some sysfs interfaces, some of
necessary changes in hwmon.c must be made:
1> For 'power1_average_interval_max/min' interface, insert 'average' to the
string corresponding to hwmon_power_average_interval_max/max in
hwmon_power_attr_templates[]. I guess that is what's missing.
2> Add some string attributes in power sensor type because of below items:
a) power1_accuracy --> display like '90.0%'
b) power1_cap_hyst --> display 'unknown' when its value is 0xFFFFFFFF
c) power1_average_min/max --> display 'unknown' when its value is
negative.
Note: All the attributes modified above in hwmon core are not used by other
drivers.


That is not a reason to change the ABI, much less so hiding the change
in a driver patch.

Guenter