Re: [PATCH v3] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>");
>> +MODULE_DESCRIPTION("Hwmon driver for Gigabyte AORUS Waterforce AIO coolers");





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux