lkml.org 
[lkml]   [2023]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers
From
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");

\
 
 \ /
  Last update: 2023-12-07 21:06    [W:0.717 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site