[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b2b3f17d-0f86-4d40-a471-f44153efd6fe@roeck-us.net>
Date: Fri, 8 Dec 2023 07:43:07 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Wilken Gottwalt <wilken.gottwalt@...teo.net>,
Aleksa Savic <savicaleksa83@...il.com>
Cc: linux-hwmon@...r.kernel.org, Jean Delvare <jdelvare@...e.com>,
linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>
Subject: Re: [PATCH] hwmon: (corsair-psu) Fix failure to load when built-in to
kernel
On 12/8/23 05:57, Wilken Gottwalt wrote:
> On Fri, 8 Dec 2023 14:11:44 +0100
> Aleksa Savic <savicaleksa83@...il.com> wrote:
>
>> On 2023-12-08 14:07:10 GMT+01:00, Aleksa Savic wrote:
>>> When built-in to the kernel, the corsair-psu driver fails to register with
>>> the following message:
>>>
>>> "Driver 'corsair-psu' was unable to register with bus_type 'hid'
>>> because the bus was not initialized."
>>>
>>> Fix this by initializing the driver after the HID bus using
>>> late_initcall(), as hwmon is built before HID.
>>>
>>> Fixes: d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver")
>>> Signed-off-by: Aleksa Savic <savicaleksa83@...il.com>
>>> ---
>>> drivers/hwmon/corsair-psu.c | 15 ++++++++++++++-
>>> 1 file changed, 14 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
>>> index 904890598c11..48831a528965 100644
>>> --- a/drivers/hwmon/corsair-psu.c
>>> +++ b/drivers/hwmon/corsair-psu.c
>>> @@ -899,7 +899,20 @@ static struct hid_driver corsairpsu_driver = {
>>> .reset_resume = corsairpsu_resume,
>>> #endif
>>> };
>>> -module_hid_driver(corsairpsu_driver);
>>> +
>>> +static int __init corsairpsu_hid_init(void)
>>> +{
>>> + return hid_register_driver(&corsairpsu_driver);
>>> +}
>>> +
>>> +static void __exit corsairpsu_hid_exit(void)
>>> +{
>>> + hid_unregister_driver(&corsairpsu_driver);
>>> +}
>>> +
>>> +/* When compiled into the kernel, initialize after the hid bus */
>>> +late_initcall(corsairpsu_hid_init);
>>> +module_exit(corsairpsu_hid_exit);
>>>
>>> MODULE_LICENSE("GPL");
>>> MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@...teo.net>");
>>
>>
>> Woops! Just saw that the same fix was sent yesterday. Please disregard, sorry!
>>
>> Aleksa
>
> It is fine. I just start to wonder if there was a change in the subsystem. I
> used the driver as built-in in the past for several months and never had that
> issue. And now it is a real flood of reports.
>
Maybe there was a change in the build order, or some subtle change
in driver registration code. Question though is _when_ this changed.
It would be great if someone could bisect it. For example, bus registration
code has been changed significantly in v6.3. I am copying linux-input
and the hid maintainers for feedback.
Either case, I now have two patches and at least the first one was actually
tested, but no Reviewed-by: or Tested-by: for either of them. While that is
of course a formality, it would still be useful to show that it is not just
a random change.
Thanks,
Guenter
Powered by blists - more mailing lists