usb: gadget: udc-core: initialize gadget->dev.driver
authorFelipe Balbi <balbi@ti.com>
Tue, 26 Feb 2013 11:51:24 +0000 (13:51 +0200)
committerFelipe Balbi <balbi@ti.com>
Mon, 18 Mar 2013 09:17:30 +0000 (11:17 +0200)
if we initialize gadget->dev.driver ourselves,
UDC drivers won't have to do the same, so we
can remove some duplicated code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/udc-core.c

index 447a1614736e53b1a9a2b5e67281b4bfbf635f94..2423d024654f139d922a085f639b54eb21f01230 100644 (file)
@@ -247,6 +247,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
 
        udc->driver = NULL;
        udc->dev.driver = NULL;
+       udc->gadget->dev.driver = NULL;
 }
 
 /**
@@ -296,6 +297,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
 
        udc->driver = driver;
        udc->dev.driver = &driver->driver;
+       udc->gadget->dev.driver = &driver->driver;
 
        ret = driver->bind(udc->gadget, driver);
        if (ret)
@@ -314,6 +316,7 @@ err1:
                        udc->driver->function, ret);
        udc->driver = NULL;
        udc->dev.driver = NULL;
+       udc->gadget->dev.driver = NULL;
        return ret;
 }