From 46cb3cf8989ef5cc4f02eefee826b3d4385626f5 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Wed, 9 Aug 2017 23:51:34 +0530 Subject: [PATCH 1/3] HID: usbkbd: constify usb_device_id and fix space before '[' error. usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '['. Signed-off-by: Arvind Yadav Signed-off-by: Jiri Kosina --- drivers/hid/usbhid/usbkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 7fb2d1e4f5dd..ed01dc425d29 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c @@ -392,7 +392,7 @@ static void usb_kbd_disconnect(struct usb_interface *intf) } } -static struct usb_device_id usb_kbd_id_table [] = { +static const struct usb_device_id usb_kbd_id_table[] = { { USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT, USB_INTERFACE_PROTOCOL_KEYBOARD) }, { } /* Terminating entry */ From 81b7ec4e621f1e16dcb688cda819828f49c375b2 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Wed, 9 Aug 2017 23:51:35 +0530 Subject: [PATCH 2/3] HID: usbmouse: constify usb_device_id and fix space before '[' error usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by work with const usb_device_id. So mark the non-const structs as const. Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '['. Signed-off-by: Arvind Yadav Signed-off-by: Jiri Kosina --- drivers/hid/usbhid/usbmouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index dd911c5241d8..589ad7c15a58 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c @@ -226,7 +226,7 @@ static void usb_mouse_disconnect(struct usb_interface *intf) } } -static struct usb_device_id usb_mouse_id_table [] = { +static const struct usb_device_id usb_mouse_id_table[] = { { USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT, USB_INTERFACE_PROTOCOL_MOUSE) }, { } /* Terminating entry */ From 0acb310c3273d55ad19c9a5f48b73224ce6e2dc0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 15 Aug 2017 10:09:53 +0200 Subject: [PATCH 3/3] HID: prodikeys: constify snd_rawmidi_ops structures This snd_rawmidi_ops structure is only passed as the third argument of snd_rawmidi_set_ops. This argument is const, so the snd_rawmidi_ops structure can be const too. Done with the help of Coccinelle. Signed-off-by: Julia Lawall Signed-off-by: Jiri Kosina --- drivers/hid/hid-prodikeys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c index f095bf8a3aa9..49c4bd34b3c5 100644 --- a/drivers/hid/hid-prodikeys.c +++ b/drivers/hid/hid-prodikeys.c @@ -593,7 +593,7 @@ static void pcmidi_in_trigger(struct snd_rawmidi_substream *substream, int up) pm->in_triggered = up; } -static struct snd_rawmidi_ops pcmidi_in_ops = { +static const struct snd_rawmidi_ops pcmidi_in_ops = { .open = pcmidi_in_open, .close = pcmidi_in_close, .trigger = pcmidi_in_trigger