[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f6522abb-885d-4476-bf27-5ee8b48138bd@gmail.com>
Date: Thu, 7 Dec 2023 21:04:06 +0100
From: Aleksa Savic <savicaleksa83@...il.com>
To: Armin Wolf <W_Armin@....de>, linux-hwmon@...r.kernel.org
Cc: savicaleksa83@...il.com, Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] hwmon: Add driver for Gigabyte AORUS Waterforce AIO
coolers
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@...il.com>");
>> +MODULE_DESCRIPTION("Hwmon driver for Gigabyte AORUS Waterforce AIO coolers");
Powered by blists - more mailing lists