summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2015-12-11 18:06:16 +0300
committerNicholas Bellinger <nab@linux-iscsi.org>2015-12-21 06:40:24 +0300
commitc3978ed358ffa9965f146599050daae76bcd499e (patch)
treec78869447bc4a7ab6c3ad7f9baf86b4963edde1f /drivers/usb/gadget
parent894a2556e7691f87ee4b04e4a4b04a1814c572fa (diff)
downloadlinux-c3978ed358ffa9965f146599050daae76bcd499e.tar.xz
usb: gadget: tcm: split string definitions into function and device
Prepare for factoring out f_tcm from a legacy gadget. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.c25
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.h3
2 files changed, 22 insertions, 6 deletions
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index 65e49504d1ac..8278d3ba27f5 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -1990,13 +1990,13 @@ static struct usb_device_descriptor usbg_device_desc = {
.bNumConfigurations = 1,
};
+#define USB_G_STR_CONFIG USB_GADGET_FIRST_AVAIL_IDX
+
static struct usb_string usbg_us_strings[] = {
[USB_GADGET_MANUFACTURER_IDX].s = "Target Manufactor",
[USB_GADGET_PRODUCT_IDX].s = "Target Product",
[USB_GADGET_SERIAL_IDX].s = "000000000001",
[USB_G_STR_CONFIG].s = "default config",
- [USB_G_STR_INT_UAS].s = "USB Attached SCSI",
- [USB_G_STR_INT_BBB].s = "Bulk Only Transport",
{ },
};
@@ -2010,6 +2010,22 @@ static struct usb_gadget_strings *usbg_strings[] = {
NULL,
};
+static struct usb_string tcm_us_strings[] = {
+ [USB_G_STR_INT_UAS].s = "USB Attached SCSI",
+ [USB_G_STR_INT_BBB].s = "Bulk Only Transport",
+ { },
+};
+
+static struct usb_gadget_strings tcm_stringtab = {
+ .language = 0x0409,
+ .strings = tcm_us_strings,
+};
+
+static struct usb_gadget_strings *tcm_strings[] = {
+ &tcm_stringtab,
+ NULL,
+};
+
static int guas_unbind(struct usb_composite_dev *cdev)
{
return 0;
@@ -2174,10 +2190,11 @@ static int usbg_cfg_bind(struct usb_configuration *c)
fu->function.set_alt = usbg_set_alt;
fu->function.setup = usbg_setup;
fu->function.disable = usbg_disable;
+ fu->function.strings = tcm_strings;
fu->tpg = the_only_tpg_I_currently_have;
- bot_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_BBB].id;
- uasp_intf_desc.iInterface = usbg_us_strings[USB_G_STR_INT_UAS].id;
+ bot_intf_desc.iInterface = tcm_us_strings[USB_G_STR_INT_BBB].id;
+ uasp_intf_desc.iInterface = tcm_us_strings[USB_G_STR_INT_UAS].id;
ret = usb_add_function(c, &fu->function);
if (ret)
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.h b/drivers/usb/gadget/legacy/tcm_usb_gadget.h
index 0b749e1aa2f1..f1b69e260248 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.h
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.h
@@ -16,8 +16,7 @@
#define UASP_SS_EP_COMP_NUM_STREAMS (1 << UASP_SS_EP_COMP_LOG_STREAMS)
enum {
- USB_G_STR_CONFIG = USB_GADGET_FIRST_AVAIL_IDX,
- USB_G_STR_INT_UAS,
+ USB_G_STR_INT_UAS = 0,
USB_G_STR_INT_BBB,
};