Commit 307004e8 authored by Armin Wolf's avatar Armin Wolf Committed by Guenter Roeck

hwmon: (corsair-psu) Fix probe when built-in

It seems that when the driver is built-in, the HID bus is
initialized after the driver is loaded, which whould cause
module_hid_driver() to fail.
Fix this by registering the driver after the HID bus using
late_initcall() in accordance with other hwmon HID drivers.
Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231207210723.222552-1-W_Armin@gmx.de
[groeck: Dropped "compile tested" comment; the patch has been tested
 but the tester did not provide a Tested-by: tag]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 35fe2ad2
...@@ -899,7 +899,23 @@ static struct hid_driver corsairpsu_driver = { ...@@ -899,7 +899,23 @@ static struct hid_driver corsairpsu_driver = {
.reset_resume = corsairpsu_resume, .reset_resume = corsairpsu_resume,
#endif #endif
}; };
module_hid_driver(corsairpsu_driver);
static int __init corsair_init(void)
{
return hid_register_driver(&corsairpsu_driver);
}
static void __exit corsair_exit(void)
{
hid_unregister_driver(&corsairpsu_driver);
}
/*
* With module_init() the driver would load before the HID bus when
* built-in, so use late_initcall() instead.
*/
late_initcall(corsair_init);
module_exit(corsair_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@posteo.net>"); MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@posteo.net>");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment