Re: [PATCH v3] hwmon: (acpi_power_meter) Replace the deprecated hwmon_device_register
From: Guenter Roeck
Date: Wed Mar 19 2025 - 18:45:19 EST
On Wed, Mar 19, 2025 at 10:06:38AM +0800, 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.
>
> These attributes, 'power_accuracy', 'power_cap_hyst', 'power_average_min'
> and 'power_average_max', should have been placed in hwmon_chip_info as
> power data type. But these attributes are displayed as string format on
> the following case:
> 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.
> To avoid any changes in the display of these sysfs interfaces, we can't
> modifiy the type of these attributes in hwmon core and have to put them
> to extra_groups.
>
> Please note that the path of these sysfs interfaces are modified
> accordingly if use hwmon_device_register_with_info():
> old: all sysfs interfaces are under acpi device, namely,
> /sys/class/hwmon/hwmonX/device/
> now: all sysfs interfaces are under hwmon device, namely,
> /sys/class/hwmon/hwmonX/
> The new ABI does not guarantee that the underlying path remains the same.
> But we have to accept this change so as to replace the deprecated API.
> Fortunately, some userspace application, like libsensors, would scan
> the two path and handles this automatically. So we can accept this change
> so as to drop the deprecated message.
>
> Signed-off-by: Huisong Li <lihuisong@xxxxxxxxxx>
Applied.
Thanks,
Guenter