diff options
Diffstat (limited to 'drivers/usb/gadget/udc')
-rw-r--r-- | drivers/usb/gadget/udc/aspeed_udc.c | 19 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/at91_udc.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/core.c | 19 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/fsl_qe_udc.c | 10 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/fsl_udc_core.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/fusb300_udc.c | 7 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/lpc32xx_udc.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/m66592-udc.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/omap_udc.c | 3 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/r8a66597-udc.c | 3 |
10 files changed, 47 insertions, 26 deletions
diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c index 2ef89a442f..3916c8e2ba 100644 --- a/drivers/usb/gadget/udc/aspeed_udc.c +++ b/drivers/usb/gadget/udc/aspeed_udc.c @@ -1432,15 +1432,24 @@ static void ast_udc_init_hw(struct ast_udc_dev *udc) ast_udc_write(udc, 0, AST_UDC_EP0_CTRL); } -static int ast_udc_remove(struct platform_device *pdev) +static void ast_udc_remove(struct platform_device *pdev) { struct ast_udc_dev *udc = platform_get_drvdata(pdev); unsigned long flags; u32 ctrl; usb_del_gadget_udc(&udc->gadget); - if (udc->driver) - return -EBUSY; + if (udc->driver) { + /* + * This is broken as only some cleanup is skipped, *udev is + * freed and the register mapping goes away. Any further usage + * probably crashes. Also the device is unbound, so the skipped + * cleanup is never catched up later. + */ + dev_alert(&pdev->dev, + "Driver is busy and still going away. Fasten your seat belts!\n"); + return; + } spin_lock_irqsave(&udc->lock, flags); @@ -1459,8 +1468,6 @@ static int ast_udc_remove(struct platform_device *pdev) udc->ep0_buf_dma); udc->ep0_buf = NULL; - - return 0; } static int ast_udc_probe(struct platform_device *pdev) @@ -1581,7 +1588,7 @@ MODULE_DEVICE_TABLE(of, ast_udc_of_dt_ids); static struct platform_driver ast_udc_driver = { .probe = ast_udc_probe, - .remove = ast_udc_remove, + .remove_new = ast_udc_remove, .driver = { .name = KBUILD_MODNAME, .of_match_table = ast_udc_of_dt_ids, diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index 922b418700..30ea4a9d53 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -2000,6 +2000,7 @@ static int at91udc_resume(struct platform_device *pdev) #endif static struct platform_driver at91_udc_driver = { + .probe = at91udc_probe, .remove = at91udc_remove, .shutdown = at91udc_shutdown, .suspend = at91udc_suspend, @@ -2010,7 +2011,7 @@ static struct platform_driver at91_udc_driver = { }, }; -module_platform_driver_probe(at91_udc_driver, at91udc_probe); +module_platform_driver(at91_udc_driver); MODULE_DESCRIPTION("AT91 udc driver"); MODULE_AUTHOR("Thomas Rathbone, David Brownell"); diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 781c833854..d59f94464b 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1126,12 +1126,12 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state); /* ------------------------------------------------------------------------- */ /* Acquire connect_lock before calling this function. */ -static void usb_udc_connect_control_locked(struct usb_udc *udc) __must_hold(&udc->connect_lock) +static int usb_udc_connect_control_locked(struct usb_udc *udc) __must_hold(&udc->connect_lock) { if (udc->vbus) - usb_gadget_connect_locked(udc->gadget); + return usb_gadget_connect_locked(udc->gadget); else - usb_gadget_disconnect_locked(udc->gadget); + return usb_gadget_disconnect_locked(udc->gadget); } static void vbus_event_work(struct work_struct *work) @@ -1605,12 +1605,23 @@ static int gadget_bind_driver(struct device *dev) } usb_gadget_enable_async_callbacks(udc); udc->allow_connect = true; - usb_udc_connect_control_locked(udc); + ret = usb_udc_connect_control_locked(udc); + if (ret) + goto err_connect_control; + mutex_unlock(&udc->connect_lock); kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); return 0; + err_connect_control: + udc->allow_connect = false; + usb_gadget_disable_async_callbacks(udc); + if (gadget->irq) + synchronize_irq(gadget->irq); + usb_gadget_udc_stop_locked(udc); + mutex_unlock(&udc->connect_lock); + err_start: driver->unbind(udc->gadget); diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index 4aae86b47e..4e88681a79 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c @@ -27,9 +27,10 @@ #include <linux/interrupt.h> #include <linux/io.h> #include <linux/moduleparam.h> +#include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h> -#include <linux/of_platform.h> +#include <linux/platform_device.h> #include <linux/dma-mapping.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> @@ -2471,17 +2472,12 @@ static const struct of_device_id qe_udc_match[]; static int qe_udc_probe(struct platform_device *ofdev) { struct qe_udc *udc; - const struct of_device_id *match; struct device_node *np = ofdev->dev.of_node; struct qe_ep *ep; unsigned int ret = 0; unsigned int i; const void *prop; - match = of_match_device(qe_udc_match, &ofdev->dev); - if (!match) - return -EINVAL; - prop = of_get_property(np, "mode", NULL); if (!prop || strcmp(prop, "peripheral")) return -ENODEV; @@ -2493,7 +2489,7 @@ static int qe_udc_probe(struct platform_device *ofdev) return -ENOMEM; } - udc->soc_type = (unsigned long)match->data; + udc->soc_type = (unsigned long)device_get_match_data(&ofdev->dev); udc->usb_regs = of_iomap(np, 0); if (!udc->usb_regs) { ret = -ENOMEM; diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index ee5705d336..2693a10eb0 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c @@ -2666,6 +2666,7 @@ static const struct platform_device_id fsl_udc_devtype[] = { }; MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); static struct platform_driver udc_driver = { + .probe = fsl_udc_probe, .remove = fsl_udc_remove, .id_table = fsl_udc_devtype, /* these suspend and resume are not usb suspend and resume */ @@ -2679,7 +2680,7 @@ static struct platform_driver udc_driver = { }, }; -module_platform_driver_probe(udc_driver, fsl_udc_probe); +module_platform_driver(udc_driver); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_AUTHOR(DRIVER_AUTHOR); diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c index bd03d475f9..873265634c 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.c +++ b/drivers/usb/gadget/udc/fusb300_udc.c @@ -1506,10 +1506,11 @@ clean_up: } static struct platform_driver fusb300_driver = { - .remove_new = fusb300_remove, - .driver = { + .probe = fusb300_probe, + .remove_new = fusb300_remove, + .driver = { .name = udc_name, }, }; -module_platform_driver_probe(fusb300_driver, fusb300_probe); +module_platform_driver(fusb300_driver); diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index fe62db32dd..a917cc9a32 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -3254,6 +3254,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_udc_of_match); #endif static struct platform_driver lpc32xx_udc_driver = { + .probe = lpc32xx_udc_probe, .remove = lpc32xx_udc_remove, .shutdown = lpc32xx_udc_shutdown, .suspend = lpc32xx_udc_suspend, @@ -3264,7 +3265,7 @@ static struct platform_driver lpc32xx_udc_driver = { }, }; -module_platform_driver_probe(lpc32xx_udc_driver, lpc32xx_udc_probe); +module_platform_driver(lpc32xx_udc_driver); MODULE_DESCRIPTION("LPC32XX udc driver"); MODULE_AUTHOR("Kevin Wells <kevin.wells@nxp.com>"); diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index e05f45a4b5..bfaa5291e6 100644 --- a/drivers/usb/gadget/udc/m66592-udc.c +++ b/drivers/usb/gadget/udc/m66592-udc.c @@ -1687,10 +1687,11 @@ clean_up: /*-------------------------------------------------------------------------*/ static struct platform_driver m66592_driver = { + .probe = m66592_probe, .remove_new = m66592_remove, .driver = { .name = udc_name, }, }; -module_platform_driver_probe(m66592_driver, m66592_probe); +module_platform_driver(m66592_driver); diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 10c5d7f726..f90eeecf27 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2036,7 +2036,8 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev) static inline int machine_without_vbus_sense(void) { - return machine_is_omap_osk() || machine_is_sx1(); + return machine_is_omap_osk() || machine_is_omap_palmte() || + machine_is_sx1(); } static int omap_udc_start(struct usb_gadget *g, diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 51b665f15c..db4a10a979 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1964,13 +1964,14 @@ clean_up2: /*-------------------------------------------------------------------------*/ static struct platform_driver r8a66597_driver = { + .probe = r8a66597_probe, .remove_new = r8a66597_remove, .driver = { .name = udc_name, }, }; -module_platform_driver_probe(r8a66597_driver, r8a66597_probe); +module_platform_driver(r8a66597_driver); MODULE_DESCRIPTION("R8A66597 USB gadget driver"); MODULE_LICENSE("GPL"); |