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

Pull USB fixes from Greg KH:
"The USB sub-maintainers woke up this past week and sent a bunch of
tiny fixes. Here are a lot of small patches that that resolve a bunch
of reported issues in the USB core, drivers, serial drivers, gadget
drivers, and of course, xhci :)

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

* tag 'usb-5.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (31 commits)
usb: dwc3: gadget: fix race when disabling ep with cancelled xfers
usb: cdns3: gadget: Fix g_audio use case when connected to Super-Speed host
usb: cdns3: gadget: reset EP_CLAIMED flag while unloading
USB: serial: whiteheat: fix line-speed endianness
USB: serial: whiteheat: fix potential slab corruption
USB: gadget: Reject endpoints with 0 maxpacket value
UAS: Revert commit 3ae62a42090f ("UAS: fix alignment of scatter/gather segments")
usb-storage: Revert commit 747668dbc061 ("usb-storage: Set virt_boundary_mask to avoid SG overflows")
usbip: Fix free of unallocated memory in vhci tx
usbip: tools: Fix read_usb_vudc_device() error path handling
usb: xhci: fix __le32/__le64 accessors in debugfs code
usb: xhci: fix Immediate Data Transfer endianness
xhci: Fix use-after-free regression in xhci clear hub TT implementation
USB: ldusb: fix control-message timeout
USB: ldusb: use unsigned size format specifiers
USB: ldusb: fix ring-buffer locking
USB: Skip endpoints with 0 maxpacket length
usb: cdns3: gadget: Don't manage pullups
usb: dwc3: remove the call trace of USBx_GFLADJ
usb: gadget: configfs: fix concurrent issue between composite APIs
...

+28 -9
drivers/usb/cdns3/gadget.c
··· 2329 2329 writel(USB_CONF_CLK2OFFDS | USB_CONF_L1DS, &regs->usb_conf); 2330 2330 2331 2331 cdns3_configure_dmult(priv_dev, NULL); 2332 - 2333 - cdns3_gadget_pullup(&priv_dev->gadget, 1); 2334 2332 } 2335 2333 2336 2334 /** ··· 2343 2345 { 2344 2346 struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget); 2345 2347 unsigned long flags; 2348 + enum usb_device_speed max_speed = driver->max_speed; 2346 2349 2347 2350 spin_lock_irqsave(&priv_dev->lock, flags); 2348 2351 priv_dev->gadget_driver = driver; 2352 + 2353 + /* limit speed if necessary */ 2354 + max_speed = min(driver->max_speed, gadget->max_speed); 2355 + 2356 + switch (max_speed) { 2357 + case USB_SPEED_FULL: 2358 + writel(USB_CONF_SFORCE_FS, &priv_dev->regs->usb_conf); 2359 + writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); 2360 + break; 2361 + case USB_SPEED_HIGH: 2362 + writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); 2363 + break; 2364 + case USB_SPEED_SUPER: 2365 + break; 2366 + default: 2367 + dev_err(priv_dev->dev, 2368 + "invalid maximum_speed parameter %d\n", 2369 + max_speed); 2370 + /* fall through */ 2371 + case USB_SPEED_UNKNOWN: 2372 + /* default to superspeed */ 2373 + max_speed = USB_SPEED_SUPER; 2374 + break; 2375 + } 2376 + 2349 2377 cdns3_gadget_config(priv_dev); 2350 2378 spin_unlock_irqrestore(&priv_dev->lock, flags); 2351 2379 return 0; ··· 2405 2381 writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd); 2406 2382 readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val, 2407 2383 !(val & EP_CMD_EPRST), 1, 100); 2384 + 2385 + priv_ep->flags &= ~EP_CLAIMED; 2408 2386 } 2409 2387 2410 2388 /* disable interrupt for device */ ··· 2601 2575 /* Check the maximum_speed parameter */ 2602 2576 switch (max_speed) { 2603 2577 case USB_SPEED_FULL: 2604 - writel(USB_CONF_SFORCE_FS, &priv_dev->regs->usb_conf); 2605 - writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); 2606 - break; 2607 2578 case USB_SPEED_HIGH: 2608 - writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); 2609 - break; 2610 2579 case USB_SPEED_SUPER: 2611 2580 break; 2612 2581 default: ··· 2733 2712 2734 2713 /* disable interrupt for device */ 2735 2714 writel(0, &priv_dev->regs->usb_ien); 2736 - 2737 - cdns3_gadget_pullup(&priv_dev->gadget, 0); 2738 2715 2739 2716 return 0; 2740 2717 }
-1
drivers/usb/cdns3/host-export.h
··· 12 12 #ifdef CONFIG_USB_CDNS3_HOST 13 13 14 14 int cdns3_host_init(struct cdns3 *cdns); 15 - void cdns3_host_exit(struct cdns3 *cdns); 16 15 17 16 #else 18 17
+1
drivers/usb/cdns3/host.c
··· 12 12 #include <linux/platform_device.h> 13 13 #include "core.h" 14 14 #include "drd.h" 15 + #include "host-export.h" 15 16 16 17 static int __cdns3_host_init(struct cdns3 *cdns) 17 18 {
+5
drivers/usb/core/config.c
··· 348 348 349 349 /* Validate the wMaxPacketSize field */ 350 350 maxp = usb_endpoint_maxp(&endpoint->desc); 351 + if (maxp == 0) { 352 + dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n", 353 + cfgno, inum, asnum, d->bEndpointAddress); 354 + goto skip_to_next_endpoint_or_interface_descriptor; 355 + } 351 356 352 357 /* Find the highest legal maxpacket size for this endpoint */ 353 358 i = 0; /* additional transactions per microframe */
+1
drivers/usb/dwc3/Kconfig
··· 102 102 depends on ARCH_MESON || COMPILE_TEST 103 103 default USB_DWC3 104 104 select USB_ROLE_SWITCH 105 + select REGMAP_MMIO 105 106 help 106 107 Support USB2/3 functionality in Amlogic G12A platforms. 107 108 Say 'Y' or 'M' if you have one such device.
+1 -2
drivers/usb/dwc3/core.c
··· 312 312 313 313 reg = dwc3_readl(dwc->regs, DWC3_GFLADJ); 314 314 dft = reg & DWC3_GFLADJ_30MHZ_MASK; 315 - if (!dev_WARN_ONCE(dwc->dev, dft == dwc->fladj, 316 - "request value same as default, ignoring\n")) { 315 + if (dft != dwc->fladj) { 317 316 reg &= ~DWC3_GFLADJ_30MHZ_MASK; 318 317 reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj; 319 318 dwc3_writel(dwc->regs, DWC3_GFLADJ, reg);
+1 -1
drivers/usb/dwc3/dwc3-pci.c
··· 258 258 259 259 ret = platform_device_add_properties(dwc->dwc3, p); 260 260 if (ret < 0) 261 - return ret; 261 + goto err; 262 262 263 263 ret = dwc3_pci_quirks(dwc); 264 264 if (ret)
+6
drivers/usb/dwc3/gadget.c
··· 707 707 708 708 dwc3_gadget_giveback(dep, req, -ESHUTDOWN); 709 709 } 710 + 711 + while (!list_empty(&dep->cancelled_list)) { 712 + req = next_request(&dep->cancelled_list); 713 + 714 + dwc3_gadget_giveback(dep, req, -ESHUTDOWN); 715 + } 710 716 } 711 717 712 718 /**
+4
drivers/usb/gadget/composite.c
··· 2170 2170 usb_ep_dequeue(cdev->gadget->ep0, cdev->os_desc_req); 2171 2171 2172 2172 kfree(cdev->os_desc_req->buf); 2173 + cdev->os_desc_req->buf = NULL; 2173 2174 usb_ep_free_request(cdev->gadget->ep0, cdev->os_desc_req); 2175 + cdev->os_desc_req = NULL; 2174 2176 } 2175 2177 if (cdev->req) { 2176 2178 if (cdev->setup_pending) 2177 2179 usb_ep_dequeue(cdev->gadget->ep0, cdev->req); 2178 2180 2179 2181 kfree(cdev->req->buf); 2182 + cdev->req->buf = NULL; 2180 2183 usb_ep_free_request(cdev->gadget->ep0, cdev->req); 2184 + cdev->req = NULL; 2181 2185 } 2182 2186 cdev->next_string_id = 0; 2183 2187 device_remove_file(&cdev->gadget->dev, &dev_attr_suspended);
+105 -5
drivers/usb/gadget/configfs.c
··· 61 61 bool use_os_desc; 62 62 char b_vendor_code; 63 63 char qw_sign[OS_STRING_QW_SIGN_LEN]; 64 + spinlock_t spinlock; 65 + bool unbind; 64 66 }; 65 67 66 68 static inline struct gadget_info *to_gadget_info(struct config_item *item) ··· 1246 1244 int ret; 1247 1245 1248 1246 /* the gi->lock is hold by the caller */ 1247 + gi->unbind = 0; 1249 1248 cdev->gadget = gadget; 1250 1249 set_gadget_data(gadget, cdev); 1251 1250 ret = composite_dev_prepare(composite, cdev); ··· 1379 1376 { 1380 1377 struct usb_composite_dev *cdev; 1381 1378 struct gadget_info *gi; 1379 + unsigned long flags; 1382 1380 1383 1381 /* the gi->lock is hold by the caller */ 1384 1382 1385 1383 cdev = get_gadget_data(gadget); 1386 1384 gi = container_of(cdev, struct gadget_info, cdev); 1385 + spin_lock_irqsave(&gi->spinlock, flags); 1386 + gi->unbind = 1; 1387 + spin_unlock_irqrestore(&gi->spinlock, flags); 1387 1388 1388 1389 kfree(otg_desc[0]); 1389 1390 otg_desc[0] = NULL; 1390 1391 purge_configs_funcs(gi); 1391 1392 composite_dev_cleanup(cdev); 1392 1393 usb_ep_autoconfig_reset(cdev->gadget); 1394 + spin_lock_irqsave(&gi->spinlock, flags); 1393 1395 cdev->gadget = NULL; 1394 1396 set_gadget_data(gadget, NULL); 1397 + spin_unlock_irqrestore(&gi->spinlock, flags); 1398 + } 1399 + 1400 + static int configfs_composite_setup(struct usb_gadget *gadget, 1401 + const struct usb_ctrlrequest *ctrl) 1402 + { 1403 + struct usb_composite_dev *cdev; 1404 + struct gadget_info *gi; 1405 + unsigned long flags; 1406 + int ret; 1407 + 1408 + cdev = get_gadget_data(gadget); 1409 + if (!cdev) 1410 + return 0; 1411 + 1412 + gi = container_of(cdev, struct gadget_info, cdev); 1413 + spin_lock_irqsave(&gi->spinlock, flags); 1414 + cdev = get_gadget_data(gadget); 1415 + if (!cdev || gi->unbind) { 1416 + spin_unlock_irqrestore(&gi->spinlock, flags); 1417 + return 0; 1418 + } 1419 + 1420 + ret = composite_setup(gadget, ctrl); 1421 + spin_unlock_irqrestore(&gi->spinlock, flags); 1422 + return ret; 1423 + } 1424 + 1425 + static void configfs_composite_disconnect(struct usb_gadget *gadget) 1426 + { 1427 + struct usb_composite_dev *cdev; 1428 + struct gadget_info *gi; 1429 + unsigned long flags; 1430 + 1431 + cdev = get_gadget_data(gadget); 1432 + if (!cdev) 1433 + return; 1434 + 1435 + gi = container_of(cdev, struct gadget_info, cdev); 1436 + spin_lock_irqsave(&gi->spinlock, flags); 1437 + cdev = get_gadget_data(gadget); 1438 + if (!cdev || gi->unbind) { 1439 + spin_unlock_irqrestore(&gi->spinlock, flags); 1440 + return; 1441 + } 1442 + 1443 + composite_disconnect(gadget); 1444 + spin_unlock_irqrestore(&gi->spinlock, flags); 1445 + } 1446 + 1447 + static void configfs_composite_suspend(struct usb_gadget *gadget) 1448 + { 1449 + struct usb_composite_dev *cdev; 1450 + struct gadget_info *gi; 1451 + unsigned long flags; 1452 + 1453 + cdev = get_gadget_data(gadget); 1454 + if (!cdev) 1455 + return; 1456 + 1457 + gi = container_of(cdev, struct gadget_info, cdev); 1458 + spin_lock_irqsave(&gi->spinlock, flags); 1459 + cdev = get_gadget_data(gadget); 1460 + if (!cdev || gi->unbind) { 1461 + spin_unlock_irqrestore(&gi->spinlock, flags); 1462 + return; 1463 + } 1464 + 1465 + composite_suspend(gadget); 1466 + spin_unlock_irqrestore(&gi->spinlock, flags); 1467 + } 1468 + 1469 + static void configfs_composite_resume(struct usb_gadget *gadget) 1470 + { 1471 + struct usb_composite_dev *cdev; 1472 + struct gadget_info *gi; 1473 + unsigned long flags; 1474 + 1475 + cdev = get_gadget_data(gadget); 1476 + if (!cdev) 1477 + return; 1478 + 1479 + gi = container_of(cdev, struct gadget_info, cdev); 1480 + spin_lock_irqsave(&gi->spinlock, flags); 1481 + cdev = get_gadget_data(gadget); 1482 + if (!cdev || gi->unbind) { 1483 + spin_unlock_irqrestore(&gi->spinlock, flags); 1484 + return; 1485 + } 1486 + 1487 + composite_resume(gadget); 1488 + spin_unlock_irqrestore(&gi->spinlock, flags); 1395 1489 } 1396 1490 1397 1491 static const struct usb_gadget_driver configfs_driver_template = { 1398 1492 .bind = configfs_composite_bind, 1399 1493 .unbind = configfs_composite_unbind, 1400 1494 1401 - .setup = composite_setup, 1402 - .reset = composite_disconnect, 1403 - .disconnect = composite_disconnect, 1495 + .setup = configfs_composite_setup, 1496 + .reset = configfs_composite_disconnect, 1497 + .disconnect = configfs_composite_disconnect, 1404 1498 1405 - .suspend = composite_suspend, 1406 - .resume = composite_resume, 1499 + .suspend = configfs_composite_suspend, 1500 + .resume = configfs_composite_resume, 1407 1501 1408 1502 .max_speed = USB_SPEED_SUPER, 1409 1503 .driver = {
+4 -2
drivers/usb/gadget/udc/atmel_usba_udc.c
··· 449 449 next_fifo_transaction(ep, req); 450 450 if (req->last_transaction) { 451 451 usba_ep_writel(ep, CTL_DIS, USBA_TX_PK_RDY); 452 - usba_ep_writel(ep, CTL_ENB, USBA_TX_COMPLETE); 452 + if (ep_is_control(ep)) 453 + usba_ep_writel(ep, CTL_ENB, USBA_TX_COMPLETE); 453 454 } else { 454 - usba_ep_writel(ep, CTL_DIS, USBA_TX_COMPLETE); 455 + if (ep_is_control(ep)) 456 + usba_ep_writel(ep, CTL_DIS, USBA_TX_COMPLETE); 455 457 usba_ep_writel(ep, CTL_ENB, USBA_TX_PK_RDY); 456 458 } 457 459 }
+11
drivers/usb/gadget/udc/core.c
··· 98 98 if (ep->enabled) 99 99 goto out; 100 100 101 + /* UDC drivers can't handle endpoints with maxpacket size 0 */ 102 + if (usb_endpoint_maxp(ep->desc) == 0) { 103 + /* 104 + * We should log an error message here, but we can't call 105 + * dev_err() because there's no way to find the gadget 106 + * given only ep. 107 + */ 108 + ret = -EINVAL; 109 + goto out; 110 + } 111 + 101 112 ret = ep->ops->enable(ep, ep->desc); 102 113 if (ret) 103 114 goto out;
+1 -1
drivers/usb/gadget/udc/fsl_udc_core.c
··· 2576 2576 dma_pool_destroy(udc_controller->td_pool); 2577 2577 free_irq(udc_controller->irq, udc_controller); 2578 2578 iounmap(dr_regs); 2579 - if (pdata->operating_mode == FSL_USB2_DR_DEVICE) 2579 + if (res && (pdata->operating_mode == FSL_USB2_DR_DEVICE)) 2580 2580 release_mem_region(res->start, resource_size(res)); 2581 2581 2582 2582 /* free udc --wait for the release() finished */
+6 -5
drivers/usb/gadget/udc/renesas_usb3.c
··· 1544 1544 static bool usb3_std_req_set_address(struct renesas_usb3 *usb3, 1545 1545 struct usb_ctrlrequest *ctrl) 1546 1546 { 1547 - if (ctrl->wValue >= 128) 1547 + if (le16_to_cpu(ctrl->wValue) >= 128) 1548 1548 return true; /* stall */ 1549 1549 1550 - usb3_set_device_address(usb3, ctrl->wValue); 1550 + usb3_set_device_address(usb3, le16_to_cpu(ctrl->wValue)); 1551 1551 usb3_set_p0_con_for_no_data(usb3); 1552 1552 1553 1553 return false; ··· 1582 1582 struct renesas_usb3_ep *usb3_ep; 1583 1583 int num; 1584 1584 u16 status = 0; 1585 + __le16 tx_data; 1585 1586 1586 1587 switch (ctrl->bRequestType & USB_RECIP_MASK) { 1587 1588 case USB_RECIP_DEVICE: ··· 1605 1604 } 1606 1605 1607 1606 if (!stall) { 1608 - status = cpu_to_le16(status); 1607 + tx_data = cpu_to_le16(status); 1609 1608 dev_dbg(usb3_to_dev(usb3), "get_status: req = %p\n", 1610 1609 usb_req_to_usb3_req(usb3->ep0_req)); 1611 - usb3_pipe0_internal_xfer(usb3, &status, sizeof(status), 1610 + usb3_pipe0_internal_xfer(usb3, &tx_data, sizeof(tx_data), 1612 1611 usb3_pipe0_get_status_completion); 1613 1612 } 1614 1613 ··· 1773 1772 static bool usb3_std_req_set_configuration(struct renesas_usb3 *usb3, 1774 1773 struct usb_ctrlrequest *ctrl) 1775 1774 { 1776 - if (ctrl->wValue > 0) 1775 + if (le16_to_cpu(ctrl->wValue) > 0) 1777 1776 usb3_set_bit(usb3, USB_COM_CON_CONF, USB3_USB_COM_CON); 1778 1777 else 1779 1778 usb3_clear_bit(usb3, USB_COM_CON_CONF, USB3_USB_COM_CON);
+12 -12
drivers/usb/host/xhci-debugfs.c
··· 202 202 trb = &seg->trbs[i]; 203 203 dma = seg->dma + i * sizeof(*trb); 204 204 seq_printf(s, "%pad: %s\n", &dma, 205 - xhci_decode_trb(trb->generic.field[0], 206 - trb->generic.field[1], 207 - trb->generic.field[2], 208 - trb->generic.field[3])); 205 + xhci_decode_trb(le32_to_cpu(trb->generic.field[0]), 206 + le32_to_cpu(trb->generic.field[1]), 207 + le32_to_cpu(trb->generic.field[2]), 208 + le32_to_cpu(trb->generic.field[3]))); 209 209 } 210 210 } 211 211 ··· 263 263 xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus)); 264 264 slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx); 265 265 seq_printf(s, "%pad: %s\n", &dev->out_ctx->dma, 266 - xhci_decode_slot_context(slot_ctx->dev_info, 267 - slot_ctx->dev_info2, 268 - slot_ctx->tt_info, 269 - slot_ctx->dev_state)); 266 + xhci_decode_slot_context(le32_to_cpu(slot_ctx->dev_info), 267 + le32_to_cpu(slot_ctx->dev_info2), 268 + le32_to_cpu(slot_ctx->tt_info), 269 + le32_to_cpu(slot_ctx->dev_state))); 270 270 271 271 return 0; 272 272 } ··· 286 286 ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, dci); 287 287 dma = dev->out_ctx->dma + dci * CTX_SIZE(xhci->hcc_params); 288 288 seq_printf(s, "%pad: %s\n", &dma, 289 - xhci_decode_ep_context(ep_ctx->ep_info, 290 - ep_ctx->ep_info2, 291 - ep_ctx->deq, 292 - ep_ctx->tx_info)); 289 + xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info), 290 + le32_to_cpu(ep_ctx->ep_info2), 291 + le64_to_cpu(ep_ctx->deq), 292 + le32_to_cpu(ep_ctx->tx_info))); 293 293 } 294 294 295 295 return 0;
+2
drivers/usb/host/xhci-ring.c
··· 3330 3330 if (xhci_urb_suitable_for_idt(urb)) { 3331 3331 memcpy(&send_addr, urb->transfer_buffer, 3332 3332 trb_buff_len); 3333 + le64_to_cpus(&send_addr); 3333 3334 field |= TRB_IDT; 3334 3335 } 3335 3336 } ··· 3476 3475 if (xhci_urb_suitable_for_idt(urb)) { 3477 3476 memcpy(&addr, urb->transfer_buffer, 3478 3477 urb->transfer_buffer_length); 3478 + le64_to_cpus(&addr); 3479 3479 field |= TRB_IDT; 3480 3480 } else { 3481 3481 addr = (u64) urb->transfer_dma;
+45 -9
drivers/usb/host/xhci.c
··· 3071 3071 } 3072 3072 } 3073 3073 3074 + static void xhci_endpoint_disable(struct usb_hcd *hcd, 3075 + struct usb_host_endpoint *host_ep) 3076 + { 3077 + struct xhci_hcd *xhci; 3078 + struct xhci_virt_device *vdev; 3079 + struct xhci_virt_ep *ep; 3080 + struct usb_device *udev; 3081 + unsigned long flags; 3082 + unsigned int ep_index; 3083 + 3084 + xhci = hcd_to_xhci(hcd); 3085 + rescan: 3086 + spin_lock_irqsave(&xhci->lock, flags); 3087 + 3088 + udev = (struct usb_device *)host_ep->hcpriv; 3089 + if (!udev || !udev->slot_id) 3090 + goto done; 3091 + 3092 + vdev = xhci->devs[udev->slot_id]; 3093 + if (!vdev) 3094 + goto done; 3095 + 3096 + ep_index = xhci_get_endpoint_index(&host_ep->desc); 3097 + ep = &vdev->eps[ep_index]; 3098 + if (!ep) 3099 + goto done; 3100 + 3101 + /* wait for hub_tt_work to finish clearing hub TT */ 3102 + if (ep->ep_state & EP_CLEARING_TT) { 3103 + spin_unlock_irqrestore(&xhci->lock, flags); 3104 + schedule_timeout_uninterruptible(1); 3105 + goto rescan; 3106 + } 3107 + 3108 + if (ep->ep_state) 3109 + xhci_dbg(xhci, "endpoint disable with ep_state 0x%x\n", 3110 + ep->ep_state); 3111 + done: 3112 + host_ep->hcpriv = NULL; 3113 + spin_unlock_irqrestore(&xhci->lock, flags); 3114 + } 3115 + 3074 3116 /* 3075 3117 * Called after usb core issues a clear halt control message. 3076 3118 * The host side of the halt should already be cleared by a reset endpoint ··· 5280 5238 unsigned int ep_index; 5281 5239 unsigned long flags; 5282 5240 5283 - /* 5284 - * udev might be NULL if tt buffer is cleared during a failed device 5285 - * enumeration due to a halted control endpoint. Usb core might 5286 - * have allocated a new udev for the next enumeration attempt. 5287 - */ 5288 - 5289 5241 xhci = hcd_to_xhci(hcd); 5242 + 5243 + spin_lock_irqsave(&xhci->lock, flags); 5290 5244 udev = (struct usb_device *)ep->hcpriv; 5291 - if (!udev) 5292 - return; 5293 5245 slot_id = udev->slot_id; 5294 5246 ep_index = xhci_get_endpoint_index(&ep->desc); 5295 5247 5296 - spin_lock_irqsave(&xhci->lock, flags); 5297 5248 xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_CLEARING_TT; 5298 5249 xhci_ring_doorbell_for_active_rings(xhci, slot_id, ep_index); 5299 5250 spin_unlock_irqrestore(&xhci->lock, flags); ··· 5323 5288 .free_streams = xhci_free_streams, 5324 5289 .add_endpoint = xhci_add_endpoint, 5325 5290 .drop_endpoint = xhci_drop_endpoint, 5291 + .endpoint_disable = xhci_endpoint_disable, 5326 5292 .endpoint_reset = xhci_endpoint_reset, 5327 5293 .check_bandwidth = xhci_check_bandwidth, 5328 5294 .reset_bandwidth = xhci_reset_bandwidth,
+7 -6
drivers/usb/misc/ldusb.c
··· 487 487 } 488 488 bytes_to_read = min(count, *actual_buffer); 489 489 if (bytes_to_read < *actual_buffer) 490 - dev_warn(&dev->intf->dev, "Read buffer overflow, %zd bytes dropped\n", 490 + dev_warn(&dev->intf->dev, "Read buffer overflow, %zu bytes dropped\n", 491 491 *actual_buffer-bytes_to_read); 492 492 493 493 /* copy one interrupt_in_buffer from ring_buffer into userspace */ ··· 495 495 retval = -EFAULT; 496 496 goto unlock_exit; 497 497 } 498 - dev->ring_tail = (dev->ring_tail+1) % ring_buffer_size; 499 - 500 498 retval = bytes_to_read; 501 499 502 500 spin_lock_irq(&dev->rbsl); 501 + dev->ring_tail = (dev->ring_tail + 1) % ring_buffer_size; 502 + 503 503 if (dev->buffer_overflow) { 504 504 dev->buffer_overflow = 0; 505 505 spin_unlock_irq(&dev->rbsl); ··· 562 562 /* write the data into interrupt_out_buffer from userspace */ 563 563 bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size); 564 564 if (bytes_to_write < count) 565 - dev_warn(&dev->intf->dev, "Write buffer overflow, %zd bytes dropped\n", count-bytes_to_write); 566 - dev_dbg(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n", 565 + dev_warn(&dev->intf->dev, "Write buffer overflow, %zu bytes dropped\n", 566 + count - bytes_to_write); 567 + dev_dbg(&dev->intf->dev, "%s: count = %zu, bytes_to_write = %zu\n", 567 568 __func__, count, bytes_to_write); 568 569 569 570 if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) { ··· 581 580 1 << 8, 0, 582 581 dev->interrupt_out_buffer, 583 582 bytes_to_write, 584 - USB_CTRL_SET_TIMEOUT * HZ); 583 + USB_CTRL_SET_TIMEOUT); 585 584 if (retval < 0) 586 585 dev_err(&dev->intf->dev, 587 586 "Couldn't submit HID_REQ_SET_REPORT %d\n",
+1
drivers/usb/mtu3/mtu3_core.c
··· 16 16 #include <linux/platform_device.h> 17 17 18 18 #include "mtu3.h" 19 + #include "mtu3_dr.h" 19 20 #include "mtu3_debug.h" 20 21 #include "mtu3_trace.h" 21 22
+6 -6
drivers/usb/renesas_usbhs/common.c
··· 162 162 req->bRequest = (val >> 8) & 0xFF; 163 163 req->bRequestType = (val >> 0) & 0xFF; 164 164 165 - req->wValue = usbhs_read(priv, USBVAL); 166 - req->wIndex = usbhs_read(priv, USBINDX); 167 - req->wLength = usbhs_read(priv, USBLENG); 165 + req->wValue = cpu_to_le16(usbhs_read(priv, USBVAL)); 166 + req->wIndex = cpu_to_le16(usbhs_read(priv, USBINDX)); 167 + req->wLength = cpu_to_le16(usbhs_read(priv, USBLENG)); 168 168 } 169 169 170 170 void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req) 171 171 { 172 172 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType); 173 - usbhs_write(priv, USBVAL, req->wValue); 174 - usbhs_write(priv, USBINDX, req->wIndex); 175 - usbhs_write(priv, USBLENG, req->wLength); 173 + usbhs_write(priv, USBVAL, le16_to_cpu(req->wValue)); 174 + usbhs_write(priv, USBINDX, le16_to_cpu(req->wIndex)); 175 + usbhs_write(priv, USBLENG, le16_to_cpu(req->wLength)); 176 176 177 177 usbhs_bset(priv, DCPCTR, SUREQ, SUREQ); 178 178 }
+2 -2
drivers/usb/renesas_usbhs/mod_gadget.c
··· 265 265 case USB_DEVICE_TEST_MODE: 266 266 usbhsg_recip_handler_std_control_done(priv, uep, ctrl); 267 267 udelay(100); 268 - usbhs_sys_set_test_mode(priv, le16_to_cpu(ctrl->wIndex >> 8)); 268 + usbhs_sys_set_test_mode(priv, le16_to_cpu(ctrl->wIndex) >> 8); 269 269 break; 270 270 default: 271 271 usbhsg_recip_handler_std_control_done(priv, uep, ctrl); ··· 315 315 struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(dcp); 316 316 struct device *dev = usbhsg_gpriv_to_dev(gpriv); 317 317 struct usb_request *req; 318 - unsigned short *buf; 318 + __le16 *buf; 319 319 320 320 /* alloc new usb_request for recip */ 321 321 req = usb_ep_alloc_request(&dcp->ep, GFP_ATOMIC);
+10 -3
drivers/usb/serial/whiteheat.c
··· 559 559 560 560 command_port = port->serial->port[COMMAND_PORT]; 561 561 command_info = usb_get_serial_port_data(command_port); 562 + 563 + if (command_port->bulk_out_size < datasize + 1) 564 + return -EIO; 565 + 562 566 mutex_lock(&command_info->mutex); 563 567 command_info->command_finished = false; 564 568 ··· 636 632 struct device *dev = &port->dev; 637 633 struct whiteheat_port_settings port_settings; 638 634 unsigned int cflag = tty->termios.c_cflag; 635 + speed_t baud; 639 636 640 637 port_settings.port = port->port_number + 1; 641 638 ··· 697 692 dev_dbg(dev, "%s - XON = %2x, XOFF = %2x\n", __func__, port_settings.xon, port_settings.xoff); 698 693 699 694 /* get the baud rate wanted */ 700 - port_settings.baud = tty_get_baud_rate(tty); 701 - dev_dbg(dev, "%s - baud rate = %d\n", __func__, port_settings.baud); 695 + baud = tty_get_baud_rate(tty); 696 + port_settings.baud = cpu_to_le32(baud); 697 + dev_dbg(dev, "%s - baud rate = %u\n", __func__, baud); 702 698 703 699 /* fixme: should set validated settings */ 704 - tty_encode_baud_rate(tty, port_settings.baud, port_settings.baud); 700 + tty_encode_baud_rate(tty, baud, baud); 701 + 705 702 /* handle any settings that aren't specified in the tty structure */ 706 703 port_settings.lloop = 0; 707 704
+1 -1
drivers/usb/serial/whiteheat.h
··· 87 87 88 88 struct whiteheat_port_settings { 89 89 __u8 port; /* port number (1 to N) */ 90 - __u32 baud; /* any value 7 - 460800, firmware calculates 90 + __le32 baud; /* any value 7 - 460800, firmware calculates 91 91 best fit; arrives little endian */ 92 92 __u8 bits; /* 5, 6, 7, or 8 */ 93 93 __u8 stop; /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */
-10
drivers/usb/storage/scsiglue.c
··· 68 68 static int slave_alloc (struct scsi_device *sdev) 69 69 { 70 70 struct us_data *us = host_to_us(sdev->host); 71 - int maxp; 72 71 73 72 /* 74 73 * Set the INQUIRY transfer length to 36. We don't use any of ··· 75 76 * less than 36 bytes. 76 77 */ 77 78 sdev->inquiry_len = 36; 78 - 79 - /* 80 - * USB has unusual scatter-gather requirements: the length of each 81 - * scatterlist element except the last must be divisible by the 82 - * Bulk maxpacket value. Fortunately this value is always a 83 - * power of 2. Inform the block layer about this requirement. 84 - */ 85 - maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0); 86 - blk_queue_virt_boundary(sdev->request_queue, maxp - 1); 87 79 88 80 /* 89 81 * Some host controllers may have alignment requirements.
-20
drivers/usb/storage/uas.c
··· 789 789 { 790 790 struct uas_dev_info *devinfo = 791 791 (struct uas_dev_info *)sdev->host->hostdata; 792 - int maxp; 793 792 794 793 sdev->hostdata = devinfo; 795 - 796 - /* 797 - * We have two requirements here. We must satisfy the requirements 798 - * of the physical HC and the demands of the protocol, as we 799 - * definitely want no additional memory allocation in this path 800 - * ruling out using bounce buffers. 801 - * 802 - * For a transmission on USB to continue we must never send 803 - * a package that is smaller than maxpacket. Hence the length of each 804 - * scatterlist element except the last must be divisible by the 805 - * Bulk maxpacket value. 806 - * If the HC does not ensure that through SG, 807 - * the upper layer must do that. We must assume nothing 808 - * about the capabilities off the HC, so we use the most 809 - * pessimistic requirement. 810 - */ 811 - 812 - maxp = usb_maxpacket(devinfo->udev, devinfo->data_in_pipe, 0); 813 - blk_queue_virt_boundary(sdev->request_queue, maxp - 1); 814 794 815 795 /* 816 796 * The protocol has no requirements on alignment in the strict sense.
+3
drivers/usb/usbip/vhci_tx.c
··· 147 147 } 148 148 149 149 kfree(iov); 150 + /* This is only for isochronous case */ 150 151 kfree(iso_buffer); 152 + iso_buffer = NULL; 153 + 151 154 usbip_dbg_vhci_tx("send txdata\n"); 152 155 153 156 total_size += txsize;
+4 -2
tools/usb/usbip/libsrc/usbip_device_driver.c
··· 69 69 FILE *fd = NULL; 70 70 struct udev_device *plat; 71 71 const char *speed; 72 - int ret = 0; 72 + size_t ret; 73 73 74 74 plat = udev_device_get_parent(sdev); 75 75 path = udev_device_get_syspath(plat); ··· 79 79 if (!fd) 80 80 return -1; 81 81 ret = fread((char *) &descr, sizeof(descr), 1, fd); 82 - if (ret < 0) 82 + if (ret != 1) { 83 + err("Cannot read vudc device descr file: %s", strerror(errno)); 83 84 goto err; 85 + } 84 86 fclose(fd); 85 87 86 88 copy_descr_attr(dev, &descr, bDeviceClass);