Signed-off-by: Matthieu CASTET <matthieu.castet@xxxxxxxxxx> --- drivers/usb/gadget/Kconfig | 42 ++++++++++++++++++------------------ drivers/usb/gadget/langwell_udc.c | 21 ++++++++++-------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index c3fda37..90242f8 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -447,27 +447,6 @@ config USB_GOKU default USB_GADGET select USB_GADGET_SELECTED -config USB_GADGET_LANGWELL - boolean "Intel Langwell USB Device Controller" - depends on PCI - select USB_GADGET_DUALSPEED - help - Intel Langwell USB Device Controller is a High-Speed USB - On-The-Go device controller. - - The number of programmable endpoints is different through - controller revision. - - Say "y" to link the driver statically, or "m" to build a - dynamically linked module called "langwell_udc" and force all - gadget drivers to also be dynamically linked. - -config USB_LANGWELL - tristate - depends on USB_GADGET_LANGWELL - default USB_GADGET - select USB_GADGET_SELECTED - config USB_GADGET_EG20T boolean "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC" depends on PCI @@ -605,6 +584,27 @@ config USB_NET2280 depends on USB_GADGET_NET2280 default USB_GADGET select USB_GADGET_SELECTED + +config USB_GADGET_LANGWELL + boolean "Intel Langwell USB Device Controller" + depends on PCI + select USB_GADGET_DUALSPEED + help + Intel Langwell USB Device Controller is a High-Speed USB + On-The-Go device controller. + + The number of programmable endpoints is different through + controller revision. + + Say "y" to link the driver statically, or "m" to build a + dynamically linked module called "langwell_udc" and force all + gadget drivers to also be dynamically linked. + +config USB_LANGWELL + tristate + depends on USB_GADGET_LANGWELL + default USB_GADGET + select USB_GADGET_SELECTED endmenu config USB_GADGET_DUALSPEED diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index 1eca8b4..4182545 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c @@ -1852,10 +1852,10 @@ static DEVICE_ATTR(remote_wakeup, S_IWUSR, NULL, store_remote_wakeup); * the driver might get unbound. */ -int usb_gadget_probe_driver(struct usb_gadget_driver *driver, - int (*bind)(struct usb_gadget *)) +static int langwell_usb_gadget_probe_driver(struct usb_gadget_driver *driver, + int (*bind)(struct usb_gadget *), struct usb_gadget *gadget) { - struct langwell_udc *dev = the_controller; + struct langwell_udc *dev = container_of (gadget, struct langwell_udc, gadget); unsigned long flags; int retval; @@ -1914,13 +1914,12 @@ err_unbind: dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); return retval; } -EXPORT_SYMBOL(usb_gadget_probe_driver); /* unregister gadget driver */ -int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) +static int langwell_usb_gadget_unregister_driver(struct usb_gadget_driver *driver, struct usb_gadget *gadget) { - struct langwell_udc *dev = the_controller; + struct langwell_udc *dev = container_of (gadget, struct langwell_udc, gadget); unsigned long flags; if (!dev) @@ -1965,8 +1964,11 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); return 0; } -EXPORT_SYMBOL(usb_gadget_unregister_driver); +struct usb_gadget_udc langwell_driver = { + .probe_driver = langwell_usb_gadget_probe_driver, + .unregister_driver = langwell_usb_gadget_unregister_driver, +}; /*-------------------------------------------------------------------------*/ @@ -3113,7 +3115,7 @@ static void langwell_udc_remove(struct pci_dev *pdev) dev_info(&dev->pdev->dev, "unbind\n"); dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); - device_unregister(&dev->gadget.dev); + usb_gadget_unregister(&dev->gadget); device_remove_file(&pdev->dev, &dev_attr_langwell_udc); device_remove_file(&pdev->dev, &dev_attr_remote_wakeup); @@ -3369,7 +3371,8 @@ static int langwell_udc_probe(struct pci_dev *pdev, the_controller = dev; - retval = device_register(&dev->gadget.dev); + dev->gadget.udc = &langwell_driver; + retval = usb_gadget_register(&dev->gadget); if (retval) goto error; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html