summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_loopback.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-23 21:09:59 +0100
committerFelipe Balbi <balbi@ti.com>2013-01-21 20:52:39 +0200
commit78f46f09a80a39fe646fe415a21435f2a05df6c2 (patch)
treea1d2fab9c2dd25891751acd419778a023fa7b3c0 /drivers/usb/gadget/f_loopback.c
parenteeae54075ce3491968e9282cbb44f6a06b306b66 (diff)
downloadblackbird-op-linux-78f46f09a80a39fe646fe415a21435f2a05df6c2.tar.gz
blackbird-op-linux-78f46f09a80a39fe646fe415a21435f2a05df6c2.zip
usb: gadget: move loopback's config descriptor out of f_loopback
f_loopback should only include the bare function but it also includes the config descriptor. This patch moves the config descriptor into zero.c, the only user of this function. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_loopback.c')
-rw-r--r--drivers/usb/gadget/f_loopback.c44
1 files changed, 6 insertions, 38 deletions
diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c
index bb39cb2bb3a3..3d103a2f998f 100644
--- a/drivers/usb/gadget/f_loopback.c
+++ b/drivers/usb/gadget/f_loopback.c
@@ -185,6 +185,12 @@ loopback_bind(struct usb_configuration *c, struct usb_function *f)
return id;
loopback_intf.bInterfaceNumber = id;
+ id = usb_string_id(cdev);
+ if (id < 0)
+ return id;
+ strings_loopback[0].id = id;
+ loopback_intf.iInterface = id;
+
/* allocate endpoints */
loop->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_loop_source_desc);
@@ -388,41 +394,3 @@ static int __init loopback_bind_config(struct usb_configuration *c)
kfree(loop);
return status;
}
-
-static struct usb_configuration loopback_driver = {
- .label = "loopback",
- .strings = loopback_strings,
- .bConfigurationValue = 2,
- .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
- /* .iConfiguration = DYNAMIC */
-};
-
-/**
- * loopback_add - add a loopback testing configuration to a device
- * @cdev: the device to support the loopback configuration
- */
-int __init loopback_add(struct usb_composite_dev *cdev, bool autoresume)
-{
- int id;
-
- /* allocate string ID(s) */
- id = usb_string_id(cdev);
- if (id < 0)
- return id;
- strings_loopback[0].id = id;
-
- loopback_intf.iInterface = id;
- loopback_driver.iConfiguration = id;
-
- /* support autoresume for remote wakeup testing */
- if (autoresume)
- loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
-
- /* support OTG systems */
- if (gadget_is_otg(cdev->gadget)) {
- loopback_driver.descriptors = otg_desc;
- loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
- }
-
- return usb_add_config(cdev, &loopback_driver, loopback_bind_config);
-}
OpenPOWER on IntegriCloud