Skip to contentSkip to conversation

constify input usb_device_id.

PATCH In review Arvind Yadav 2 participants 10 messages Aug 6, 2017 – Aug 8, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover constify input usb_device_id.

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const.

Fix checkpatch.pl error in patch 1,3 and 7:
ERROR: space prohibited before open square bracket '['.

Arvind Yadav (8):
[PATCH 1/8] Input: iforce: constify usb_device_id and fix space before '[' error. [PATCH 2/8] Input: xpad: constify usb_device_id.
[PATCH 3/8] Input: keyspan_remote: constify usb_device_id.
[PATCH 4/8] Input: powermate: constify usb_device_id and fix space before '[' error. [PATCH 5/8] Input: appletouch: constify usb_device_id.
[PATCH 6/8] Input: synaptics_usb: constify usb_device_id.
[PATCH 7/8] Input: acecad: constify usb_device_id and fix space before '[' error. [PATCH 8/8] Input: kbtab: constify usb_device_id.

 drivers/input/joystick/iforce/iforce-usb.c | 2 +-
 drivers/input/joystick/xpad.c              | 2 +-
 drivers/input/misc/keyspan_remote.c        | 2 +-
 drivers/input/misc/powermate.c             | 2 +-
 drivers/input/mouse/appletouch.c           | 2 +-
 drivers/input/mouse/synaptics_usb.c        | 2 +-
 drivers/input/tablet/acecad.c              | 2 +-
 drivers/input/tablet/kbtab.c               | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/8 Input: iforce: 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 <linux/usb.h> 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 '['.

---
 drivers/input/joystick/iforce/iforce-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/iforce/iforce-usb.c +1 -1
index db64adf..db5cc35 100644
@@ -209,7 +209,7 @@ static void iforce_usb_disconnect(struct usb_interface *intf)
 	kfree(iforce);
 }
 
-static struct usb_device_id iforce_usb_ids [] = {
+static const struct usb_device_id iforce_usb_ids[] = {
 	{ USB_DEVICE(0x044f, 0xa01c) },		/* Thrustmaster Motor Sport GT */
 	{ USB_DEVICE(0x046d, 0xc281) },		/* Logitech WingMan Force */
 	{ USB_DEVICE(0x046d, 0xc291) },		/* Logitech WingMan Formula Force */
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/8 Input: xpad: constify usb_device_id.

In reply to Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const.

---
 drivers/input/joystick/xpad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/xpad.c +1 -1
index 298a6ba..2578a76 100644
@@ -408,7 +408,7 @@ static const signed short xpad_abs_triggers[] = {
 #define XPAD_XBOXONE_VENDOR(vend) \
 	{ XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) }
 
-static struct usb_device_id xpad_table[] = {
+static const struct usb_device_id xpad_table[] = {
 	{ USB_INTERFACE_INFO('X', 'B', 0) },	/* X-Box USB-IF not approved class */
 	XPAD_XBOX360_VENDOR(0x044f),		/* Thrustmaster X-Box 360 controllers */
 	XPAD_XBOX360_VENDOR(0x045e),		/* Microsoft X-Box 360 controllers */
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/8 Input: keyspan_remote: constify usb_device_id.

In reply to Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const.

---
 drivers/input/misc/keyspan_remote.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/keyspan_remote.c +1 -1
index a3fe4a9..77c47d6 100644
@@ -85,7 +85,7 @@ static const unsigned short keyspan_key_table[] = {
 };
 
 /* table of devices that work with this driver */
-static struct usb_device_id keyspan_table[] = {
+static const struct usb_device_id keyspan_table[] = {
 	{ USB_DEVICE(USB_KEYSPAN_VENDOR_ID, USB_KEYSPAN_PRODUCT_UIA11) },
 	{ }					/* Terminating entry */
 };
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/8 Input: powermate: constify usb_device_id and fix space before '[' error.

In reply to Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> 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 '['.

---
 drivers/input/misc/powermate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/powermate.c +1 -1
index 84909a1..056091b 100644
@@ -432,7 +432,7 @@ static void powermate_disconnect(struct usb_interface *intf)
 	}
 }
 
-static struct usb_device_id powermate_devices [] = {
+static const struct usb_device_id powermate_devices[] = {
 	{ USB_DEVICE(POWERMATE_VENDOR, POWERMATE_PRODUCT_NEW) },
 	{ USB_DEVICE(POWERMATE_VENDOR, POWERMATE_PRODUCT_OLD) },
 	{ USB_DEVICE(CONTOUR_VENDOR, CONTOUR_JOG) },
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/8 Input: appletouch: constify usb_device_id.

In reply to Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const.

---
 drivers/input/mouse/appletouch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/appletouch.c +1 -1
index ef234c9..81a695d 100644
@@ -125,7 +125,7 @@ static const struct atp_info geyser4_info = {
  *  According to Info.plist Geyser IV is the same as Geyser III.)
  */
 
-static struct usb_device_id atp_table[] = {
+static const struct usb_device_id atp_table[] = {
 	/* PowerBooks Feb 2005, iBooks G4 */
 	ATP_DEVICE(0x020e, fountain_info),	/* FOUNTAIN ANSI */
 	ATP_DEVICE(0x020f, fountain_info),	/* FOUNTAIN ISO */
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/8 Input: synaptics_usb: constify usb_device_id.

In reply to Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const.

---
 drivers/input/mouse/synaptics_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/synaptics_usb.c +1 -1
index 6bcc018..cb7d15d 100644
@@ -525,7 +525,7 @@ static int synusb_reset_resume(struct usb_interface *intf)
 	return synusb_resume(intf);
 }
 
-static struct usb_device_id synusb_idtable[] = {
+static const struct usb_device_id synusb_idtable[] = {
 	{ USB_DEVICE_SYNAPTICS(TP, SYNUSB_TOUCHPAD) },
 	{ USB_DEVICE_SYNAPTICS(INT_TP, SYNUSB_TOUCHPAD) },
 	{ USB_DEVICE_SYNAPTICS(CPAD,
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/8 Input: acecad: constify usb_device_idi and fix space before '[' error.

In reply to Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> 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 '['.

---
 drivers/input/tablet/acecad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/tablet/acecad.c +1 -1
index e86e377..77f41a5 100644
@@ -260,7 +260,7 @@ static void usb_acecad_disconnect(struct usb_interface *intf)
 	kfree(acecad);
 }
 
-static struct usb_device_id usb_acecad_id_table [] = {
+static const struct usb_device_id usb_acecad_id_table[] = {
 	{ USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_FLAIR), .driver_info = 0 },
 	{ USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_302),	 .driver_info = 1 },
 	{ }
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/8 Input: kbtab: constify usb_device_id.

In reply to Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const.

---
 drivers/input/tablet/kbtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/tablet/kbtab.c +1 -1
index 4d9d649..a41c3ff 100644
@@ -88,7 +88,7 @@ static void kbtab_irq(struct urb *urb)
 			__func__, retval);
 }
 
-static struct usb_device_id kbtab_ids[] = {
+static const struct usb_device_id kbtab_ids[] = {
 	{ USB_DEVICE(USB_VENDOR_ID_KBGEAR, 0x1001), .driver_info = 0 },
 	{ }
 };
Signature · 1 line
2.7.4
maintainer
#9 lore raw
In reply to Arvind Yadav
Quoted 17 lines · Arvind Yadav

usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const.

Fix checkpatch.pl error in patch 1,3 and 7:
ERROR: space prohibited before open square bracket '['.

Arvind Yadav (8):
[PATCH 1/8] Input: iforce: constify usb_device_id and fix space before '[' error. [PATCH 2/8] Input: xpad: constify usb_device_id.
[PATCH 3/8] Input: keyspan_remote: constify usb_device_id.
[PATCH 4/8] Input: powermate: constify usb_device_id and fix space before '[' error. [PATCH 5/8] Input: appletouch: constify usb_device_id.
[PATCH 6/8] Input: synaptics_usb: constify usb_device_id.
[PATCH 7/8] Input: acecad: constify usb_device_id and fix space before '[' error. [PATCH 8/8] Input: kbtab: constify usb_device_id.

Quoted 9 lines
 drivers/input/joystick/iforce/iforce-usb.c | 2 +-
 drivers/input/joystick/xpad.c              | 2 +-
 drivers/input/misc/keyspan_remote.c        | 2 +-
 drivers/input/misc/powermate.c             | 2 +-
 drivers/input/mouse/appletouch.c           | 2 +-
 drivers/input/mouse/synaptics_usb.c        | 2 +-
 drivers/input/tablet/acecad.c              | 2 +-
 drivers/input/tablet/kbtab.c               | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

Applied the lot, thank you.

Signature · 1 line
Dmitry