HID: Make lowlevel driver structs const
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 22 Dec 2022 05:10:51 +0000 (05:10 +0000)
committerJiri Kosina <jkosina@suse.cz>
Tue, 17 Jan 2023 12:44:02 +0000 (13:44 +0100)
Nothing is nor should be modifying these structs so mark them as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: David Rheinsberg <david.rheinsberg@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/i2c-hid/i2c-hid-core.c
drivers/hid/uhid.c
drivers/hid/usbhid/hid-core.c
include/linux/hid.h
net/bluetooth/hidp/core.c

index fc5a0dd4eb926250162ae9f886aebcb6c21e1420..af98ac31c8d42f89f06ddc8f4d6c8b12af3f2fd1 100644 (file)
@@ -842,7 +842,7 @@ static void i2c_hid_close(struct hid_device *hid)
        clear_bit(I2C_HID_STARTED, &ihid->flags);
 }
 
-static struct hid_ll_driver i2c_hid_ll_driver = {
+static const struct hid_ll_driver i2c_hid_ll_driver = {
        .parse = i2c_hid_parse,
        .start = i2c_hid_start,
        .stop = i2c_hid_stop,
index 6cec0614fc98c001021b5706df819ab3b999ab0f..f161c95a1ad2e9bc65316a06898eafc27ec18a5e 100644 (file)
@@ -387,7 +387,7 @@ static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf,
        return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT);
 }
 
-static struct hid_ll_driver uhid_hid_driver = {
+static const struct hid_ll_driver uhid_hid_driver = {
        .start = uhid_hid_start,
        .stop = uhid_hid_stop,
        .open = uhid_hid_open,
index 4143bab3380a0016a376096fd901d5b06352be72..257dd73e37bf5756d18e05ad46c9476c2baa1554 100644 (file)
@@ -1318,7 +1318,7 @@ static bool usbhid_may_wakeup(struct hid_device *hid)
        return device_may_wakeup(&dev->dev);
 }
 
-static struct hid_ll_driver usb_hid_driver = {
+static const struct hid_ll_driver usb_hid_driver = {
        .parse = usbhid_parse,
        .start = usbhid_start,
        .stop = usbhid_stop,
index 620ae99fb16661742022abdfcda7226b795cc7ef..3922b66c6da8667d5f81a85aa8551516fd744dee 100644 (file)
@@ -596,7 +596,7 @@ struct hid_device {                                                 /* device report descriptor */
        struct device dev;                                              /* device */
        struct hid_driver *driver;
 
-       struct hid_ll_driver *ll_driver;
+       const struct hid_ll_driver *ll_driver;
        struct mutex ll_open_lock;
        unsigned int ll_open_count;
 
index c4a741f6ed5c52b51fa7355090946b385a7b7aa8..bed1a7b9205c20cceacd45a529b50f9b378dff9c 100644 (file)
@@ -739,7 +739,7 @@ static void hidp_stop(struct hid_device *hid)
        hid->claimed = 0;
 }
 
-static struct hid_ll_driver hidp_hid_driver = {
+static const struct hid_ll_driver hidp_hid_driver = {
        .parse = hidp_parse,
        .start = hidp_start,
        .stop = hidp_stop,