aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-01-24 04:00:15 -0500
committerFelipe Balbi <balbi@ti.com>2013-01-24 14:11:32 -0500
commit2d7ebbb0946e9e13285eee348df1dbc48f0580e0 (patch)
treeaaec2755446fb5424fd717cd1728e8005b8b633b /drivers/usb/gadget
parent4991e102c11524aff42ce3a0e7caeb6e5577808c (diff)
usb: gadget: completely remove ->start/->stop
Those have been deprecated for a long time and previous patches just converted all remaining users of those. Since there are no in-tree users and we don't want any new users for them, let's obliterate every piece of code related to those calls. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/udc-core.c89
1 files changed, 14 insertions, 75 deletions
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index e7c591621a3b..2a9cd369f71c 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -102,28 +102,6 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
102/* ------------------------------------------------------------------------- */ 102/* ------------------------------------------------------------------------- */
103 103
104/** 104/**
105 * usb_gadget_start - tells usb device controller to start up
106 * @gadget: The gadget we want to get started
107 * @driver: The driver we want to bind to @gadget
108 * @bind: The bind function for @driver
109 *
110 * This call is issued by the UDC Class driver when it's about
111 * to register a gadget driver to the device controller, before
112 * calling gadget driver's bind() method.
113 *
114 * It allows the controller to be powered off until strictly
115 * necessary to have it powered on.
116 *
117 * Returns zero on success, else negative errno.
118 */
119static inline int usb_gadget_start(struct usb_gadget *gadget,
120 struct usb_gadget_driver *driver,
121 int (*bind)(struct usb_gadget *, struct usb_gadget_driver *))
122{
123 return gadget->ops->start(driver, bind);
124}
125
126/**
127 * usb_gadget_udc_start - tells usb device controller to start up 105 * usb_gadget_udc_start - tells usb device controller to start up
128 * @gadget: The gadget we want to get started 106 * @gadget: The gadget we want to get started
129 * @driver: The driver we want to bind to @gadget 107 * @driver: The driver we want to bind to @gadget
@@ -144,24 +122,6 @@ static inline int usb_gadget_udc_start(struct usb_gadget *gadget,
144} 122}
145 123
146/** 124/**
147 * usb_gadget_stop - tells usb device controller we don't need it anymore
148 * @gadget: The device we want to stop activity
149 * @driver: The driver to unbind from @gadget
150 *
151 * This call is issued by the UDC Class driver after calling
152 * gadget driver's unbind() method.
153 *
154 * The details are implementation specific, but it can go as
155 * far as powering off UDC completely and disable its data
156 * line pullups.
157 */
158static inline void usb_gadget_stop(struct usb_gadget *gadget,
159 struct usb_gadget_driver *driver)
160{
161 gadget->ops->stop(driver);
162}
163
164/**
165 * usb_gadget_udc_stop - tells usb device controller we don't need it anymore 125 * usb_gadget_udc_stop - tells usb device controller we don't need it anymore
166 * @gadget: The device we want to stop activity 126 * @gadget: The device we want to stop activity
167 * @driver: The driver to unbind from @gadget 127 * @driver: The driver to unbind from @gadget
@@ -246,14 +206,6 @@ err1:
246} 206}
247EXPORT_SYMBOL_GPL(usb_add_gadget_udc); 207EXPORT_SYMBOL_GPL(usb_add_gadget_udc);
248 208
249static int udc_is_newstyle(struct usb_udc *udc)
250{
251 if (udc->gadget->ops->udc_start && udc->gadget->ops->udc_stop)
252 return 1;
253 return 0;
254}
255
256
257static void usb_gadget_remove_driver(struct usb_udc *udc) 209static void usb_gadget_remove_driver(struct usb_udc *udc)
258{ 210{
259 dev_dbg(&udc->dev, "unregistering UDC driver [%s]\n", 211 dev_dbg(&udc->dev, "unregistering UDC driver [%s]\n",
@@ -261,14 +213,10 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
261 213
262 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); 214 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
263 215
264 if (udc_is_newstyle(udc)) { 216 usb_gadget_disconnect(udc->gadget);
265 usb_gadget_disconnect(udc->gadget); 217 udc->driver->disconnect(udc->gadget);
266 udc->driver->disconnect(udc->gadget); 218 udc->driver->unbind(udc->gadget);
267 udc->driver->unbind(udc->gadget); 219 usb_gadget_udc_stop(udc->gadget, udc->driver);
268 usb_gadget_udc_stop(udc->gadget, udc->driver);
269 } else {
270 usb_gadget_stop(udc->gadget, udc->driver);
271 }
272 220
273 udc->driver = NULL; 221 udc->driver = NULL;
274 udc->dev.driver = NULL; 222 udc->dev.driver = NULL;
@@ -321,22 +269,15 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
321 udc->driver = driver; 269 udc->driver = driver;
322 udc->dev.driver = &driver->driver; 270 udc->dev.driver = &driver->driver;
323 271
324 if (udc_is_newstyle(udc)) { 272 ret = driver->bind(udc->gadget, driver);
325 ret = driver->bind(udc->gadget, driver); 273 if (ret)
326 if (ret) 274 goto err1;
327 goto err1; 275 ret = usb_gadget_udc_start(udc->gadget, driver);
328 ret = usb_gadget_udc_start(udc->gadget, driver); 276 if (ret) {
329 if (ret) { 277 driver->unbind(udc->gadget);
330 driver->unbind(udc->gadget); 278 goto err1;
331 goto err1;
332 }
333 usb_gadget_connect(udc->gadget);
334 } else {
335
336 ret = usb_gadget_start(udc->gadget, driver, driver->bind);
337 if (ret)
338 goto err1;
339 } 279 }
280 usb_gadget_connect(udc->gadget);
340 281
341 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); 282 kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
342 return 0; 283 return 0;
@@ -440,13 +381,11 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
440 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); 381 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
441 382
442 if (sysfs_streq(buf, "connect")) { 383 if (sysfs_streq(buf, "connect")) {
443 if (udc_is_newstyle(udc)) 384 usb_gadget_udc_start(udc->gadget, udc->driver);
444 usb_gadget_udc_start(udc->gadget, udc->driver);
445 usb_gadget_connect(udc->gadget); 385 usb_gadget_connect(udc->gadget);
446 } else if (sysfs_streq(buf, "disconnect")) { 386 } else if (sysfs_streq(buf, "disconnect")) {
447 usb_gadget_disconnect(udc->gadget); 387 usb_gadget_disconnect(udc->gadget);
448 if (udc_is_newstyle(udc)) 388 usb_gadget_udc_stop(udc->gadget, udc->driver);
449 usb_gadget_udc_stop(udc->gadget, udc->driver);
450 } else { 389 } else {
451 dev_err(dev, "unsupported command '%s'\n", buf); 390 dev_err(dev, "unsupported command '%s'\n", buf);
452 return -EINVAL; 391 return -EINVAL;