Messages in this thread | | | Date | Thu, 7 Dec 2023 21:04:06 +0100 | Subject | Re: [PATCH v3] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers | From | Aleksa Savic <> |
| |
On 2023-12-07 20:39:23 GMT+01:00, Armin Wolf wrote: > Am 07.12.23 um 13:23 schrieb Aleksa Savic: >
...
>> + >> +static struct hid_driver waterforce_driver = { >> + .name = "waterforce", >> + .id_table = waterforce_table, >> + .probe = waterforce_probe, >> + .remove = waterforce_remove, >> + .raw_event = waterforce_raw_event, >> +}; >> + >> +static int __init waterforce_init(void) >> +{ >> + return hid_register_driver(&waterforce_driver); >> +} >> + >> +static void __exit waterforce_exit(void) >> +{ >> + hid_unregister_driver(&waterforce_driver); >> +} >> + >> +/* When compiled into the kernel, initialize after the HID bus */ >> +late_initcall(waterforce_init); >> +module_exit(waterforce_exit); > > Hi, > > I think you could use the module_hid_driver() macro here.
As far as I'm aware, hwmon will get built before hid, so a late_initcall() is necessary for this to function when compiled as a built-in driver. Other HID drivers in hwmon also do this (see nzxt-smart2 for an example).
Aleksa
> >> + >> +MODULE_LICENSE("GPL"); >> +MODULE_AUTHOR("Aleksa Savic <savicaleksa83@gmail.com>"); >> +MODULE_DESCRIPTION("Hwmon driver for Gigabyte AORUS Waterforce AIO coolers");
| |