History

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

Linus Torvalds committed 14 years ago

Commit 8d7d1ad2 parents f7b0069 41c8a4813 files · +47 −12Browse files

Unified · Split

13 files
  1. drivers/usb/class/cdc-wdm.c +5 −2
  2. drivers/usb/core/hcd-pci.c +9 −0
  3. drivers/usb/gadget/dummy_hcd.c +0 −1
  4. drivers/usb/gadget/f_mass_storage.c +1 −1
  5. drivers/usb/gadget/file_storage.c +1 −1
  6. drivers/usb/gadget/udc-core.c +2 −2
  7. drivers/usb/gadget/uvc.h +1 −1
  8. drivers/usb/gadget/uvc_v4l2.c +1 −1
  9. drivers/usb/host/ehci-pci.c +8 −0
  10. drivers/usb/musb/davinci.c +2 −1
  11. drivers/usb/musb/musb_core.h +1 −1
  12. drivers/usb/otg/gpio_vbus.c +14 −1
  13. include/linux/usb/hcd.h +2 −0
drivers/usb/class/cdc-wdm.c+5−2
@@ -157,8 +157,9 @@ static void wdm_out_callback(struct urb *urb) · 156 unmodified lines
157157 spin_lock(&desc->iuspin);
158158 desc->werr = urb->status;
159159 spin_unlock(&desc->iuspin);
160− clear_bit(WDM_IN_USE, &desc->flags);
161160 kfree(desc->outbuf);
161+ desc->outbuf = NULL;
162+ clear_bit(WDM_IN_USE, &desc->flags);
162163 wake_up(&desc->wait);
163164 }
164165
@@ -338,7 +339,7 @@ static ssize_t wdm_write · 173 unmodified lines
338339 if (we < 0)
339340 return -EIO;
340341
341− desc->outbuf = buf = kmalloc(count, GFP_KERNEL);
342+ buf = kmalloc(count, GFP_KERNEL);
342343 if (!buf) {
343344 rv = -ENOMEM;
344345 goto outnl;
@@ -406,10 +407,12 @@ static ssize_t wdm_write · 61 unmodified lines
406407 req->wIndex = desc->inum;
407408 req->wLength = cpu_to_le16(count);
408409 set_bit(WDM_IN_USE, &desc->flags);
410+ desc->outbuf = buf;
409411
410412 rv = usb_submit_urb(desc->command, GFP_KERNEL);
411413 if (rv < 0) {
412414 kfree(buf);
415+ desc->outbuf = NULL;
413416 clear_bit(WDM_IN_USE, &desc->flags);
414417 dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
415418 } else {
drivers/usb/core/hcd-pci.c+9−0
@@ -493,6 +493,15 @@ static int hcd_pci_suspend_noirq(struct device *dev) · 492 unmodified lines
493493
494494 pci_save_state(pci_dev);
495495
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+
496505 /* If the root hub is dead rather than suspended, disallow remote
497506 * wakeup. usb_hc_died() should ensure that both hosts are marked as
498507 * dying, so we only need to check the primary roothub.
drivers/usb/gadget/dummy_hcd.c+0−1
@@ -927,7 +927,6 @@ static int dummy_udc_stop(struct usb_gadget *g, · 926 unmodified lines
927927
928928 dum->driver = NULL;
929929
930− dummy_pullup(&dum->gadget, 0);
931930 return 0;
932931 }
933932
drivers/usb/gadget/f_mass_storage.c+1−1
@@ -2189,7 +2189,7 @@ unknown_cmnd: · 2188 unmodified lines
21892189 common->data_size_from_cmnd = 0;
21902190 sprintf(unknown, "Unknown x%02x", common->cmnd[0]);
21912191 reply = check_command(common, common->cmnd_size,
2192− DATA_DIR_UNKNOWN, 0xff, 0, unknown);
2192+ DATA_DIR_UNKNOWN, ~0, 0, unknown);
21932193 if (reply == 0) {
21942194 common->curlun->sense_data = SS_INVALID_COMMAND;
21952195 reply = -EINVAL;
drivers/usb/gadget/file_storage.c+1−1
@@ -2579,7 +2579,7 @@ static int do_scsi_command(struct fsg_dev *fsg) · 2578 unmodified lines
25792579 fsg->data_size_from_cmnd = 0;
25802580 sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]);
25812581 if ((reply = check_command(fsg, fsg->cmnd_size,
2582− DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) {
2582+ DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) {
25832583 fsg->curlun->sense_data = SS_INVALID_COMMAND;
25842584 reply = -EINVAL;
25852585 }
drivers/usb/gadget/udc-core.c+2−2
@@ -263,8 +263,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) · 262 unmodified lines
263263
264264 if (udc_is_newstyle(udc)) {
265265 udc->driver->disconnect(udc->gadget);
266− udc->driver->unbind(udc->gadget);
267266 usb_gadget_disconnect(udc->gadget);
267+ udc->driver->unbind(udc->gadget);
268268 usb_gadget_udc_stop(udc->gadget, udc->driver);
269269 } else {
270270 usb_gadget_stop(udc->gadget, udc->driver);
@@ -415,9 +415,9 @@ static ssize_t usb_udc_softconn_store(struct device *dev, · 144 unmodified lines
415415 usb_gadget_udc_start(udc->gadget, udc->driver);
416416 usb_gadget_connect(udc->gadget);
417417 } else if (sysfs_streq(buf, "disconnect")) {
418+ usb_gadget_disconnect(udc->gadget);
418419 if (udc_is_newstyle(udc))
419420 usb_gadget_udc_stop(udc->gadget, udc->driver);
420− usb_gadget_disconnect(udc->gadget);
421421 } else {
422422 dev_err(dev, "unsupported command '%s'\n", buf);
423423 return -EINVAL;
drivers/usb/gadget/uvc.h+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828
2929 struct uvc_request_data
3030 {
31− unsigned int length;
31+ __s32 length;
3232 __u8 data[60];
3333 };
3434
drivers/usb/gadget/uvc_v4l2.c+1−1
@@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data) · 38 unmodified lines
3939 if (data->length < 0)
4040 return usb_ep_set_halt(cdev->gadget->ep0);
4141
42− req->length = min(uvc->event_length, data->length);
42+ req->length = min_t(unsigned int, uvc->event_length, data->length);
4343 req->zero = data->length < uvc->event_length;
4444 req->dma = DMA_ADDR_INVALID;
4545
drivers/usb/host/ehci-pci.c+8−0
@@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd) · 143 unmodified lines
144144 hcd->has_tt = 1;
145145 tdi_reset(ehci);
146146 }
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+ }
147155 break;
148156 case PCI_VENDOR_ID_TDI:
149157 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
drivers/usb/musb/davinci.c+2−1
@@ -386,7 +386,7 @@ static int davinci_musb_init(struct musb *musb) · 385 unmodified lines
386386 usb_nop_xceiv_register();
387387 musb->xceiv = usb_get_transceiver();
388388 if (!musb->xceiv)
389− return -ENODEV;
389+ goto unregister;
390390
391391 musb->mregs += DAVINCI_BASE_OFFSET;
392392
@@ -444,6 +444,7 @@ static int davinci_musb_init(struct musb *musb) · 51 unmodified lines
444444
445445 fail:
446446 usb_put_transceiver(musb->xceiv);
447+unregister:
447448 usb_nop_xceiv_unregister();
448449 return -ENODEV;
449450 }
drivers/usb/musb/musb_core.h+1−1
@@ -449,7 +449,7 @@ struct musb { · 448 unmodified lines
449449 * We added this flag to forcefully disable double
450450 * buffering until we get it working.
451451 */
452− unsigned double_buffer_not_ok:1 __deprecated;
452+ unsigned double_buffer_not_ok:1;
453453
454454 struct musb_hdrc_config *config;
455455
drivers/usb/otg/gpio_vbus.c+14−1
@@ -96,7 +96,7 @@ static void gpio_vbus_work(struct work_struct *work) · 95 unmodified lines
9696 struct gpio_vbus_data *gpio_vbus =
9797 container_of(work, struct gpio_vbus_data, work);
9898 struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data;
99− int gpio;
99+ int gpio, status;
100100
101101 if (!gpio_vbus->phy.otg->gadget)
102102 return;
@@ -108,7 +108,9 @@ static void gpio_vbus_work(struct work_struct *work) · 5 unmodified lines
108108 */
109109 gpio = pdata->gpio_pullup;
110110 if (is_vbus_powered(pdata)) {
111+ status = USB_EVENT_VBUS;
111112 gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL;
113+ gpio_vbus->phy.last_event = status;
112114 usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget);
113115
114116 /* drawing a "unit load" is *always* OK, except for OTG */
@@ -117,6 +119,9 @@ static void gpio_vbus_work(struct work_struct *work) · 2 unmodified lines
117119 /* optionally enable D+ pullup */
118120 if (gpio_is_valid(gpio))
119121 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);
120125 } else {
121126 /* optionally disable D+ pullup */
122127 if (gpio_is_valid(gpio))
@@ -125,7 +130,12 @@ static void gpio_vbus_work(struct work_struct *work) · 2 unmodified lines
125130 set_vbus_draw(gpio_vbus, 0);
126131
127132 usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget);
133+ status = USB_EVENT_NONE;
128134 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);
129139 }
130140 }
131141
@@ -287,6 +297,9 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) · 155 unmodified lines
287297 irq, err);
288298 goto err_irq;
289299 }
300+
301+ ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier);
302+
290303 INIT_WORK(&gpio_vbus->work, gpio_vbus_work);
291304
292305 gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
include/linux/usb/hcd.h+2−0
@@ -126,6 +126,8 @@ struct usb_hcd { · 125 unmodified lines
126126 unsigned wireless:1; /* Wireless USB HCD */
127127 unsigned authorized_default:1;
128128 unsigned has_tt:1; /* Integrated TT in root hub */
129+ unsigned broken_pci_sleep:1; /* Don't put the
130+ controller in PCI-D3 for system sleep */
129131
130132 unsigned int irq; /* irq allocated */
131133 void __iomem *regs; /* device memory/io */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t