aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/ci13xxx_udc.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2011-10-10 12:38:09 -0400
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:44:45 -0500
commit7bb4fdc602c6cc763185d88f58ed75c84eb32158 (patch)
treeca7c8fbe11941c33bf3bbfc0f156cc74f3c28424 /drivers/usb/gadget/ci13xxx_udc.c
parentdc47ce90c3a822cd7c9e9339fe4d5f61dcb26b50 (diff)
USB: ci13xxx_udc: make suspend and resume in gadget driver optional
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>
Diffstat (limited to 'drivers/usb/gadget/ci13xxx_udc.c')
-rw-r--r--drivers/usb/gadget/ci13xxx_udc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 9a0c3979ff43..9db7e7667c2b 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -2563,9 +2563,7 @@ static int ci13xxx_start(struct usb_gadget_driver *driver,
2563 if (driver == NULL || 2563 if (driver == NULL ||
2564 bind == NULL || 2564 bind == NULL ||
2565 driver->setup == NULL || 2565 driver->setup == NULL ||
2566 driver->disconnect == NULL || 2566 driver->disconnect == NULL)
2567 driver->suspend == NULL ||
2568 driver->resume == NULL)
2569 return -EINVAL; 2567 return -EINVAL;
2570 else if (udc == NULL) 2568 else if (udc == NULL)
2571 return -ENODEV; 2569 return -ENODEV;
@@ -2693,8 +2691,6 @@ static int ci13xxx_stop(struct usb_gadget_driver *driver)
2693 driver->unbind == NULL || 2691 driver->unbind == NULL ||
2694 driver->setup == NULL || 2692 driver->setup == NULL ||
2695 driver->disconnect == NULL || 2693 driver->disconnect == NULL ||
2696 driver->suspend == NULL ||
2697 driver->resume == NULL ||
2698 driver != udc->driver) 2694 driver != udc->driver)
2699 return -EINVAL; 2695 return -EINVAL;
2700 2696
@@ -2793,7 +2789,7 @@ static irqreturn_t udc_irq(void)
2793 isr_statistics.pci++; 2789 isr_statistics.pci++;
2794 udc->gadget.speed = hw_port_is_high_speed() ? 2790 udc->gadget.speed = hw_port_is_high_speed() ?
2795 USB_SPEED_HIGH : USB_SPEED_FULL; 2791 USB_SPEED_HIGH : USB_SPEED_FULL;
2796 if (udc->suspended) { 2792 if (udc->suspended && udc->driver->resume) {
2797 spin_unlock(udc->lock); 2793 spin_unlock(udc->lock);
2798 udc->driver->resume(&udc->gadget); 2794 udc->driver->resume(&udc->gadget);
2799 spin_lock(udc->lock); 2795 spin_lock(udc->lock);
@@ -2807,7 +2803,8 @@ static irqreturn_t udc_irq(void)
2807 isr_tr_complete_handler(udc); 2803 isr_tr_complete_handler(udc);
2808 } 2804 }
2809 if (USBi_SLI & intr) { 2805 if (USBi_SLI & intr) {
2810 if (udc->gadget.speed != USB_SPEED_UNKNOWN) { 2806 if (udc->gadget.speed != USB_SPEED_UNKNOWN &&
2807 udc->driver->suspend) {
2811 udc->suspended = 1; 2808 udc->suspended = 1;
2812 spin_unlock(udc->lock); 2809 spin_unlock(udc->lock);
2813 udc->driver->suspend(&udc->gadget); 2810 udc->driver->suspend(&udc->gadget);