]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:26:12 +0000 (10:26 +0200)
commitaffa0002e1cea342c8aa79eff7707ec181a2f123
tree8cd39a3bff46effeabb0eafb2a28af40b1daaaed
parente3cbbdbff8a4db5d053c53fd71be62ccccdb52b0
MIPS: Loongson: Use hwmon_device_register_with_groups() to register hwmon

[ Upstream commit abae018a03821be2b65c01ebe2bef06fd7d85a4c ]

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: f59dc5119192 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/mips/cpu_hwmon.c