Commit 2c683347 authored by Felipe Balbi's avatar Felipe Balbi

usb: gadget: udc: pass a single argument to usb_gadget_udc_start/stop

We know that our udc points to our gadget and our
gadget_driver, simplify the interface by passing
a single argument.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 69e28882
...@@ -174,8 +174,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_udc_reset); ...@@ -174,8 +174,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_udc_reset);
/** /**
* usb_gadget_udc_start - tells usb device controller to start up * usb_gadget_udc_start - tells usb device controller to start up
* @gadget: The gadget we want to get started * @udc: The UDC to be started
* @driver: The driver we want to bind to @gadget
* *
* This call is issued by the UDC Class driver when it's about * This call is issued by the UDC Class driver when it's about
* to register a gadget driver to the device controller, before * to register a gadget driver to the device controller, before
...@@ -186,10 +185,9 @@ EXPORT_SYMBOL_GPL(usb_gadget_udc_reset); ...@@ -186,10 +185,9 @@ EXPORT_SYMBOL_GPL(usb_gadget_udc_reset);
* *
* Returns zero on success, else negative errno. * Returns zero on success, else negative errno.
*/ */
static inline int usb_gadget_udc_start(struct usb_gadget *gadget, static inline int usb_gadget_udc_start(struct usb_udc *udc)
struct usb_gadget_driver *driver)
{ {
return gadget->ops->udc_start(gadget, driver); return udc->gadget->ops->udc_start(udc->gadget, udc->driver);
} }
/** /**
...@@ -204,10 +202,9 @@ static inline int usb_gadget_udc_start(struct usb_gadget *gadget, ...@@ -204,10 +202,9 @@ static inline int usb_gadget_udc_start(struct usb_gadget *gadget,
* far as powering off UDC completely and disable its data * far as powering off UDC completely and disable its data
* line pullups. * line pullups.
*/ */
static inline void usb_gadget_udc_stop(struct usb_gadget *gadget, static inline void usb_gadget_udc_stop(struct usb_udc *udc)
struct usb_gadget_driver *driver)
{ {
gadget->ops->udc_stop(gadget, driver); udc->gadget->ops->udc_stop(udc->gadget, udc->driver);
} }
/** /**
...@@ -335,7 +332,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) ...@@ -335,7 +332,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
usb_gadget_disconnect(udc->gadget); usb_gadget_disconnect(udc->gadget);
udc->driver->disconnect(udc->gadget); udc->driver->disconnect(udc->gadget);
udc->driver->unbind(udc->gadget); udc->driver->unbind(udc->gadget);
usb_gadget_udc_stop(udc->gadget, NULL); usb_gadget_udc_stop(udc);
udc->driver = NULL; udc->driver = NULL;
udc->dev.driver = NULL; udc->dev.driver = NULL;
...@@ -395,7 +392,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri ...@@ -395,7 +392,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
ret = driver->bind(udc->gadget, driver); ret = driver->bind(udc->gadget, driver);
if (ret) if (ret)
goto err1; goto err1;
ret = usb_gadget_udc_start(udc->gadget, driver); ret = usb_gadget_udc_start(udc);
if (ret) { if (ret) {
driver->unbind(udc->gadget); driver->unbind(udc->gadget);
goto err1; goto err1;
...@@ -513,12 +510,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev, ...@@ -513,12 +510,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
} }
if (sysfs_streq(buf, "connect")) { if (sysfs_streq(buf, "connect")) {
usb_gadget_udc_start(udc->gadget, udc->driver); usb_gadget_udc_start(udc);
usb_gadget_connect(udc->gadget); usb_gadget_connect(udc->gadget);
} else if (sysfs_streq(buf, "disconnect")) { } else if (sysfs_streq(buf, "disconnect")) {
usb_gadget_disconnect(udc->gadget); usb_gadget_disconnect(udc->gadget);
udc->driver->disconnect(udc->gadget); udc->driver->disconnect(udc->gadget);
usb_gadget_udc_stop(udc->gadget, udc->driver); usb_gadget_udc_stop(udc);
} else { } else {
dev_err(dev, "unsupported command '%s'\n", buf); dev_err(dev, "unsupported command '%s'\n", buf);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment