summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_obex.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-10-22 22:15:10 +0200
committerFelipe Balbi <balbi@ti.com>2012-10-31 15:11:47 +0200
commit1616e99d42a8b427b8dcada347ef0ee0df1a1b7b (patch)
tree2753f0d18e9458c126460a731b309df9e10bb17c /drivers/usb/gadget/f_obex.c
parentb36c347966160ecfe420cd47a5a1f81ddaffc007 (diff)
downloadop-kernel-dev-1616e99d42a8b427b8dcada347ef0ee0df1a1b7b.zip
op-kernel-dev-1616e99d42a8b427b8dcada347ef0ee0df1a1b7b.tar.gz
usb: gadget: let f_* use usb_string_ids_tab() where it makes sense
Instead of calling usb_string_id() multiple times I replace it with one usb_string_ids_tab(). The NULL pointer in struct usb_string with "" and are not overwritten in fail or unbind case. The conditional assignment remains because some gadgets recycle the string ID because the same descriptor (and string ID) is used if we have more than one config descriptor. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_obex.c')
-rw-r--r--drivers/usb/gadget/f_obex.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/usb/gadget/f_obex.c b/drivers/usb/gadget/f_obex.c
index d74491a..d8dd878 100644
--- a/drivers/usb/gadget/f_obex.c
+++ b/drivers/usb/gadget/f_obex.c
@@ -379,6 +379,7 @@ fail:
static void
obex_unbind(struct usb_configuration *c, struct usb_function *f)
{
+ obex_string_defs[OBEX_CTRL_IDX].id = 0;
usb_free_all_descriptors(f);
kfree(func_to_obex(f));
}
@@ -418,22 +419,16 @@ int __init obex_bind_config(struct usb_configuration *c, u8 port_num)
if (!can_support_obex(c))
return -EINVAL;
- /* maybe allocate device-global string IDs, and patch descriptors */
if (obex_string_defs[OBEX_CTRL_IDX].id == 0) {
- status = usb_string_id(c->cdev);
+ status = usb_string_ids_tab(c->cdev, obex_string_defs);
if (status < 0)
return status;
- obex_string_defs[OBEX_CTRL_IDX].id = status;
+ obex_control_intf.iInterface =
+ obex_string_defs[OBEX_CTRL_IDX].id;
- obex_control_intf.iInterface = status;
-
- status = usb_string_id(c->cdev);
- if (status < 0)
- return status;
- obex_string_defs[OBEX_DATA_IDX].id = status;
-
- obex_data_nop_intf.iInterface =
- obex_data_intf.iInterface = status;
+ status = obex_string_defs[OBEX_DATA_IDX].id;
+ obex_data_nop_intf.iInterface = status;
+ obex_data_intf.iInterface = status;
}
/* allocate and initialize one new instance */
OpenPOWER on IntegriCloud