Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] hwmon: (acpi_power_meter) Convert to use hwmon_device_register_with_info() API
@ 2020-06-25  7:31 Misono Tomohiro
  2020-06-25 13:45 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Misono Tomohiro @ 2020-06-25  7:31 UTC (permalink / raw)
  To: linux, linux-hwmon; +Cc: misono.tomohiro

Since hwmon_device_register() has been deprecated and gives warning in
dmesg, just convert it to hwmon_device_register_with_info() with name
strings.

Only difference is that now name sysfs file is created under top hwmon
directory. i.e.:
 $ cat /sys/class/hwmon/hwmonX/name
 $ power_meter

Other than that, nothing has changed.

Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
---
 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 a270b975e90b..d93a5423d7ae 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -885,7 +885,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;
-- 
2.21.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: (acpi_power_meter) Convert to use hwmon_device_register_with_info() API
  2020-06-25  7:31 [PATCH] hwmon: (acpi_power_meter) Convert to use hwmon_device_register_with_info() API Misono Tomohiro
@ 2020-06-25 13:45 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-06-25 13:45 UTC (permalink / raw)
  To: Misono Tomohiro, linux-hwmon

On 6/25/20 12:31 AM, Misono Tomohiro wrote:
> Since hwmon_device_register() has been deprecated and gives warning in
> dmesg, just convert it to hwmon_device_register_with_info() with name
> strings.
> 
> Only difference is that now name sysfs file is created under top hwmon
> directory. i.e.:
>  $ cat /sys/class/hwmon/hwmonX/name
>  $ power_meter
> 
> Other than that, nothing has changed.
> 
> Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
> ---
>  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 a270b975e90b..d93a5423d7ae 100644
> --- a/drivers/hwmon/acpi_power_meter.c
> +++ b/drivers/hwmon/acpi_power_meter.c
> @@ -885,7 +885,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;
> 

NACK

This is not acceptable and an API abuse. I'll have to make the API more restrictive
to avoid such abuse.

Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25  7:31 [PATCH] hwmon: (acpi_power_meter) Convert to use hwmon_device_register_with_info() API Misono Tomohiro
2020-06-25 13:45 ` Guenter Roeck

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org
	public-inbox-index linux-hwmon

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git