Re: [RFC PATCH] hwmon: (acpi_power_meter): Convert to hwmon_device_register_with_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/11/22 00:54, Zhang Rui wrote:
The acpi_power_meter driver doesn't create any standard hwmon sysfs
attributes under its hwmon device node, but instead, the driver has its
own code to create the hwmon style sysfs attributes in the ACPI device
node of the ACPI Power Meter device.
I'm not clear why it was designed in that way.

In order to elimite
[   79.960333] power_meter ACPI000D:00: hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
convert the driver to use the new API, no chip_info or sysfs_groups
parameter needed.

The only difference brought by this patch is that the "name" attribute
will be created under the hwmon device node. Not sure if this matters or
not.

Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>

No, this is not a conversion and not acceptable. Corentin Labbe is
working on the real thing. See
https://patchwork.kernel.org/project/linux-hwmon/patch/20220509063010.3878134-3-clabbe@xxxxxxxxxxxx/

Guenter

---
  drivers/hwmon/acpi_power_meter.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index c405a5869581..81a982dda5af 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -890,7 +890,8 @@ static int acpi_power_meter_add(struct acpi_device *device)
  	if (res)
  		goto exit_free_capability;
- resource->hwmon_dev = hwmon_device_register(&device->dev);
+	resource->hwmon_dev = hwmon_device_register_with_info(&device->dev,
+				ACPI_POWER_METER_NAME, NULL, NULL, NULL);
  	if (IS_ERR(resource->hwmon_dev)) {
  		res = PTR_ERR(resource->hwmon_dev);
  		goto exit_remove;




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux