diff options
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r-- | drivers/usb/gadget/composite.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 5d11c291f1ad..59e85234fa0a 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -149,16 +149,17 @@ done: | |||
149 | int usb_function_deactivate(struct usb_function *function) | 149 | int usb_function_deactivate(struct usb_function *function) |
150 | { | 150 | { |
151 | struct usb_composite_dev *cdev = function->config->cdev; | 151 | struct usb_composite_dev *cdev = function->config->cdev; |
152 | unsigned long flags; | ||
152 | int status = 0; | 153 | int status = 0; |
153 | 154 | ||
154 | spin_lock(&cdev->lock); | 155 | spin_lock_irqsave(&cdev->lock, flags); |
155 | 156 | ||
156 | if (cdev->deactivations == 0) | 157 | if (cdev->deactivations == 0) |
157 | status = usb_gadget_disconnect(cdev->gadget); | 158 | status = usb_gadget_disconnect(cdev->gadget); |
158 | if (status == 0) | 159 | if (status == 0) |
159 | cdev->deactivations++; | 160 | cdev->deactivations++; |
160 | 161 | ||
161 | spin_unlock(&cdev->lock); | 162 | spin_unlock_irqrestore(&cdev->lock, flags); |
162 | return status; | 163 | return status; |
163 | } | 164 | } |
164 | 165 | ||
@@ -1013,7 +1014,7 @@ composite_suspend(struct usb_gadget *gadget) | |||
1013 | struct usb_composite_dev *cdev = get_gadget_data(gadget); | 1014 | struct usb_composite_dev *cdev = get_gadget_data(gadget); |
1014 | struct usb_function *f; | 1015 | struct usb_function *f; |
1015 | 1016 | ||
1016 | /* REVISIT: should we have config and device level | 1017 | /* REVISIT: should we have config level |
1017 | * suspend/resume callbacks? | 1018 | * suspend/resume callbacks? |
1018 | */ | 1019 | */ |
1019 | DBG(cdev, "suspend\n"); | 1020 | DBG(cdev, "suspend\n"); |
@@ -1023,6 +1024,8 @@ composite_suspend(struct usb_gadget *gadget) | |||
1023 | f->suspend(f); | 1024 | f->suspend(f); |
1024 | } | 1025 | } |
1025 | } | 1026 | } |
1027 | if (composite->suspend) | ||
1028 | composite->suspend(cdev); | ||
1026 | } | 1029 | } |
1027 | 1030 | ||
1028 | static void | 1031 | static void |
@@ -1031,10 +1034,12 @@ composite_resume(struct usb_gadget *gadget) | |||
1031 | struct usb_composite_dev *cdev = get_gadget_data(gadget); | 1034 | struct usb_composite_dev *cdev = get_gadget_data(gadget); |
1032 | struct usb_function *f; | 1035 | struct usb_function *f; |
1033 | 1036 | ||
1034 | /* REVISIT: should we have config and device level | 1037 | /* REVISIT: should we have config level |
1035 | * suspend/resume callbacks? | 1038 | * suspend/resume callbacks? |
1036 | */ | 1039 | */ |
1037 | DBG(cdev, "resume\n"); | 1040 | DBG(cdev, "resume\n"); |
1041 | if (composite->resume) | ||
1042 | composite->resume(cdev); | ||
1038 | if (cdev->config) { | 1043 | if (cdev->config) { |
1039 | list_for_each_entry(f, &cdev->config->functions, list) { | 1044 | list_for_each_entry(f, &cdev->config->functions, list) { |
1040 | if (f->resume) | 1045 | if (f->resume) |