summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_sourcesink.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-12-23 21:09:58 +0100
committerFelipe Balbi <balbi@ti.com>2013-01-21 20:52:38 +0200
commiteeae54075ce3491968e9282cbb44f6a06b306b66 (patch)
tree2fea50e51db80cf2e18f4cd99e60eec946efcdf1 /drivers/usb/gadget/f_sourcesink.c
parent544aca39e670421c2daae4b6706f1e405b19ba72 (diff)
usb: gadget: move source sink's config descriptor out of f_sourcesink
f_sourcesink 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_sourcesink.c')
-rw-r--r--drivers/usb/gadget/f_sourcesink.c48
1 files changed, 8 insertions, 40 deletions
diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c
index bac04b0c628..f785cbd5968 100644
--- a/drivers/usb/gadget/f_sourcesink.c
+++ b/drivers/usb/gadget/f_sourcesink.c
@@ -328,6 +328,14 @@ sourcesink_bind(struct usb_configuration *c, struct usb_function *f)
source_sink_intf_alt0.bInterfaceNumber = id;
source_sink_intf_alt1.bInterfaceNumber = id;
+ /* allocate string ID(s) */
+ id = usb_string_id(cdev);
+ if (id < 0)
+ return id;
+ strings_sourcesink[0].id = id;
+ source_sink_intf_alt0.iInterface = id;
+ source_sink_intf_alt1.iInterface = id;
+
/* allocate bulk endpoints */
ss->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_source_desc);
if (!ss->in_ep) {
@@ -869,43 +877,3 @@ static int ss_config_setup(struct usb_configuration *c,
return -EOPNOTSUPP;
}
}
-
-static struct usb_configuration sourcesink_driver = {
- .label = "source/sink",
- .strings = sourcesink_strings,
- .setup = ss_config_setup,
- .bConfigurationValue = 3,
- .bmAttributes = USB_CONFIG_ATT_SELFPOWER,
- /* .iConfiguration = DYNAMIC */
-};
-
-/**
- * sourcesink_add - add a source/sink testing configuration to a device
- * @cdev: the device to support the configuration
- */
-int __init sourcesink_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_sourcesink[0].id = id;
-
- source_sink_intf_alt0.iInterface = id;
- source_sink_intf_alt1.iInterface = id;
- sourcesink_driver.iConfiguration = id;
-
- /* support autoresume for remote wakeup testing */
- if (autoresume)
- sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
-
- /* support OTG systems */
- if (gadget_is_otg(cdev->gadget)) {
- sourcesink_driver.descriptors = otg_desc;
- sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
- }
-
- return usb_add_config(cdev, &sourcesink_driver, sourcesink_bind_config);
-}