Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here are a number of small USB fixes for 4.12-rc2

Most of them come from Johan, in his valiant quest to fix up all
drivers that could be affected by "malicious" USB devices. There's
also some fixes for more "obscure" drivers to handle some of the
vmalloc stack fallout (which for USB drivers, was always the case, but
very few people actually ran those systems...)

Other than that, the normal set of xhci and gadget and musb driver
fixes as well.

All have been in linux-next with no reported issues"

* tag 'usb-4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (42 commits)
usb: musb: tusb6010_omap: Do not reset the other direction's packet size
usb: musb: Fix trying to suspend while active for OTG configurations
usb: host: xhci-plat: propagate return value of platform_get_irq()
xhci: Fix command ring stop regression in 4.11
xhci: remove GFP_DMA flag from allocation
USB: xhci: fix lock-inversion problem
usb: host: xhci-ring: don't need to clear interrupt pending for MSI enabled hcd
usb: host: xhci-mem: allocate zeroed Scratchpad Buffer
xhci: apply PME_STUCK_QUIRK and MISSING_CAS quirk for Denverton
usb: xhci: trace URB before giving it back instead of after
USB: serial: qcserial: add more Lenovo EM74xx device IDs
USB: host: xhci: use max-port define
USB: hub: fix SS max number of ports
USB: hub: fix non-SS hub-descriptor handling
USB: hub: fix SS hub-descriptor handling
USB: usbip: fix nonconforming hub descriptor
USB: gadget: dummy_hcd: fix hub-descriptor removable fields
doc-rst: fixed kernel-doc directives in usb/typec.rst
USB: core: of: document reference taken by companion helper
USB: ehci-platform: fix companion-device leak
...

+232 -126
+2 -4
Documentation/usb/typec.rst
··· 114 114 registering/unregistering cables and their plugs: 115 115 116 116 .. kernel-doc:: drivers/usb/typec/typec.c 117 - :functions: typec_register_cable typec_unregister_cable typec_register_plug 118 - typec_unregister_plug 117 + :functions: typec_register_cable typec_unregister_cable typec_register_plug typec_unregister_plug 119 118 120 119 The class will provide a handle to struct typec_cable and struct typec_plug if 121 120 the registration is successful, or NULL if it isn't. ··· 136 137 APIs to report it to the class: 137 138 138 139 .. kernel-doc:: drivers/usb/typec/typec.c 139 - :functions: typec_set_data_role typec_set_pwr_role typec_set_vconn_role 140 - typec_set_pwr_opmode 140 + :functions: typec_set_data_role typec_set_pwr_role typec_set_vconn_role typec_set_pwr_opmode 141 141 142 142 Alternate Modes 143 143 ~~~~~~~~~~~~~~~
+7 -7
drivers/usb/core/devio.c
··· 475 475 476 476 if (userurb) { /* Async */ 477 477 if (when == SUBMIT) 478 - dev_info(&udev->dev, "userurb %p, ep%d %s-%s, " 478 + dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " 479 479 "length %u\n", 480 480 userurb, ep, t, d, length); 481 481 else 482 - dev_info(&udev->dev, "userurb %p, ep%d %s-%s, " 482 + dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, " 483 483 "actual_length %u status %d\n", 484 484 userurb, ep, t, d, length, 485 485 timeout_or_status); ··· 1895 1895 if (as) { 1896 1896 int retval; 1897 1897 1898 - snoop(&ps->dev->dev, "reap %p\n", as->userurb); 1898 + snoop(&ps->dev->dev, "reap %pK\n", as->userurb); 1899 1899 retval = processcompl(as, (void __user * __user *)arg); 1900 1900 free_async(as); 1901 1901 return retval; ··· 1912 1912 1913 1913 as = async_getcompleted(ps); 1914 1914 if (as) { 1915 - snoop(&ps->dev->dev, "reap %p\n", as->userurb); 1915 + snoop(&ps->dev->dev, "reap %pK\n", as->userurb); 1916 1916 retval = processcompl(as, (void __user * __user *)arg); 1917 1917 free_async(as); 1918 1918 } else { ··· 2043 2043 if (as) { 2044 2044 int retval; 2045 2045 2046 - snoop(&ps->dev->dev, "reap %p\n", as->userurb); 2046 + snoop(&ps->dev->dev, "reap %pK\n", as->userurb); 2047 2047 retval = processcompl_compat(as, (void __user * __user *)arg); 2048 2048 free_async(as); 2049 2049 return retval; ··· 2060 2060 2061 2061 as = async_getcompleted(ps); 2062 2062 if (as) { 2063 - snoop(&ps->dev->dev, "reap %p\n", as->userurb); 2063 + snoop(&ps->dev->dev, "reap %pK\n", as->userurb); 2064 2064 retval = processcompl_compat(as, (void __user * __user *)arg); 2065 2065 free_async(as); 2066 2066 } else { ··· 2489 2489 #endif 2490 2490 2491 2491 case USBDEVFS_DISCARDURB: 2492 - snoop(&dev->dev, "%s: DISCARDURB %p\n", __func__, p); 2492 + snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p); 2493 2493 ret = proc_unlinkurb(ps, p); 2494 2494 break; 2495 2495
+3 -2
drivers/usb/core/hcd.c
··· 1723 1723 if (retval == 0) 1724 1724 retval = -EINPROGRESS; 1725 1725 else if (retval != -EIDRM && retval != -EBUSY) 1726 - dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n", 1726 + dev_dbg(&udev->dev, "hcd_unlink_urb %pK fail %d\n", 1727 1727 urb, retval); 1728 1728 usb_put_dev(udev); 1729 1729 } ··· 1890 1890 /* kick hcd */ 1891 1891 unlink1(hcd, urb, -ESHUTDOWN); 1892 1892 dev_dbg (hcd->self.controller, 1893 - "shutdown urb %p ep%d%s%s\n", 1893 + "shutdown urb %pK ep%d%s%s\n", 1894 1894 urb, usb_endpoint_num(&ep->desc), 1895 1895 is_in ? "in" : "out", 1896 1896 ({ char *s; ··· 2520 2520 hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex), 2521 2521 GFP_KERNEL); 2522 2522 if (!hcd->bandwidth_mutex) { 2523 + kfree(hcd->address0_mutex); 2523 2524 kfree(hcd); 2524 2525 dev_dbg(dev, "hcd bandwidth mutex alloc failed\n"); 2525 2526 return NULL;
+21 -6
drivers/usb/core/hub.c
··· 362 362 } 363 363 364 364 /* USB 2.0 spec Section 11.24.4.5 */ 365 - static int get_hub_descriptor(struct usb_device *hdev, void *data) 365 + static int get_hub_descriptor(struct usb_device *hdev, 366 + struct usb_hub_descriptor *desc) 366 367 { 367 368 int i, ret, size; 368 369 unsigned dtype; ··· 379 378 for (i = 0; i < 3; i++) { 380 379 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), 381 380 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB, 382 - dtype << 8, 0, data, size, 381 + dtype << 8, 0, desc, size, 383 382 USB_CTRL_GET_TIMEOUT); 384 - if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2)) 383 + if (hub_is_superspeed(hdev)) { 384 + if (ret == size) 385 + return ret; 386 + } else if (ret >= USB_DT_HUB_NONVAR_SIZE + 2) { 387 + /* Make sure we have the DeviceRemovable field. */ 388 + size = USB_DT_HUB_NONVAR_SIZE + desc->bNbrPorts / 8 + 1; 389 + if (ret < size) 390 + return -EMSGSIZE; 385 391 return ret; 392 + } 386 393 } 387 394 return -EINVAL; 388 395 } ··· 1322 1313 } 1323 1314 mutex_init(&hub->status_mutex); 1324 1315 1325 - hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL); 1316 + hub->descriptor = kzalloc(sizeof(*hub->descriptor), GFP_KERNEL); 1326 1317 if (!hub->descriptor) { 1327 1318 ret = -ENOMEM; 1328 1319 goto fail; ··· 1330 1321 1331 1322 /* Request the entire hub descriptor. 1332 1323 * hub->descriptor can handle USB_MAXCHILDREN ports, 1333 - * but the hub can/will return fewer bytes here. 1324 + * but a (non-SS) hub can/will return fewer bytes here. 1334 1325 */ 1335 1326 ret = get_hub_descriptor(hdev, hub->descriptor); 1336 1327 if (ret < 0) { 1337 1328 message = "can't read hub descriptor"; 1338 1329 goto fail; 1339 - } else if (hub->descriptor->bNbrPorts > USB_MAXCHILDREN) { 1330 + } 1331 + 1332 + maxchild = USB_MAXCHILDREN; 1333 + if (hub_is_superspeed(hdev)) 1334 + maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS); 1335 + 1336 + if (hub->descriptor->bNbrPorts > maxchild) { 1340 1337 message = "hub has too many ports!"; 1341 1338 ret = -ENODEV; 1342 1339 goto fail;
+3
drivers/usb/core/of.c
··· 53 53 * 54 54 * Find the companion device from platform bus. 55 55 * 56 + * Takes a reference to the returned struct device which needs to be dropped 57 + * after use. 58 + * 56 59 * Return: On success, a pointer to the companion device, %NULL on failure. 57 60 */ 58 61 struct device *usb_of_get_companion_dev(struct device *dev)
+1 -1
drivers/usb/core/urb.c
··· 338 338 if (!urb || !urb->complete) 339 339 return -EINVAL; 340 340 if (urb->hcpriv) { 341 - WARN_ONCE(1, "URB %p submitted while active\n", urb); 341 + WARN_ONCE(1, "URB %pK submitted while active\n", urb); 342 342 return -EBUSY; 343 343 } 344 344
+4
drivers/usb/dwc3/dwc3-keystone.c
··· 107 107 return PTR_ERR(kdwc->usbss); 108 108 109 109 kdwc->clk = devm_clk_get(kdwc->dev, "usb"); 110 + if (IS_ERR(kdwc->clk)) { 111 + dev_err(kdwc->dev, "unable to get usb clock\n"); 112 + return PTR_ERR(kdwc->clk); 113 + } 110 114 111 115 error = clk_prepare_enable(kdwc->clk); 112 116 if (error < 0) {
+4
drivers/usb/dwc3/dwc3-pci.c
··· 39 39 #define PCI_DEVICE_ID_INTEL_APL 0x5aaa 40 40 #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 41 41 #define PCI_DEVICE_ID_INTEL_GLK 0x31aa 42 + #define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee 43 + #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e 42 44 43 45 #define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" 44 46 #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 ··· 272 270 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, 273 271 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, 274 272 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), }, 273 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPLP), }, 274 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPH), }, 275 275 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, 276 276 { } /* Terminating Entry */ 277 277 };
+20 -1
drivers/usb/dwc3/gadget.c
··· 1261 1261 __dwc3_gadget_start_isoc(dwc, dep, cur_uf); 1262 1262 dep->flags &= ~DWC3_EP_PENDING_REQUEST; 1263 1263 } 1264 + return 0; 1264 1265 } 1265 - return 0; 1266 + 1267 + if ((dep->flags & DWC3_EP_BUSY) && 1268 + !(dep->flags & DWC3_EP_MISSED_ISOC)) { 1269 + WARN_ON_ONCE(!dep->resource_index); 1270 + ret = __dwc3_gadget_kick_transfer(dep, 1271 + dep->resource_index); 1272 + } 1273 + 1274 + goto out; 1266 1275 } 1267 1276 1268 1277 if (!dwc3_calc_trbs_left(dep)) 1269 1278 return 0; 1270 1279 1271 1280 ret = __dwc3_gadget_kick_transfer(dep, 0); 1281 + out: 1272 1282 if (ret == -EBUSY) 1273 1283 ret = 0; 1274 1284 ··· 3035 3025 dwc->pending_events = true; 3036 3026 return IRQ_HANDLED; 3037 3027 } 3028 + 3029 + /* 3030 + * With PCIe legacy interrupt, test shows that top-half irq handler can 3031 + * be called again after HW interrupt deassertion. Check if bottom-half 3032 + * irq event handler completes before caching new event to prevent 3033 + * losing events. 3034 + */ 3035 + if (evt->flags & DWC3_EVENT_PENDING) 3036 + return IRQ_HANDLED; 3038 3037 3039 3038 count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); 3040 3039 count &= DWC3_GEVNTCOUNT_MASK;
+5 -5
drivers/usb/gadget/function/f_fs.c
··· 1858 1858 ep->ep->driver_data = ep; 1859 1859 ep->ep->desc = ds; 1860 1860 1861 - comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds + 1862 - USB_DT_ENDPOINT_SIZE); 1863 - ep->ep->maxburst = comp_desc->bMaxBurst + 1; 1864 - 1865 - if (needs_comp_desc) 1861 + if (needs_comp_desc) { 1862 + comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds + 1863 + USB_DT_ENDPOINT_SIZE); 1864 + ep->ep->maxburst = comp_desc->bMaxBurst + 1; 1866 1865 ep->ep->comp_desc = comp_desc; 1866 + } 1867 1867 1868 1868 ret = usb_ep_enable(ep->ep); 1869 1869 if (likely(!ret)) {
+1 -1
drivers/usb/gadget/function/u_serial.c
··· 1256 1256 struct gscons_info *info = &gscons_info; 1257 1257 1258 1258 unregister_console(&gserial_cons); 1259 - if (info->console_thread != NULL) 1259 + if (!IS_ERR_OR_NULL(info->console_thread)) 1260 1260 kthread_stop(info->console_thread); 1261 1261 gs_buf_free(&info->con_buf); 1262 1262 }
+3 -3
drivers/usb/gadget/udc/dummy_hcd.c
··· 2008 2008 HUB_CHAR_COMMON_OCPM); 2009 2009 desc->bNbrPorts = 1; 2010 2010 desc->u.ss.bHubHdrDecLat = 0x04; /* Worst case: 0.4 micro sec*/ 2011 - desc->u.ss.DeviceRemovable = 0xffff; 2011 + desc->u.ss.DeviceRemovable = 0; 2012 2012 } 2013 2013 2014 2014 static inline void hub_descriptor(struct usb_hub_descriptor *desc) ··· 2020 2020 HUB_CHAR_INDV_PORT_LPSM | 2021 2021 HUB_CHAR_COMMON_OCPM); 2022 2022 desc->bNbrPorts = 1; 2023 - desc->u.hs.DeviceRemovable[0] = 0xff; 2024 - desc->u.hs.DeviceRemovable[1] = 0xff; 2023 + desc->u.hs.DeviceRemovable[0] = 0; 2024 + desc->u.hs.DeviceRemovable[1] = 0xff; /* PortPwrCtrlMask */ 2025 2025 } 2026 2026 2027 2027 static int dummy_hub_control(
+3 -1
drivers/usb/host/ehci-platform.c
··· 384 384 } 385 385 386 386 companion_dev = usb_of_get_companion_dev(hcd->self.controller); 387 - if (companion_dev) 387 + if (companion_dev) { 388 388 device_pm_wait_for_dev(hcd->self.controller, companion_dev); 389 + put_device(companion_dev); 390 + } 389 391 390 392 ehci_resume(hcd, priv->reset_on_resume); 391 393 return 0;
+4 -2
drivers/usb/host/r8a66597-hcd.c
··· 1269 1269 time = 30; 1270 1270 break; 1271 1271 default: 1272 - time = 300; 1272 + time = 50; 1273 1273 break; 1274 1274 } 1275 1275 ··· 1785 1785 pipe = td->pipe; 1786 1786 pipe_stop(r8a66597, pipe); 1787 1787 1788 + /* Select a different address or endpoint */ 1788 1789 new_td = td; 1789 1790 do { 1790 1791 list_move_tail(&new_td->queue, ··· 1795 1794 new_td = td; 1796 1795 break; 1797 1796 } 1798 - } while (td != new_td && td->address == new_td->address); 1797 + } while (td != new_td && td->address == new_td->address && 1798 + td->pipe->info.epnum == new_td->pipe->info.epnum); 1799 1799 1800 1800 start_transfer(r8a66597, new_td); 1801 1801
+1 -1
drivers/usb/host/xhci-hub.c
··· 419 419 wait_for_completion(cmd->completion); 420 420 421 421 if (cmd->status == COMP_COMMAND_ABORTED || 422 - cmd->status == COMP_STOPPED) { 422 + cmd->status == COMP_COMMAND_RING_STOPPED) { 423 423 xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); 424 424 ret = -ETIME; 425 425 }
+6 -5
drivers/usb/host/xhci-mem.c
··· 56 56 } 57 57 58 58 if (max_packet) { 59 - seg->bounce_buf = kzalloc(max_packet, flags | GFP_DMA); 59 + seg->bounce_buf = kzalloc(max_packet, flags); 60 60 if (!seg->bounce_buf) { 61 61 dma_pool_free(xhci->segment_pool, seg->trbs, dma); 62 62 kfree(seg); ··· 1724 1724 xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); 1725 1725 for (i = 0; i < num_sp; i++) { 1726 1726 dma_addr_t dma; 1727 - void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma, 1727 + void *buf = dma_zalloc_coherent(dev, xhci->page_size, &dma, 1728 1728 flags); 1729 1729 if (!buf) 1730 1730 goto fail_sp4; ··· 2307 2307 /* Place limits on the number of roothub ports so that the hub 2308 2308 * descriptors aren't longer than the USB core will allocate. 2309 2309 */ 2310 - if (xhci->num_usb3_ports > 15) { 2310 + if (xhci->num_usb3_ports > USB_SS_MAXPORTS) { 2311 2311 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 2312 - "Limiting USB 3.0 roothub ports to 15."); 2313 - xhci->num_usb3_ports = 15; 2312 + "Limiting USB 3.0 roothub ports to %u.", 2313 + USB_SS_MAXPORTS); 2314 + xhci->num_usb3_ports = USB_SS_MAXPORTS; 2314 2315 } 2315 2316 if (xhci->num_usb2_ports > USB_MAXCHILDREN) { 2316 2317 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
+5 -2
drivers/usb/host/xhci-pci.c
··· 52 52 #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 53 53 #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 54 54 #define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8 55 + #define PCI_DEVICE_ID_INTEL_DNV_XHCI 0x19d0 55 56 56 57 static const char hcd_name[] = "xhci_hcd"; 57 58 ··· 167 166 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || 168 167 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || 169 168 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || 170 - pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) { 169 + pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || 170 + pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) { 171 171 xhci->quirks |= XHCI_PME_STUCK_QUIRK; 172 172 } 173 173 if (pdev->vendor == PCI_VENDOR_ID_INTEL && ··· 177 175 } 178 176 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 179 177 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || 180 - pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) 178 + pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || 179 + pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) 181 180 xhci->quirks |= XHCI_MISSING_CAS; 182 181 183 182 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
+1 -1
drivers/usb/host/xhci-plat.c
··· 177 177 178 178 irq = platform_get_irq(pdev, 0); 179 179 if (irq < 0) 180 - return -ENODEV; 180 + return irq; 181 181 182 182 /* 183 183 * sysdev must point to a device that is known to the system firmware
+9 -11
drivers/usb/host/xhci-ring.c
··· 323 323 if (i_cmd->status != COMP_COMMAND_ABORTED) 324 324 continue; 325 325 326 - i_cmd->status = COMP_STOPPED; 326 + i_cmd->status = COMP_COMMAND_RING_STOPPED; 327 327 328 328 xhci_dbg(xhci, "Turn aborted command %p to no-op\n", 329 329 i_cmd->command_trb); ··· 641 641 xhci_urb_free_priv(urb_priv); 642 642 usb_hcd_unlink_urb_from_ep(hcd, urb); 643 643 spin_unlock(&xhci->lock); 644 - usb_hcd_giveback_urb(hcd, urb, status); 645 644 trace_xhci_urb_giveback(urb); 645 + usb_hcd_giveback_urb(hcd, urb, status); 646 646 spin_lock(&xhci->lock); 647 647 } 648 648 ··· 1380 1380 cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); 1381 1381 1382 1382 /* If CMD ring stopped we own the trbs between enqueue and dequeue */ 1383 - if (cmd_comp_code == COMP_STOPPED) { 1383 + if (cmd_comp_code == COMP_COMMAND_RING_STOPPED) { 1384 1384 complete_all(&xhci->cmd_ring_stop_completion); 1385 1385 return; 1386 1386 } ··· 1436 1436 break; 1437 1437 case TRB_CMD_NOOP: 1438 1438 /* Is this an aborted command turned to NO-OP? */ 1439 - if (cmd->status == COMP_STOPPED) 1440 - cmd_comp_code = COMP_STOPPED; 1439 + if (cmd->status == COMP_COMMAND_RING_STOPPED) 1440 + cmd_comp_code = COMP_COMMAND_RING_STOPPED; 1441 1441 break; 1442 1442 case TRB_RESET_EP: 1443 1443 WARN_ON(slot_id != TRB_TO_SLOT_ID( ··· 2677 2677 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 2678 2678 union xhci_trb *event_ring_deq; 2679 2679 irqreturn_t ret = IRQ_NONE; 2680 + unsigned long flags; 2680 2681 dma_addr_t deq; 2681 2682 u64 temp_64; 2682 2683 u32 status; 2683 2684 2684 - spin_lock(&xhci->lock); 2685 + spin_lock_irqsave(&xhci->lock, flags); 2685 2686 /* Check if the xHC generated the interrupt, or the irq is shared */ 2686 2687 status = readl(&xhci->op_regs->status); 2687 2688 if (status == ~(u32)0) { ··· 2708 2707 */ 2709 2708 status |= STS_EINT; 2710 2709 writel(status, &xhci->op_regs->status); 2711 - /* FIXME when MSI-X is supported and there are multiple vectors */ 2712 - /* Clear the MSI-X event interrupt status */ 2713 2710 2714 - if (hcd->irq) { 2711 + if (!hcd->msi_enabled) { 2715 2712 u32 irq_pending; 2716 - /* Acknowledge the PCI interrupt */ 2717 2713 irq_pending = readl(&xhci->ir_set->irq_pending); 2718 2714 irq_pending |= IMAN_IP; 2719 2715 writel(irq_pending, &xhci->ir_set->irq_pending); ··· 2755 2757 ret = IRQ_HANDLED; 2756 2758 2757 2759 out: 2758 - spin_unlock(&xhci->lock); 2760 + spin_unlock_irqrestore(&xhci->lock, flags); 2759 2761 2760 2762 return ret; 2761 2763 }
+7 -6
drivers/usb/host/xhci.c
··· 359 359 /* fall back to msi*/ 360 360 ret = xhci_setup_msi(xhci); 361 361 362 - if (!ret) 363 - /* hcd->irq is 0, we have MSI */ 362 + if (!ret) { 363 + hcd->msi_enabled = 1; 364 364 return 0; 365 + } 365 366 366 367 if (!pdev->irq) { 367 368 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n"); ··· 1764 1763 1765 1764 switch (*cmd_status) { 1766 1765 case COMP_COMMAND_ABORTED: 1767 - case COMP_STOPPED: 1766 + case COMP_COMMAND_RING_STOPPED: 1768 1767 xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n"); 1769 1768 ret = -ETIME; 1770 1769 break; ··· 1814 1813 1815 1814 switch (*cmd_status) { 1816 1815 case COMP_COMMAND_ABORTED: 1817 - case COMP_STOPPED: 1816 + case COMP_COMMAND_RING_STOPPED: 1818 1817 xhci_warn(xhci, "Timeout while waiting for evaluate context command\n"); 1819 1818 ret = -ETIME; 1820 1819 break; ··· 3433 3432 ret = reset_device_cmd->status; 3434 3433 switch (ret) { 3435 3434 case COMP_COMMAND_ABORTED: 3436 - case COMP_STOPPED: 3435 + case COMP_COMMAND_RING_STOPPED: 3437 3436 xhci_warn(xhci, "Timeout waiting for reset device command\n"); 3438 3437 ret = -ETIME; 3439 3438 goto command_cleanup; ··· 3818 3817 */ 3819 3818 switch (command->status) { 3820 3819 case COMP_COMMAND_ABORTED: 3821 - case COMP_STOPPED: 3820 + case COMP_COMMAND_RING_STOPPED: 3822 3821 xhci_warn(xhci, "Timeout while waiting for setup device command\n"); 3823 3822 ret = -ETIME; 3824 3823 break;
+1 -1
drivers/usb/misc/chaoskey.c
··· 192 192 193 193 dev->in_ep = in_ep; 194 194 195 - if (udev->descriptor.idVendor != ALEA_VENDOR_ID) 195 + if (le16_to_cpu(udev->descriptor.idVendor) != ALEA_VENDOR_ID) 196 196 dev->reads_started = 1; 197 197 198 198 dev->size = size;
+1 -1
drivers/usb/misc/iowarrior.c
··· 554 554 info.revision = le16_to_cpu(dev->udev->descriptor.bcdDevice); 555 555 556 556 /* 0==UNKNOWN, 1==LOW(usb1.1) ,2=FULL(usb1.1), 3=HIGH(usb2.0) */ 557 - info.speed = le16_to_cpu(dev->udev->speed); 557 + info.speed = dev->udev->speed; 558 558 info.if_num = dev->interface->cur_altsetting->desc.bInterfaceNumber; 559 559 info.report_size = dev->report_size; 560 560
+1
drivers/usb/misc/legousbtower.c
··· 926 926 USB_MAJOR, dev->minor); 927 927 928 928 exit: 929 + kfree(get_version_reply); 929 930 return retval; 930 931 931 932 error:
+1 -1
drivers/usb/misc/sisusbvga/sisusb_con.c
··· 973 973 974 974 mutex_unlock(&sisusb->lock); 975 975 976 - return 1; 976 + return true; 977 977 } 978 978 979 979 /* Interface routine */
+5 -4
drivers/usb/musb/musb_host.c
··· 2780 2780 int ret; 2781 2781 struct usb_hcd *hcd = musb->hcd; 2782 2782 2783 - MUSB_HST_MODE(musb); 2784 - musb->xceiv->otg->default_a = 1; 2785 - musb->xceiv->otg->state = OTG_STATE_A_IDLE; 2786 - 2783 + if (musb->port_mode == MUSB_PORT_MODE_HOST) { 2784 + MUSB_HST_MODE(musb); 2785 + musb->xceiv->otg->default_a = 1; 2786 + musb->xceiv->otg->state = OTG_STATE_A_IDLE; 2787 + } 2787 2788 otg_set_host(musb->xceiv->otg, &hcd->self); 2788 2789 hcd->self.otg_port = 1; 2789 2790 musb->xceiv->otg->host = &hcd->self;
+9 -4
drivers/usb/musb/tusb6010_omap.c
··· 219 219 u32 dma_remaining; 220 220 int src_burst, dst_burst; 221 221 u16 csr; 222 + u32 psize; 222 223 int ch; 223 224 s8 dmareq; 224 225 s8 sync_dev; ··· 391 390 392 391 if (chdat->tx) { 393 392 /* Send transfer_packet_sz packets at a time */ 394 - musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, 395 - chdat->transfer_packet_sz); 393 + psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET); 394 + psize &= ~0x7ff; 395 + psize |= chdat->transfer_packet_sz; 396 + musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize); 396 397 397 398 musb_writel(ep_conf, TUSB_EP_TX_OFFSET, 398 399 TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len)); 399 400 } else { 400 401 /* Receive transfer_packet_sz packets at a time */ 401 - musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, 402 - chdat->transfer_packet_sz << 16); 402 + psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET); 403 + psize &= ~(0x7ff << 16); 404 + psize |= (chdat->transfer_packet_sz << 16); 405 + musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET, psize); 403 406 404 407 musb_writel(ep_conf, TUSB_EP_RX_OFFSET, 405 408 TUSB_EP_CONFIG_XFR_SIZE(chdat->transfer_len));
+5 -5
drivers/usb/serial/ftdi_sio.c
··· 809 809 { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, 810 810 { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), 811 811 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 812 - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), 813 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 814 - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), 815 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 812 + { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID, 1) }, 813 + { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID, 1) }, 814 + { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_PID, 1) }, 815 + { USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_H_PID, 1) }, 816 816 { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), 817 817 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 818 818 { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), ··· 1527 1527 (new_serial.flags & ASYNC_FLAGS)); 1528 1528 priv->custom_divisor = new_serial.custom_divisor; 1529 1529 1530 + check_and_exit: 1530 1531 write_latency_timer(port); 1531 1532 1532 - check_and_exit: 1533 1533 if ((old_priv.flags & ASYNC_SPD_MASK) != 1534 1534 (priv->flags & ASYNC_SPD_MASK)) { 1535 1535 if ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
+2
drivers/usb/serial/ftdi_sio_ids.h
··· 882 882 /* Olimex */ 883 883 #define OLIMEX_VID 0x15BA 884 884 #define OLIMEX_ARM_USB_OCD_PID 0x0003 885 + #define OLIMEX_ARM_USB_TINY_PID 0x0004 886 + #define OLIMEX_ARM_USB_TINY_H_PID 0x002a 885 887 #define OLIMEX_ARM_USB_OCD_H_PID 0x002b 886 888 887 889 /*
+4 -1
drivers/usb/serial/io_ti.c
··· 2336 2336 if (!baud) { 2337 2337 /* pick a default, any default... */ 2338 2338 baud = 9600; 2339 - } else 2339 + } else { 2340 + /* Avoid a zero divisor. */ 2341 + baud = min(baud, 461550); 2340 2342 tty_encode_baud_rate(tty, baud, baud); 2343 + } 2341 2344 2342 2345 edge_port->baud_rate = baud; 2343 2346 config->wBaudRate = (__u16)((461550L + baud/2) / baud);
+12 -9
drivers/usb/serial/ir-usb.c
··· 197 197 static int ir_startup(struct usb_serial *serial) 198 198 { 199 199 struct usb_irda_cs_descriptor *irda_desc; 200 + int rates; 200 201 201 202 irda_desc = irda_usb_find_class_desc(serial, 0); 202 203 if (!irda_desc) { ··· 206 205 return -ENODEV; 207 206 } 208 207 208 + rates = le16_to_cpu(irda_desc->wBaudRate); 209 + 209 210 dev_dbg(&serial->dev->dev, 210 211 "%s - Baud rates supported:%s%s%s%s%s%s%s%s%s\n", 211 212 __func__, 212 - (irda_desc->wBaudRate & USB_IRDA_BR_2400) ? " 2400" : "", 213 - (irda_desc->wBaudRate & USB_IRDA_BR_9600) ? " 9600" : "", 214 - (irda_desc->wBaudRate & USB_IRDA_BR_19200) ? " 19200" : "", 215 - (irda_desc->wBaudRate & USB_IRDA_BR_38400) ? " 38400" : "", 216 - (irda_desc->wBaudRate & USB_IRDA_BR_57600) ? " 57600" : "", 217 - (irda_desc->wBaudRate & USB_IRDA_BR_115200) ? " 115200" : "", 218 - (irda_desc->wBaudRate & USB_IRDA_BR_576000) ? " 576000" : "", 219 - (irda_desc->wBaudRate & USB_IRDA_BR_1152000) ? " 1152000" : "", 220 - (irda_desc->wBaudRate & USB_IRDA_BR_4000000) ? " 4000000" : ""); 213 + (rates & USB_IRDA_BR_2400) ? " 2400" : "", 214 + (rates & USB_IRDA_BR_9600) ? " 9600" : "", 215 + (rates & USB_IRDA_BR_19200) ? " 19200" : "", 216 + (rates & USB_IRDA_BR_38400) ? " 38400" : "", 217 + (rates & USB_IRDA_BR_57600) ? " 57600" : "", 218 + (rates & USB_IRDA_BR_115200) ? " 115200" : "", 219 + (rates & USB_IRDA_BR_576000) ? " 576000" : "", 220 + (rates & USB_IRDA_BR_1152000) ? " 1152000" : "", 221 + (rates & USB_IRDA_BR_4000000) ? " 4000000" : ""); 221 222 222 223 switch (irda_desc->bmAdditionalBOFs) { 223 224 case USB_IRDA_AB_48:
+1 -1
drivers/usb/serial/mct_u232.c
··· 189 189 return -ENOMEM; 190 190 191 191 divisor = mct_u232_calculate_baud_rate(serial, value, &speed); 192 - put_unaligned_le32(cpu_to_le32(divisor), buf); 192 + put_unaligned_le32(divisor, buf); 193 193 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 194 194 MCT_U232_SET_BAUD_RATE_REQUEST, 195 195 MCT_U232_SET_REQUEST_TYPE,
+8
drivers/usb/serial/option.c
··· 281 281 #define TELIT_PRODUCT_LE922_USBCFG0 0x1042 282 282 #define TELIT_PRODUCT_LE922_USBCFG3 0x1043 283 283 #define TELIT_PRODUCT_LE922_USBCFG5 0x1045 284 + #define TELIT_PRODUCT_ME910 0x1100 284 285 #define TELIT_PRODUCT_LE920 0x1200 285 286 #define TELIT_PRODUCT_LE910 0x1201 286 287 #define TELIT_PRODUCT_LE910_USBCFG4 0x1206 ··· 639 638 640 639 static const struct option_blacklist_info simcom_sim7100e_blacklist = { 641 640 .reserved = BIT(5) | BIT(6), 641 + }; 642 + 643 + static const struct option_blacklist_info telit_me910_blacklist = { 644 + .sendsetup = BIT(0), 645 + .reserved = BIT(1) | BIT(3), 642 646 }; 643 647 644 648 static const struct option_blacklist_info telit_le910_blacklist = { ··· 1241 1235 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, 1242 1236 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff), 1243 1237 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, 1238 + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), 1239 + .driver_info = (kernel_ulong_t)&telit_me910_blacklist }, 1244 1240 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), 1245 1241 .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, 1246 1242 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
+2
drivers/usb/serial/qcserial.c
··· 162 162 {DEVICE_SWI(0x1199, 0x9071)}, /* Sierra Wireless MC74xx */ 163 163 {DEVICE_SWI(0x1199, 0x9078)}, /* Sierra Wireless EM74xx */ 164 164 {DEVICE_SWI(0x1199, 0x9079)}, /* Sierra Wireless EM74xx */ 165 + {DEVICE_SWI(0x1199, 0x907a)}, /* Sierra Wireless EM74xx QDL */ 166 + {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ 165 167 {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ 166 168 {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ 167 169 {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
+55 -35
drivers/usb/storage/ene_ub6250.c
··· 446 446 #define SD_BLOCK_LEN 9 447 447 448 448 struct ene_ub6250_info { 449 + 450 + /* I/O bounce buffer */ 451 + u8 *bbuf; 452 + 449 453 /* for 6250 code */ 450 454 struct SD_STATUS SD_Status; 451 455 struct MS_STATUS MS_Status; ··· 497 493 498 494 static void ene_ub6250_info_destructor(void *extra) 499 495 { 496 + struct ene_ub6250_info *info = (struct ene_ub6250_info *) extra; 497 + 500 498 if (!extra) 501 499 return; 500 + kfree(info->bbuf); 502 501 } 503 502 504 503 static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg) ··· 867 860 u8 PageNum, u32 *PageBuf, struct ms_lib_type_extdat *ExtraDat) 868 861 { 869 862 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; 863 + struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; 864 + u8 *bbuf = info->bbuf; 870 865 int result; 871 - u8 ExtBuf[4]; 872 866 u32 bn = PhyBlockAddr * 0x20 + PageNum; 873 867 874 868 result = ene_load_bincode(us, MS_RW_PATTERN); ··· 909 901 bcb->CDB[2] = (unsigned char)(PhyBlockAddr>>16); 910 902 bcb->CDB[6] = 0x01; 911 903 912 - result = ene_send_scsi_cmd(us, FDIR_READ, &ExtBuf, 0); 904 + result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); 913 905 if (result != USB_STOR_XFER_GOOD) 914 906 return USB_STOR_TRANSPORT_ERROR; 915 907 ··· 918 910 ExtraDat->status0 = 0x10; /* Not yet,fireware support */ 919 911 920 912 ExtraDat->status1 = 0x00; /* Not yet,fireware support */ 921 - ExtraDat->ovrflg = ExtBuf[0]; 922 - ExtraDat->mngflg = ExtBuf[1]; 923 - ExtraDat->logadr = memstick_logaddr(ExtBuf[2], ExtBuf[3]); 913 + ExtraDat->ovrflg = bbuf[0]; 914 + ExtraDat->mngflg = bbuf[1]; 915 + ExtraDat->logadr = memstick_logaddr(bbuf[2], bbuf[3]); 924 916 925 917 return USB_STOR_TRANSPORT_GOOD; 926 918 } ··· 1340 1332 u8 PageNum, struct ms_lib_type_extdat *ExtraDat) 1341 1333 { 1342 1334 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; 1335 + struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; 1336 + u8 *bbuf = info->bbuf; 1343 1337 int result; 1344 - u8 ExtBuf[4]; 1345 1338 1346 1339 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1347 1340 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); ··· 1356 1347 bcb->CDB[2] = (unsigned char)(PhyBlock>>16); 1357 1348 bcb->CDB[6] = 0x01; 1358 1349 1359 - result = ene_send_scsi_cmd(us, FDIR_READ, &ExtBuf, 0); 1350 + result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); 1360 1351 if (result != USB_STOR_XFER_GOOD) 1361 1352 return USB_STOR_TRANSPORT_ERROR; 1362 1353 ··· 1364 1355 ExtraDat->intr = 0x80; /* Not yet, waiting for fireware support */ 1365 1356 ExtraDat->status0 = 0x10; /* Not yet, waiting for fireware support */ 1366 1357 ExtraDat->status1 = 0x00; /* Not yet, waiting for fireware support */ 1367 - ExtraDat->ovrflg = ExtBuf[0]; 1368 - ExtraDat->mngflg = ExtBuf[1]; 1369 - ExtraDat->logadr = memstick_logaddr(ExtBuf[2], ExtBuf[3]); 1358 + ExtraDat->ovrflg = bbuf[0]; 1359 + ExtraDat->mngflg = bbuf[1]; 1360 + ExtraDat->logadr = memstick_logaddr(bbuf[2], bbuf[3]); 1370 1361 1371 1362 return USB_STOR_TRANSPORT_GOOD; 1372 1363 } ··· 1565 1556 u16 PhyBlock, newblk, i; 1566 1557 u16 LogStart, LogEnde; 1567 1558 struct ms_lib_type_extdat extdat; 1568 - u8 buf[0x200]; 1569 1559 u32 count = 0, index = 0; 1570 1560 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; 1561 + u8 *bbuf = info->bbuf; 1571 1562 1572 1563 for (PhyBlock = 0; PhyBlock < info->MS_Lib.NumberOfPhyBlock;) { 1573 1564 ms_lib_phy_to_log_range(PhyBlock, &LogStart, &LogEnde); ··· 1581 1572 } 1582 1573 1583 1574 if (count == PhyBlock) { 1584 - ms_lib_read_extrablock(us, PhyBlock, 0, 0x80, &buf); 1575 + ms_lib_read_extrablock(us, PhyBlock, 0, 0x80, 1576 + bbuf); 1585 1577 count += 0x80; 1586 1578 } 1587 1579 index = (PhyBlock % 0x80) * 4; 1588 1580 1589 - extdat.ovrflg = buf[index]; 1590 - extdat.mngflg = buf[index+1]; 1591 - extdat.logadr = memstick_logaddr(buf[index+2], buf[index+3]); 1581 + extdat.ovrflg = bbuf[index]; 1582 + extdat.mngflg = bbuf[index+1]; 1583 + extdat.logadr = memstick_logaddr(bbuf[index+2], 1584 + bbuf[index+3]); 1592 1585 1593 1586 if ((extdat.ovrflg & MS_REG_OVR_BKST) != MS_REG_OVR_BKST_OK) { 1594 1587 ms_lib_setacquired_errorblock(us, PhyBlock); ··· 2073 2062 { 2074 2063 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; 2075 2064 int result; 2076 - u8 buf[0x200]; 2077 2065 u16 MSP_BlockSize, MSP_UserAreaBlocks; 2078 2066 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; 2067 + u8 *bbuf = info->bbuf; 2079 2068 2080 2069 printk(KERN_INFO "transport --- ENE_MSInit\n"); 2081 2070 ··· 2094 2083 bcb->CDB[0] = 0xF1; 2095 2084 bcb->CDB[1] = 0x01; 2096 2085 2097 - result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0); 2086 + result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); 2098 2087 if (result != USB_STOR_XFER_GOOD) { 2099 2088 printk(KERN_ERR "Execution MS Init Code Fail !!\n"); 2100 2089 return USB_STOR_TRANSPORT_ERROR; 2101 2090 } 2102 2091 /* the same part to test ENE */ 2103 - info->MS_Status = *(struct MS_STATUS *)&buf[0]; 2092 + info->MS_Status = *(struct MS_STATUS *) bbuf; 2104 2093 2105 2094 if (info->MS_Status.Insert && info->MS_Status.Ready) { 2106 2095 printk(KERN_INFO "Insert = %x\n", info->MS_Status.Insert); ··· 2109 2098 printk(KERN_INFO "IsMSPHG = %x\n", info->MS_Status.IsMSPHG); 2110 2099 printk(KERN_INFO "WtP= %x\n", info->MS_Status.WtP); 2111 2100 if (info->MS_Status.IsMSPro) { 2112 - MSP_BlockSize = (buf[6] << 8) | buf[7]; 2113 - MSP_UserAreaBlocks = (buf[10] << 8) | buf[11]; 2101 + MSP_BlockSize = (bbuf[6] << 8) | bbuf[7]; 2102 + MSP_UserAreaBlocks = (bbuf[10] << 8) | bbuf[11]; 2114 2103 info->MSP_TotalBlock = MSP_BlockSize * MSP_UserAreaBlocks; 2115 2104 } else { 2116 2105 ms_card_init(us); /* Card is MS (to ms.c)*/ 2117 2106 } 2118 2107 usb_stor_dbg(us, "MS Init Code OK !!\n"); 2119 2108 } else { 2120 - usb_stor_dbg(us, "MS Card Not Ready --- %x\n", buf[0]); 2109 + usb_stor_dbg(us, "MS Card Not Ready --- %x\n", bbuf[0]); 2121 2110 return USB_STOR_TRANSPORT_ERROR; 2122 2111 } 2123 2112 ··· 2127 2116 static int ene_sd_init(struct us_data *us) 2128 2117 { 2129 2118 int result; 2130 - u8 buf[0x200]; 2131 2119 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; 2132 2120 struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; 2121 + u8 *bbuf = info->bbuf; 2133 2122 2134 2123 usb_stor_dbg(us, "transport --- ENE_SDInit\n"); 2135 2124 /* SD Init Part-1 */ ··· 2163 2152 bcb->Flags = US_BULK_FLAG_IN; 2164 2153 bcb->CDB[0] = 0xF1; 2165 2154 2166 - result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0); 2155 + result = ene_send_scsi_cmd(us, FDIR_READ, bbuf, 0); 2167 2156 if (result != USB_STOR_XFER_GOOD) { 2168 2157 usb_stor_dbg(us, "Execution SD Init Code Fail !!\n"); 2169 2158 return USB_STOR_TRANSPORT_ERROR; 2170 2159 } 2171 2160 2172 - info->SD_Status = *(struct SD_STATUS *)&buf[0]; 2161 + info->SD_Status = *(struct SD_STATUS *) bbuf; 2173 2162 if (info->SD_Status.Insert && info->SD_Status.Ready) { 2174 2163 struct SD_STATUS *s = &info->SD_Status; 2175 2164 2176 - ene_get_card_status(us, (unsigned char *)&buf); 2165 + ene_get_card_status(us, bbuf); 2177 2166 usb_stor_dbg(us, "Insert = %x\n", s->Insert); 2178 2167 usb_stor_dbg(us, "Ready = %x\n", s->Ready); 2179 2168 usb_stor_dbg(us, "IsMMC = %x\n", s->IsMMC); ··· 2181 2170 usb_stor_dbg(us, "HiSpeed = %x\n", s->HiSpeed); 2182 2171 usb_stor_dbg(us, "WtP = %x\n", s->WtP); 2183 2172 } else { 2184 - usb_stor_dbg(us, "SD Card Not Ready --- %x\n", buf[0]); 2173 + usb_stor_dbg(us, "SD Card Not Ready --- %x\n", bbuf[0]); 2185 2174 return USB_STOR_TRANSPORT_ERROR; 2186 2175 } 2187 2176 return USB_STOR_TRANSPORT_GOOD; ··· 2191 2180 static int ene_init(struct us_data *us) 2192 2181 { 2193 2182 int result; 2194 - u8 misc_reg03 = 0; 2183 + u8 misc_reg03; 2195 2184 struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); 2185 + u8 *bbuf = info->bbuf; 2196 2186 2197 - result = ene_get_card_type(us, REG_CARD_STATUS, &misc_reg03); 2187 + result = ene_get_card_type(us, REG_CARD_STATUS, bbuf); 2198 2188 if (result != USB_STOR_XFER_GOOD) 2199 2189 return USB_STOR_TRANSPORT_ERROR; 2200 2190 2191 + misc_reg03 = bbuf[0]; 2201 2192 if (misc_reg03 & 0x01) { 2202 2193 if (!info->SD_Status.Ready) { 2203 2194 result = ene_sd_init(us); ··· 2316 2303 const struct usb_device_id *id) 2317 2304 { 2318 2305 int result; 2319 - u8 misc_reg03 = 0; 2306 + u8 misc_reg03; 2320 2307 struct us_data *us; 2308 + struct ene_ub6250_info *info; 2321 2309 2322 2310 result = usb_stor_probe1(&us, intf, id, 2323 2311 (id - ene_ub6250_usb_ids) + ene_ub6250_unusual_dev_list, ··· 2327 2313 return result; 2328 2314 2329 2315 /* FIXME: where should the code alloc extra buf ? */ 2330 - if (!us->extra) { 2331 - us->extra = kzalloc(sizeof(struct ene_ub6250_info), GFP_KERNEL); 2332 - if (!us->extra) 2333 - return -ENOMEM; 2334 - us->extra_destructor = ene_ub6250_info_destructor; 2316 + us->extra = kzalloc(sizeof(struct ene_ub6250_info), GFP_KERNEL); 2317 + if (!us->extra) 2318 + return -ENOMEM; 2319 + us->extra_destructor = ene_ub6250_info_destructor; 2320 + 2321 + info = (struct ene_ub6250_info *)(us->extra); 2322 + info->bbuf = kmalloc(512, GFP_KERNEL); 2323 + if (!info->bbuf) { 2324 + kfree(us->extra); 2325 + return -ENOMEM; 2335 2326 } 2336 2327 2337 2328 us->transport_name = "ene_ub6250"; ··· 2348 2329 return result; 2349 2330 2350 2331 /* probe card type */ 2351 - result = ene_get_card_type(us, REG_CARD_STATUS, &misc_reg03); 2332 + result = ene_get_card_type(us, REG_CARD_STATUS, info->bbuf); 2352 2333 if (result != USB_STOR_XFER_GOOD) { 2353 2334 usb_stor_disconnect(intf); 2354 2335 return USB_STOR_TRANSPORT_ERROR; 2355 2336 } 2356 2337 2338 + misc_reg03 = info->bbuf[0]; 2357 2339 if (!(misc_reg03 & 0x01)) { 2358 2340 pr_info("ums_eneub6250: This driver only supports SD/MS cards. " 2359 2341 "It does not support SM cards.\n");
+8 -3
drivers/usb/usbip/vhci_hcd.c
··· 235 235 236 236 static inline void hub_descriptor(struct usb_hub_descriptor *desc) 237 237 { 238 + int width; 239 + 238 240 memset(desc, 0, sizeof(*desc)); 239 241 desc->bDescriptorType = USB_DT_HUB; 240 - desc->bDescLength = 9; 241 242 desc->wHubCharacteristics = cpu_to_le16( 242 243 HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_COMMON_OCPM); 244 + 243 245 desc->bNbrPorts = VHCI_HC_PORTS; 244 - desc->u.hs.DeviceRemovable[0] = 0xff; 245 - desc->u.hs.DeviceRemovable[1] = 0xff; 246 + BUILD_BUG_ON(VHCI_HC_PORTS > USB_MAXCHILDREN); 247 + width = desc->bNbrPorts / 8 + 1; 248 + desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * width; 249 + memset(&desc->u.hs.DeviceRemovable[0], 0, width); 250 + memset(&desc->u.hs.DeviceRemovable[width], 0xff, width); 246 251 } 247 252 248 253 static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
+3 -2
drivers/uwb/i1480/dfu/usb.c
··· 341 341 static 342 342 int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id) 343 343 { 344 + struct usb_device *udev = interface_to_usbdev(iface); 344 345 struct i1480_usb *i1480_usb; 345 346 struct i1480 *i1480; 346 347 struct device *dev = &iface->dev; ··· 353 352 iface->cur_altsetting->desc.bInterfaceNumber); 354 353 goto error; 355 354 } 356 - if (iface->num_altsetting > 1 357 - && interface_to_usbdev(iface)->descriptor.idProduct == 0xbabe) { 355 + if (iface->num_altsetting > 1 && 356 + le16_to_cpu(udev->descriptor.idProduct) == 0xbabe) { 358 357 /* Need altsetting #1 [HW QUIRK] or EP1 won't work */ 359 358 result = usb_set_interface(interface_to_usbdev(iface), 0, 1); 360 359 if (result < 0)
+1
include/linux/usb/hcd.h
··· 148 148 unsigned rh_registered:1;/* is root hub registered? */ 149 149 unsigned rh_pollable:1; /* may we poll the root hub? */ 150 150 unsigned msix_enabled:1; /* driver has MSI-X enabled? */ 151 + unsigned msi_enabled:1; /* driver has MSI enabled? */ 151 152 unsigned remove_phy:1; /* auto-remove USB phy */ 152 153 153 154 /* The next flag is a stopgap, to be removed when all the HCDs
+3
include/uapi/linux/usb/ch11.h
··· 22 22 */ 23 23 #define USB_MAXCHILDREN 31 24 24 25 + /* See USB 3.1 spec Table 10-5 */ 26 + #define USB_SS_MAXPORTS 15 27 + 25 28 /* 26 29 * Hub request types 27 30 */