Skip to contentSkip to conversation

usb/gadget: Constify usb_gadget_get_string "table" argument

PATCH Superseded Benjamin Herrenschmidt 1 participant 1 message May 2, 2018 USB

v9 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/2 usb/gadget: Constify usb_gadget_get_string "table" argument

The table is never modified by the function. This allows us to use it on a statically defined table that is marked const.

---
 drivers/usb/gadget/usbstring.c | 2 +-
 include/linux/usb/gadget.h     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/usbstring.c +1 -1
index 566ab261e8b7..7c24d1ce1088 100644
@@ -33,7 +33,7 @@
  * characters (which are also widely used in C strings).
  */
 int
-usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf)
+usb_gadget_get_string (const struct usb_gadget_strings *table, int id, u8 *buf)
 {
 	struct usb_string	*s;
 	int			len;
include/linux/usb/gadget.h +1 -1
index 847f423ad9b3..e5cd84a0f84a 100644
@@ -763,7 +763,7 @@ struct usb_gadget_string_container {
 };
 
 /* put descriptor for string with that id into buf (buflen >= 256) */
-int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
+int usb_gadget_get_string(const struct usb_gadget_strings *table, int id, u8 *buf);
 
 /*-------------------------------------------------------------------------*/