]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: Loongson: Use hwmon_device_register_with_groups() to register hwmon
authorGuenter Roeck <linux@roeck-us.net>
Wed, 11 May 2022 14:56:59 +0000 (07:56 -0700)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Thu, 12 May 2022 15:58:05 +0000 (17:58 +0200)
commitb2e0e01fd22d97a2ef6fc76941196975575401fb
tree35812167f5630d3b3ad513fbfd2d6f068a2754f9
parent703091b34283d2f4160902e8570865b41d46cd1e
MIPS: Loongson: Use hwmon_device_register_with_groups() to register hwmon

Calling hwmon_device_register_with_info() with NULL dev and/or chip
information parameters is an ABI abuse and not a real conversion to
the new API. Also, the code creates sysfs attributes _after_ creating
the hwmon device, which is racy and unsupported to start with. On top
of that, the removal code tries to remove the name attribute which is
owned by the hwmon core.

Use hwmon_device_register_with_groups() to register the hwmon device
instead.

In the future, the hwmon subsystem will reject calls to
hwmon_device_register_with_info with NULL dev or chip/info parameters.
Without this patch, the hwmon device will fail to register.

Fixes: 022193cb5642 ("MIPS: Loongson: Fix boot warning about hwmon_device_register()")
Cc: Zhi Li <lizhi01@loongson.cn>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
drivers/platform/mips/cpu_hwmon.c