diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2015-12-11 16:06:25 +0100 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-12-20 19:40:43 -0800 |
commit | 9beab5d4f2ef6f5b8f26506d94ed68deb42af882 (patch) | |
tree | e9018dc8c7e662dab43af8dfb2949b0e267df53e | |
parent | c3f890bc79f12d12c2ccabe4bfc0c4a1e01b3184 (diff) | |
download | linux-9beab5d4f2ef6f5b8f26506d94ed68deb42af882.tar.gz linux-9beab5d4f2ef6f5b8f26506d94ed68deb42af882.tar.bz2 linux-9beab5d4f2ef6f5b8f26506d94ed68deb42af882.zip |
usb: gadget: f_tcm: use usb_gstrings_attach
Do not directly use file static strings definitions in instances of f_tcm.
Instead use usb_gstrings_attach.
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>
-rw-r--r-- | drivers/usb/gadget/function/f_tcm.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index b33738a8eea2..4a004634dafe 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -2028,6 +2028,7 @@ static struct usb_gadget_strings *tcm_strings[] = { static int tcm_bind(struct usb_configuration *c, struct usb_function *f) { struct f_uas *fu = to_f_uas(f); + struct usb_string *us; struct usb_gadget *gadget = c->cdev->gadget; struct usb_ep *ep; struct f_tcm_opts *opts; @@ -2042,16 +2043,12 @@ static int tcm_bind(struct usb_configuration *c, struct usb_function *f) return -ENODEV; } mutex_unlock(&opts->dep_lock); - - if (tcm_us_strings[0].id == 0) { - ret = usb_string_ids_tab(c->cdev, tcm_us_strings); - if (ret < 0) - return ret; - - 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; - } + us = usb_gstrings_attach(c->cdev, tcm_strings, + ARRAY_SIZE(tcm_us_strings)); + if (IS_ERR(us)) + return PTR_ERR(us); + bot_intf_desc.iInterface = us[USB_G_STR_INT_BBB].id; + uasp_intf_desc.iInterface = us[USB_G_STR_INT_UAS].id; iface = usb_interface_id(c, f); if (iface < 0) @@ -2300,7 +2297,6 @@ static struct usb_function *tcm_alloc(struct usb_function_instance *fi) fu->function.set_alt = tcm_set_alt; fu->function.setup = tcm_setup; fu->function.disable = tcm_disable; - fu->function.strings = tcm_strings; fu->function.free_func = tcm_free; fu->tpg = tpg_instances[i].tpg; mutex_unlock(&tpg_instances_lock); |