Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrzej Pietrasiewicz and committed by
Nicholas Bellinger
9beab5d4 c3f890bc

+7 -11
+7 -11
drivers/usb/gadget/function/f_tcm.c
··· 2028 2028 static int tcm_bind(struct usb_configuration *c, struct usb_function *f) 2029 2029 { 2030 2030 struct f_uas *fu = to_f_uas(f); 2031 + struct usb_string *us; 2031 2032 struct usb_gadget *gadget = c->cdev->gadget; 2032 2033 struct usb_ep *ep; 2033 2034 struct f_tcm_opts *opts; ··· 2043 2042 return -ENODEV; 2044 2043 } 2045 2044 mutex_unlock(&opts->dep_lock); 2046 - 2047 - if (tcm_us_strings[0].id == 0) { 2048 - ret = usb_string_ids_tab(c->cdev, tcm_us_strings); 2049 - if (ret < 0) 2050 - return ret; 2051 - 2052 - bot_intf_desc.iInterface = tcm_us_strings[USB_G_STR_INT_BBB].id; 2053 - uasp_intf_desc.iInterface = 2054 - tcm_us_strings[USB_G_STR_INT_UAS].id; 2055 - } 2045 + us = usb_gstrings_attach(c->cdev, tcm_strings, 2046 + ARRAY_SIZE(tcm_us_strings)); 2047 + if (IS_ERR(us)) 2048 + return PTR_ERR(us); 2049 + bot_intf_desc.iInterface = us[USB_G_STR_INT_BBB].id; 2050 + uasp_intf_desc.iInterface = us[USB_G_STR_INT_UAS].id; 2056 2051 2057 2052 iface = usb_interface_id(c, f); 2058 2053 if (iface < 0) ··· 2297 2300 fu->function.set_alt = tcm_set_alt; 2298 2301 fu->function.setup = tcm_setup; 2299 2302 fu->function.disable = tcm_disable; 2300 - fu->function.strings = tcm_strings; 2301 2303 fu->function.free_func = tcm_free; 2302 2304 fu->tpg = tpg_instances[i].tpg; 2303 2305 mutex_unlock(&tpg_instances_lock);