Re: [PATCH v3 2/2] hwmon: (asus_wmi_sensors) Support X370 Asus WMI.

From: Guenter Roeck
Date: Sun Oct 10 2021 - 09:39:06 EST


On 10/10/21 3:20 AM, Thomas Weißschuh wrote:
Hi,

for WMI drivers the list platform-driver-x86@xxxxxxxxxxxxxxx should probably be
on CC too.
Also all other WMI drivers, even for hwmon stuff are located in
drivers/platform/x86 so it may be better to put it there, too.


Not really. If any of those other drivers are pure hwmon drivers, they
should reside in drivers/hwmon instead. And, yes, that really includes
the gigabyte-wmi driver. We don't have arbitrary drivers in drivers/pci
either just because they are drivers for pci devices.

Guenter

One comment inline.

On 2021-10-10T12:52+0300, Denis Pauk wrote:
+static struct platform_driver asus_wmi_sensors_platform_driver = {
+ .driver = {
+ .name = "asus-wmi-sensors",
+ },
+ .probe = asus_wmi_probe,
+};
+
+static struct platform_device *sensors_pdev;
+
+static int __init asus_wmi_init(void)
+{
+ if (!dmi_check_system(asus_wmi_dmi_table))
+ return -ENODEV;
+
+ sensors_pdev = platform_create_bundle(&asus_wmi_sensors_platform_driver,
+ asus_wmi_probe,
+ NULL, 0,
+ NULL, 0);
+
+ return PTR_ERR_OR_ZERO(sensors_pdev);
+}
+module_init(asus_wmi_init);
+
+static void __exit asus_wmi_exit(void)
+{
+ platform_device_unregister(sensors_pdev);
+ platform_driver_unregister(&asus_wmi_sensors_platform_driver);
+}
+module_exit(asus_wmi_exit);

This should bind to the WMI bus instead of being a platform device.
See drivers/platform/x86/gigabyte-wmi.c

(Some goes also for the other driver)

Thomas