From: Joe Perches <joe@perches.com>
To: Guenter Roeck <linux@roeck-us.net>,
Andrew Morton <akpm@linux-foundation.org>,
cocci <cocci@systeme.lip6.fr>
Cc: Andy Whitcroft <apw@canonical.com>,
Dwaipayan Ray <dwaipayanray1@gmail.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: Add old hwmon APIs to deprecated list
Date: Sun, 02 Jul 2023 15:42:49 -0700 [thread overview]
Message-ID: <676aae2eb65d228796d6f18e86d261ed96540a87.camel@perches.com> (raw)
In-Reply-To: <20230702211450.3789779-1-linux@roeck-us.net>
On Sun, 2023-07-02 at 14:14 -0700, Guenter Roeck wrote:
> hwmon_device_register() and [devm_]hwmon_device_register_with_groups()
> have been deprecated. All hardware monitoring drivers should use
> [devm_]hwmon_device_register_with_info() instead.
>
> The problem with the old API functions is that they require sysfs attribute
> handling in driver code. The new API handles sysfs attributes in the
> hwmon core. Using the new API typically reduces driver code size by 20-40%.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Seems sensible, thanks.
But how big an effort is it to convert all the existing uses
and remove the code? There are less than 200 uses.
Perhaps it's not that onerous.
Is it something that coccinelle could do reasonably well?
$ git grep -w hwmon_device_register | wc -l
49
$ git grep -w hwmon_device_register_with_groups | wc -l
22
$ git grep -w devm_hwmon_device_register_with_groups | wc -l
108
> ---..
> scripts/checkpatch.pl | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 7bfa4d39d17f..6d97f1a6028e 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -842,6 +842,9 @@ our %deprecated_apis = (
> "kunmap" => "kunmap_local",
> "kmap_atomic" => "kmap_local_page",
> "kunmap_atomic" => "kunmap_local",
> + "hwmon_device_register" => "hwmon_device_register_with_info",
> + "hwmon_device_register_with_groups" => "hwmon_device_register_with_info",
> + "devm_hwmon_device_register_with_groups"=> "devm_hwmon_device_register_with_info",
> );
>
> #Create a search pattern for all these strings to speed up a loop below
next prev parent reply other threads:[~2023-07-02 22:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-02 21:14 Guenter Roeck
2023-07-02 22:42 ` Joe Perches [this message]
2023-07-02 23:38 ` Guenter Roeck
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=676aae2eb65d228796d6f18e86d261ed96540a87.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=cocci@systeme.lip6.fr \
--cc=dwaipayanray1@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lukas.bulwahn@gmail.com \
/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
all inboxes | Powered by JetHome®