Re: [PATCH] MIPS: Loongson: Use hwmon_device_register_with_groups() to register hwmon

From: Thomas Bogendoerfer
Date: Thu May 12 2022 - 12:12:04 EST


On Wed, May 11, 2022 at 07:56:59AM -0700, Guenter Roeck wrote:
> 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@xxxxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> ---
> drivers/platform/mips/cpu_hwmon.c | 127 ++++++++++--------------------
> 1 file changed, 41 insertions(+), 86 deletions(-)

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]