lkml.org 
[lkml]   [2023]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] checkpatch: Add old hwmon APIs to deprecated list
From
Date
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

\
 
 \ /
  Last update: 2023-07-03 00:43    [W:0.074 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site