From: Armin Wolf <W_Armin@gmx.de>
To: Guenter Roeck <linux@roeck-us.net>, LABBE Corentin <clabbe@baylibre.com>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: acpi_power_meter: convert to hwmon_device_register_with_info
Date: Mon, 2 May 2022 23:00:12 +0200 [thread overview]
Message-ID: <72cce35f-a227-cd18-17f0-00eee350bcf4@gmx.de> (raw)
In-Reply-To: <dabc2be2-36ce-a9d4-8aa5-ae3f2a57f904@roeck-us.net>
Am 02.05.22 um 22:42 schrieb Guenter Roeck:
> On 5/2/22 13:31, Armin Wolf wrote:
>> Am 02.05.22 um 20:59 schrieb LABBE Corentin:
>>
>>> Le Mon, May 02, 2022 at 06:34:44AM -0700, Guenter Roeck a écrit :
>>>> On 5/2/22 05:42, Corentin Labbe wrote:
>>>>> Booting lead to a hwmon_device_register() is deprecated. Please
>>>>> convert the driver to use hwmon_device_register_with_info().
>>>>> So let's convert the driver to use hwmon_device_register_with_info().
>>>>>
>>>>> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
>>>>> ---
>>>>> drivers/hwmon/acpi_power_meter.c | 5 ++++-
>>>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/hwmon/acpi_power_meter.c
>>>>> b/drivers/hwmon/acpi_power_meter.c
>>>>> index d2545a1be9fc..98293727f980 100644
>>>>> --- a/drivers/hwmon/acpi_power_meter.c
>>>>> +++ b/drivers/hwmon/acpi_power_meter.c
>>>>> @@ -891,7 +891,10 @@ 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_DEVICE_NAME,
>>>>> + NULL, NULL,
>>>>> + NULL);
>>>> NACK. That isn't a conversion to the new API, it just abuses the fact
>>>> that the new API has to accept a NULL info pointer for historic
>>>> reasons.
>>>>
>>> Hello
>>>
>>> I am sorry, I found a driver doing it, so I believed it was okay.
>>> Converting seems not to hard but, by using the new API, how can I
>>> convert power1_model_number/power1_is_battery attribute ?
>>> There are the remaining attributes I dont find how to convert.
>>>
>>> Regards
>>
>> Hi,
>>
>> for allowing the driver to provide nonstandard attributes,
>> hwmon_device_register_with_info()
>> has the argument "extra_groups" which is an pointer to a list of
>> sysfs attribute groups.
>> There are some drivers which are using this functionality, maybe you
>> can use them as an
>> inspiration.
>>
>> Just a question: what is the name of the driver you originally used
>> as an inspiration?
>>
>
> Originally it was for drivers/thermal/thermal_hwmon.c. Now there is also
> drivers/platform/mips/cpu_hwmon.c which is clearly an abuse. I may have
> missed others.
>
> Guenter
Should we notify the maintainers of cpu_hwmon.c about that?
This could potentially prevent such incidents from happening again.
Armin Wolf
next prev parent reply other threads:[~2022-05-02 21:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 12:42 [PATCH 1/2] hwmon: acpi_power_meter: fix style issue Corentin Labbe
2022-05-02 12:42 ` [PATCH 2/2] hwmon: acpi_power_meter: convert to hwmon_device_register_with_info Corentin Labbe
2022-05-02 13:34 ` Guenter Roeck
2022-05-02 18:59 ` LABBE Corentin
2022-05-02 20:24 ` Guenter Roeck
2022-05-02 20:31 ` Armin Wolf
2022-05-02 20:42 ` Guenter Roeck
2022-05-02 21:00 ` Armin Wolf [this message]
2022-05-02 23:43 ` Guenter Roeck
2022-05-04 7:05 ` Armin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=72cce35f-a227-cd18-17f0-00eee350bcf4@gmx.de \
--to=w_armin@gmx.de \
--cc=clabbe@baylibre.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox