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.
Unified · Split
| @@ -899,7 +899,23 @@ static struct hid_driver corsairpsu_driver = { · 898 unmodified lines | |||
| 899 | .reset_resume = corsairpsu_resume, | 899 | .reset_resume = corsairpsu_resume, |
| 900 | #endif | 900 | #endif |
| 901 | }; | 901 | }; |
| 902 | module_hid_driver(corsairpsu_driver); | 902 | |
| 903 | static int __init corsair_init(void) | ||
| 904 | { | ||
| 905 | return hid_register_driver(&corsairpsu_driver); | ||
| 906 | } | ||
| 907 | |||
| 908 | static 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 | */ | ||
| 917 | late_initcall(corsair_init); | ||
| 918 | module_exit(corsair_exit); | ||
| 903 | 919 | ||
| 904 | MODULE_LICENSE("GPL"); | 920 | MODULE_LICENSE("GPL"); |
| 905 | MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@posteo.net>"); | 921 | MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@posteo.net>"); |