Patch "hwmon: (corsair-psu) Fix probe when built-in" has been added to the 6.1-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    hwmon: (corsair-psu) Fix probe when built-in

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hwmon-corsair-psu-fix-probe-when-built-in.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 249ff2a8be9beeb22cebedd33920a96994f2c821
Author: Armin Wolf <W_Armin@xxxxxx>
Date:   Thu Dec 7 22:07:23 2023 +0100

    hwmon: (corsair-psu) Fix probe when built-in
    
    [ Upstream commit 307004e8b254ad28e150b63f299ab9caa4bc7c3e ]
    
    It seems that when the driver is built-in, the HID bus is
    initialized after the driver is loaded, which whould cause
    module_hid_driver() to fail.
    Fix this by registering the driver after the HID bus using
    late_initcall() in accordance with other hwmon HID drivers.
    
    Signed-off-by: Armin Wolf <W_Armin@xxxxxx>
    Link: https://lore.kernel.org/r/20231207210723.222552-1-W_Armin@xxxxxx
    [groeck: Dropped "compile tested" comment; the patch has been tested
     but the tester did not provide a Tested-by: tag]
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
index 2210aa62e3d0..ec7f27a6ce01 100644
--- a/drivers/hwmon/corsair-psu.c
+++ b/drivers/hwmon/corsair-psu.c
@@ -837,7 +837,23 @@ static struct hid_driver corsairpsu_driver = {
 	.reset_resume	= corsairpsu_resume,
 #endif
 };
-module_hid_driver(corsairpsu_driver);
+
+static int __init corsair_init(void)
+{
+	return hid_register_driver(&corsairpsu_driver);
+}
+
+static void __exit corsair_exit(void)
+{
+	hid_unregister_driver(&corsairpsu_driver);
+}
+
+/*
+ * With module_init() the driver would load before the HID bus when
+ * built-in, so use late_initcall() instead.
+ */
+late_initcall(corsair_init);
+module_exit(corsair_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Wilken Gottwalt <wilken.gottwalt@xxxxxxxxxx>");




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux