Patch "HID: core: store the unique system identifier in hid_device" has been added to the 5.15-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

    HID: core: store the unique system identifier in hid_device

to the 5.15-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:
     hid-core-store-the-unique-system-identifier-in-hid_d.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 9fc8f1117cb811b82494e066c45dfb9c212f6e6a
Author: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>
Date:   Fri Sep 2 15:29:23 2022 +0200

    HID: core: store the unique system identifier in hid_device
    
    [ Upstream commit 1e839143d674603b0bbbc4c513bca35404967dbc ]
    
    This unique identifier is currently used only for ensuring uniqueness in
    sysfs. However, this could be handful for userspace to refer to a specific
    hid_device by this id.
    
    2 use cases are in my mind: LEDs (and their naming convention), and
    HID-BPF.
    
    Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220902132938.2409206-9-benjamin.tissoires@xxxxxxxxxx
    Stable-dep-of: fc43e9c857b7 ("HID: fix HID device resource race between HID core and debugging support")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d941023c56289..35046adf1294e 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2442,10 +2442,12 @@ int hid_add_device(struct hid_device *hdev)
 			hid_warn(hdev, "bad device descriptor (%d)\n", ret);
 	}
 
+	hdev->id = atomic_inc_return(&id);
+
 	/* XXX hack, any other cleaner solution after the driver core
 	 * is converted to allow more than 20 bytes as the device name? */
 	dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
-		     hdev->vendor, hdev->product, atomic_inc_return(&id));
+		     hdev->vendor, hdev->product, hdev->id);
 
 	hid_debug_register(hdev, dev_name(&hdev->dev));
 	ret = device_add(&hdev->dev);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index c3478e396829e..4fa40d2e821f2 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -630,6 +630,8 @@ struct hid_device {							/* device report descriptor */
 	struct list_head debug_list;
 	spinlock_t  debug_list_lock;
 	wait_queue_head_t debug_wait;
+
+	unsigned int id;						/* system unique id */
 };
 
 #define to_hid_device(pdev) \



[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