hwmon: applesmc: fix deprecated hwmon_device_register call
Subsystems (2)
PATCH 1/1 hwmon: applesmc: fix deprecated hwmon_device_register call
Hello.
This is my first patch attempt on drivers so I might be completely wrong.
applesmc driver was using the deprecated hwmon_device_register call for some reason. And that causes a deprecation warning in dmesg.
I've replaced the call with hwmon_device_register_with_info and booted my MBP 11,2 with it.
The warning is no longer shown. And the functionality doesn't seem to be broken.
Thank you for reading this.
--- drivers/hwmon/applesmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/applesmc.c +5 -1
@@ -1326,7 +1326,11 @@ static int __init applesmc_init(void)if (ret) goto out_light_sysfs; - hwmon_dev =hwmon_device_register (&pdev->dev); + hwmon_dev =hwmon_device_register_with_info (&pdev->dev, +"applesmcbacklight" , +NULL , +NULL , +NULL );if (IS_ERR (hwmon_dev)) { ret =PTR_ERR (hwmon_dev); goto out_light_ledclass;
Signature · 1 line
2.13.2
Guenter Roeck
maintainerQuoted 7 lines · Cengiz Can
Hello.
This is my first patch attempt on drivers so I might be completely wrong.
applesmc driver was using the deprecated
hwmon_device_registercall for some reason. And that causes a deprecation warning in dmesg.
Quoted 8 lines
I've replaced the call with
hwmon_device_register_with_infoand booted my MBP 11,2 with it.The warning is no longer shown. And the functionality doesn't seem to be broken.
Thank you for reading this.
Do you really want all of the above in the change log ?
Quoted 10 lines
Signed-off-by Cengiz Can <[email protected]>--- drivers/hwmon/applesmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/hwmon/applesmc.c +0
-0
drivers/hwmon/applesmc.c static int __init applesmc_init(void) · line 1333
Quoted 9 lines
drivers/hwmon/applesmc.c +5
-1@@ -1326,7 +1326,11 @@ static int __init applesmc_init(void)if (ret) goto out_light_sysfs; - hwmon_dev =hwmon_device_register (&pdev->dev); + hwmon_dev =hwmon_device_register_with_info (&pdev->dev, +"applesmcbacklight" , +NULL , +NULL , +NULL );
I am not in favor of changes like this. It doesn't solve the problem with the old API, which is that it maintains sysfs nodes locally. Besides, this patch changes the name from "applesmc" to "applesmcbacklight", it creates a name attribute in the hwmon device directory while keeping the actual hwmon attributes in the platform device directory, and the driver has another name attribute in the platform device directory.
Given that, sorry, I can not accept this patch.
Guenter