aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-29 15:17:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-29 15:17:54 -0400
commit8d7d1adcd77ffa2e0edec79d4e48a7b1a1943c47 (patch)
tree45d2f7fc7588306fd9eb19415d3ee541698a1289 /drivers
parentf7b006931751f029620ad2f8310ac7a1484fbdb4 (diff)
parent41c8a48aa8de88ff56ed2f657b93d2446dd7882c (diff)
Merge tag 'usb-3.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg Kroah-Hartman: "Here are a number of small USB fixes for 3.4-rc5. Nothing major, as before, some USB gadget fixes. There's a crash fix for a number of ASUS laptops on resume that had been reported by a number of different people. We think the fix might also pertain to other machines, as this was a BIOS bug, and they seem to travel to different models and manufacturers quite easily. Other than that, some other reported problems fixed as well." * tag 'usb-3.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: gadget: udc-core: fix incompatibility with dummy-hcd usb: gadget: udc-core: fix wrong call order USB: cdc-wdm: fix race leading leading to memory corruption USB: EHCI: fix crash during suspend on ASUS computers usb gadget: uvc: uvc_request_data::length field must be signed usb: gadget: dummy: do not call pullup() on udc_stop() usb: musb: davinci.c: add missing unregister usb: musb: drop __deprecated flag USB: gadget: storage gadgets send wrong error code for unknown commands usb: otg: gpio_vbus: Add otg transceiver events and notifiers
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/class/cdc-wdm.c7
-rw-r--r--drivers/usb/core/hcd-pci.c9
-rw-r--r--drivers/usb/gadget/dummy_hcd.c1
-rw-r--r--drivers/usb/gadget/f_mass_storage.c2
-rw-r--r--drivers/usb/gadget/file_storage.c2
-rw-r--r--drivers/usb/gadget/udc-core.c4
-rw-r--r--drivers/usb/gadget/uvc.h2
-rw-r--r--drivers/usb/gadget/uvc_v4l2.c2
-rw-r--r--drivers/usb/host/ehci-pci.c8
-rw-r--r--drivers/usb/musb/davinci.c3
-rw-r--r--drivers/usb/musb/musb_core.h2
-rw-r--r--drivers/usb/otg/gpio_vbus.c15
12 files changed, 45 insertions, 12 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index c6f6560d436c..0bb2b3248dad 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -157,8 +157,9 @@ static void wdm_out_callback(struct urb *urb)
157 spin_lock(&desc->iuspin); 157 spin_lock(&desc->iuspin);
158 desc->werr = urb->status; 158 desc->werr = urb->status;
159 spin_unlock(&desc->iuspin); 159 spin_unlock(&desc->iuspin);
160 clear_bit(WDM_IN_USE, &desc->flags);
161 kfree(desc->outbuf); 160 kfree(desc->outbuf);
161 desc->outbuf = NULL;
162 clear_bit(WDM_IN_USE, &desc->flags);
162 wake_up(&desc->wait); 163 wake_up(&desc->wait);
163} 164}
164 165
@@ -338,7 +339,7 @@ static ssize_t wdm_write
338 if (we < 0) 339 if (we < 0)
339 return -EIO; 340 return -EIO;
340 341
341 desc->outbuf = buf = kmalloc(count, GFP_KERNEL); 342 buf = kmalloc(count, GFP_KERNEL);
342 if (!buf) { 343 if (!buf) {
343 rv = -ENOMEM; 344 rv = -ENOMEM;
344 goto outnl; 345 goto outnl;
@@ -406,10 +407,12 @@ static ssize_t wdm_write
406 req->wIndex = desc->inum; 407 req->wIndex = desc->inum;
407 req->wLength = cpu_to_le16(count); 408 req->wLength = cpu_to_le16(count);
408 set_bit(WDM_IN_USE, &desc->flags); 409 set_bit(WDM_IN_USE, &desc->flags);
410 desc->outbuf = buf;
409 411
410 rv = usb_submit_urb(desc->command, GFP_KERNEL); 412 rv = usb_submit_urb(desc->command, GFP_KERNEL);
411 if (rv < 0) { 413 if (rv < 0) {
412 kfree(buf); 414 kfree(buf);
415 desc->outbuf = NULL;
413 clear_bit(WDM_IN_USE, &desc->flags); 416 clear_bit(WDM_IN_USE, &desc->flags);
414 dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); 417 dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
415 } else { 418 } else {
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 622b4a48e732..57ed9e400c06 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -493,6 +493,15 @@ static int hcd_pci_suspend_noirq(struct device *dev)
493 493
494 pci_save_state(pci_dev); 494 pci_save_state(pci_dev);
495 495
496 /*
497 * Some systems crash if an EHCI controller is in D3 during
498 * a sleep transition. We have to leave such controllers in D0.
499 */
500 if (hcd->broken_pci_sleep) {
501 dev_dbg(dev, "Staying in PCI D0\n");
502 return retval;
503 }
504
496 /* If the root hub is dead rather than suspended, disallow remote 505 /* If the root hub is dead rather than suspended, disallow remote
497 * wakeup. usb_hc_died() should ensure that both hosts are marked as 506 * wakeup. usb_hc_died() should ensure that both hosts are marked as
498 * dying, so we only need to check the primary roothub. 507 * dying, so we only need to check the primary roothub.
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index a6dfd2164166..170cbe89d9f8 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -927,7 +927,6 @@ static int dummy_udc_stop(struct usb_gadget *g,
927 927
928 dum->driver = NULL; 928 dum->driver = NULL;
929 929
930 dummy_pullup(&dum->gadget, 0);
931 return 0; 930 return 0;
932} 931}
933 932
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index a371e966425f..cb8c162cae5a 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2189,7 +2189,7 @@ unknown_cmnd:
2189 common->data_size_from_cmnd = 0; 2189 common->data_size_from_cmnd = 0;
2190 sprintf(unknown, "Unknown x%02x", common->cmnd[0]); 2190 sprintf(unknown, "Unknown x%02x", common->cmnd[0]);
2191 reply = check_command(common, common->cmnd_size, 2191 reply = check_command(common, common->cmnd_size,
2192 DATA_DIR_UNKNOWN, 0xff, 0, unknown); 2192 DATA_DIR_UNKNOWN, ~0, 0, unknown);
2193 if (reply == 0) { 2193 if (reply == 0) {
2194 common->curlun->sense_data = SS_INVALID_COMMAND; 2194 common->curlun->sense_data = SS_INVALID_COMMAND;
2195 reply = -EINVAL; 2195 reply = -EINVAL;
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 4fac56927741..a896d73f7a93 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -2579,7 +2579,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2579 fsg->data_size_from_cmnd = 0; 2579 fsg->data_size_from_cmnd = 0;
2580 sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); 2580 sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]);
2581 if ((reply = check_command(fsg, fsg->cmnd_size, 2581 if ((reply = check_command(fsg, fsg->cmnd_size,
2582 DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) { 2582 DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) {
2583 fsg->curlun->sense_data = SS_INVALID_COMMAND; 2583 fsg->curlun->sense_data = SS_INVALID_COMMAND;
2584 reply = -EINVAL; 2584 reply = -EINVAL;
2585 } 2585 }
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 2fa9865babed..e5e44f8cde9a 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -263,8 +263,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
263 263
264 if (udc_is_newstyle(udc)) { 264 if (udc_is_newstyle(udc)) {
265 udc->driver->disconnect(udc->gadget); 265 udc->driver->disconnect(udc->gadget);
266 udc->driver->unbind(udc->gadget);
267 usb_gadget_disconnect(udc->gadget); 266 usb_gadget_disconnect(udc->gadget);
267 udc->driver->unbind(udc->gadget);
268 usb_gadget_udc_stop(udc->gadget, udc->driver); 268 usb_gadget_udc_stop(udc->gadget, udc->driver);
269 } else { 269 } else {
270 usb_gadget_stop(udc->gadget, udc->driver); 270 usb_gadget_stop(udc->gadget, udc->driver);
@@ -415,9 +415,9 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
415 usb_gadget_udc_start(udc->gadget, udc->driver); 415 usb_gadget_udc_start(udc->gadget, udc->driver);
416 usb_gadget_connect(udc->gadget); 416 usb_gadget_connect(udc->gadget);
417 } else if (sysfs_streq(buf, "disconnect")) { 417 } else if (sysfs_streq(buf, "disconnect")) {
418 usb_gadget_disconnect(udc->gadget);
418 if (udc_is_newstyle(udc)) 419 if (udc_is_newstyle(udc))
419 usb_gadget_udc_stop(udc->gadget, udc->driver); 420 usb_gadget_udc_stop(udc->gadget, udc->driver);
420 usb_gadget_disconnect(udc->gadget);
421 } else { 421 } else {
422 dev_err(dev, "unsupported command '%s'\n", buf); 422 dev_err(dev, "unsupported command '%s'\n", buf);
423 return -EINVAL; 423 return -EINVAL;
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h
index bc78c606c12b..ca4e03a1c73a 100644
--- a/drivers/usb/gadget/uvc.h
+++ b/drivers/usb/gadget/uvc.h
@@ -28,7 +28,7 @@
28 28
29struct uvc_request_data 29struct uvc_request_data
30{ 30{
31 unsigned int length; 31 __s32 length;
32 __u8 data[60]; 32 __u8 data[60];
33}; 33};
34 34
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
index f6e083b50191..54d7ca559cb2 100644
--- a/drivers/usb/gadget/uvc_v4l2.c
+++ b/drivers/usb/gadget/uvc_v4l2.c
@@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data)
39 if (data->length < 0) 39 if (data->length < 0)
40 return usb_ep_set_halt(cdev->gadget->ep0); 40 return usb_ep_set_halt(cdev->gadget->ep0);
41 41
42 req->length = min(uvc->event_length, data->length); 42 req->length = min_t(unsigned int, uvc->event_length, data->length);
43 req->zero = data->length < uvc->event_length; 43 req->zero = data->length < uvc->event_length;
44 req->dma = DMA_ADDR_INVALID; 44 req->dma = DMA_ADDR_INVALID;
45 45
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 01bb7241d6ef..fe8dc069164e 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
144 hcd->has_tt = 1; 144 hcd->has_tt = 1;
145 tdi_reset(ehci); 145 tdi_reset(ehci);
146 } 146 }
147 if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) {
148 /* EHCI #1 or #2 on 6 Series/C200 Series chipset */
149 if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) {
150 ehci_info(ehci, "broken D3 during system sleep on ASUS\n");
151 hcd->broken_pci_sleep = 1;
152 device_set_wakeup_capable(&pdev->dev, false);
153 }
154 }
147 break; 155 break;
148 case PCI_VENDOR_ID_TDI: 156 case PCI_VENDOR_ID_TDI:
149 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 157 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 97ab975fa442..768b4b55c816 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -386,7 +386,7 @@ static int davinci_musb_init(struct musb *musb)
386 usb_nop_xceiv_register(); 386 usb_nop_xceiv_register();
387 musb->xceiv = usb_get_transceiver(); 387 musb->xceiv = usb_get_transceiver();
388 if (!musb->xceiv) 388 if (!musb->xceiv)
389 return -ENODEV; 389 goto unregister;
390 390
391 musb->mregs += DAVINCI_BASE_OFFSET; 391 musb->mregs += DAVINCI_BASE_OFFSET;
392 392
@@ -444,6 +444,7 @@ static int davinci_musb_init(struct musb *musb)
444 444
445fail: 445fail:
446 usb_put_transceiver(musb->xceiv); 446 usb_put_transceiver(musb->xceiv);
447unregister:
447 usb_nop_xceiv_unregister(); 448 usb_nop_xceiv_unregister();
448 return -ENODEV; 449 return -ENODEV;
449} 450}
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 93de517a32a0..f4a40f001c88 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -449,7 +449,7 @@ struct musb {
449 * We added this flag to forcefully disable double 449 * We added this flag to forcefully disable double
450 * buffering until we get it working. 450 * buffering until we get it working.
451 */ 451 */
452 unsigned double_buffer_not_ok:1 __deprecated; 452 unsigned double_buffer_not_ok:1;
453 453
454 struct musb_hdrc_config *config; 454 struct musb_hdrc_config *config;
455 455
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index 3ece43a2e4c1..a0a2178974fe 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -96,7 +96,7 @@ static void gpio_vbus_work(struct work_struct *work)
96 struct gpio_vbus_data *gpio_vbus = 96 struct gpio_vbus_data *gpio_vbus =
97 container_of(work, struct gpio_vbus_data, work); 97 container_of(work, struct gpio_vbus_data, work);
98 struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; 98 struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data;
99 int gpio; 99 int gpio, status;
100 100
101 if (!gpio_vbus->phy.otg->gadget) 101 if (!gpio_vbus->phy.otg->gadget)
102 return; 102 return;
@@ -108,7 +108,9 @@ static void gpio_vbus_work(struct work_struct *work)
108 */ 108 */
109 gpio = pdata->gpio_pullup; 109 gpio = pdata->gpio_pullup;
110 if (is_vbus_powered(pdata)) { 110 if (is_vbus_powered(pdata)) {
111 status = USB_EVENT_VBUS;
111 gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; 112 gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL;
113 gpio_vbus->phy.last_event = status;
112 usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); 114 usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget);
113 115
114 /* drawing a "unit load" is *always* OK, except for OTG */ 116 /* drawing a "unit load" is *always* OK, except for OTG */
@@ -117,6 +119,9 @@ static void gpio_vbus_work(struct work_struct *work)
117 /* optionally enable D+ pullup */ 119 /* optionally enable D+ pullup */
118 if (gpio_is_valid(gpio)) 120 if (gpio_is_valid(gpio))
119 gpio_set_value(gpio, !pdata->gpio_pullup_inverted); 121 gpio_set_value(gpio, !pdata->gpio_pullup_inverted);
122
123 atomic_notifier_call_chain(&gpio_vbus->phy.notifier,
124 status, gpio_vbus->phy.otg->gadget);
120 } else { 125 } else {
121 /* optionally disable D+ pullup */ 126 /* optionally disable D+ pullup */
122 if (gpio_is_valid(gpio)) 127 if (gpio_is_valid(gpio))
@@ -125,7 +130,12 @@ static void gpio_vbus_work(struct work_struct *work)
125 set_vbus_draw(gpio_vbus, 0); 130 set_vbus_draw(gpio_vbus, 0);
126 131
127 usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); 132 usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget);
133 status = USB_EVENT_NONE;
128 gpio_vbus->phy.state = OTG_STATE_B_IDLE; 134 gpio_vbus->phy.state = OTG_STATE_B_IDLE;
135 gpio_vbus->phy.last_event = status;
136
137 atomic_notifier_call_chain(&gpio_vbus->phy.notifier,
138 status, gpio_vbus->phy.otg->gadget);
129 } 139 }
130} 140}
131 141
@@ -287,6 +297,9 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
287 irq, err); 297 irq, err);
288 goto err_irq; 298 goto err_irq;
289 } 299 }
300
301 ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier);
302
290 INIT_WORK(&gpio_vbus->work, gpio_vbus_work); 303 INIT_WORK(&gpio_vbus->work, gpio_vbus_work);
291 304
292 gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); 305 gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");