]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
USB: ci13xxx_udc: make suspend and resume in gadget driver optional
authorMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 10 Oct 2011 16:38:09 +0000 (18:38 +0200)
committerFelipe Balbi <balbi@ti.com>
Mon, 12 Dec 2011 09:44:45 +0000 (11:44 +0200)
Some gadget drivers don't implement suspend and/or resume functions.
Instead of changing the gadget drivers, make suspend and resume in
ci13xxx_udc (following other udc drivers) optional.

Tested-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/ci13xxx_udc.c

index 9a0c3979ff43faa2c54f05efa5fe8c76d8f23dff..9db7e7667c2b05e2be281d398716e0d6584983de 100644 (file)
@@ -2563,9 +2563,7 @@ static int ci13xxx_start(struct usb_gadget_driver *driver,
        if (driver             == NULL ||
            bind               == NULL ||
            driver->setup      == NULL ||
-           driver->disconnect == NULL ||
-           driver->suspend    == NULL ||
-           driver->resume     == NULL)
+           driver->disconnect == NULL)
                return -EINVAL;
        else if (udc         == NULL)
                return -ENODEV;
@@ -2693,8 +2691,6 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver)
            driver->unbind     == NULL ||
            driver->setup      == NULL ||
            driver->disconnect == NULL ||
-           driver->suspend    == NULL ||
-           driver->resume     == NULL ||
            driver             != udc->driver)
                return -EINVAL;
 
@@ -2793,7 +2789,7 @@ static irqreturn_t udc_irq(void)
                        isr_statistics.pci++;
                        udc->gadget.speed = hw_port_is_high_speed() ?
                                USB_SPEED_HIGH : USB_SPEED_FULL;
-                       if (udc->suspended) {
+                       if (udc->suspended && udc->driver->resume) {
                                spin_unlock(udc->lock);
                                udc->driver->resume(&udc->gadget);
                                spin_lock(udc->lock);
@@ -2807,7 +2803,8 @@ static irqreturn_t udc_irq(void)
                        isr_tr_complete_handler(udc);
                }
                if (USBi_SLI & intr) {
-                       if (udc->gadget.speed != USB_SPEED_UNKNOWN) {
+                       if (udc->gadget.speed != USB_SPEED_UNKNOWN &&
+                           udc->driver->suspend) {
                                udc->suspended = 1;
                                spin_unlock(udc->lock);
                                udc->driver->suspend(&udc->gadget);