History

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.

Armin Wolf committed 2 years ago

Commit 307004e1 parent 35fe2ad1 file · +17 −1Browse files

Unified · Split

drivers/hwmon/corsair-psu.c+17−1
@@ -899,7 +899,23 @@ static struct hid_driver corsairpsu_driver = { · 898 unmodified lines
899 .reset_resume = corsairpsu_resume,899 .reset_resume = corsairpsu_resume,
900#endif900#endif
901};901};
902module_hid_driver(corsairpsu_driver);902
903static int __init corsair_init(void)
904{
905 return hid_register_driver(&corsairpsu_driver);
906}
907
908static void __exit corsair_exit(void)
909{
910 hid_unregister_driver(&corsairpsu_driver);
911}
912
913/*
914 * With module_init() the driver would load before the HID bus when
915 * built-in, so use late_initcall() instead.
916 */
917late_initcall(corsair_init);
918module_exit(corsair_exit);
903 919
904MODULE_LICENSE("GPL");920MODULE_LICENSE("GPL");
905MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@posteo.net>");921MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@posteo.net>");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t