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-5.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here are number of small USB fixes for 5.3-rc5.

Syzbot has been on a tear recently now that it has some good USB
debugging hooks integrated, so there's a number of fixes in here found
by those tools for some _very_ old bugs. Also a handful of gadget
driver fixes for reported issues, some hopefully-final dma fixes for
host controller drivers, and some new USB serial gadget driver ids.

All of these have been in linux-next this week with no reported issues
(the usb-serial ones were in linux-next in its own branch, but merged
into mine on Friday)"

* tag 'usb-5.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: add a hcd_uses_dma helper
usb: don't create dma pools for HCDs with a localmem_pool
usb: chipidea: imx: fix EPROBE_DEFER support during driver probe
usb: host: fotg2: restart hcd after port reset
USB: CDC: fix sanity checks in CDC union parser
usb: cdc-acm: make sure a refcount is taken early enough
USB: serial: option: add the BroadMobi BM818 card
USB: serial: option: Add Motorola modem UARTs
USB: core: Fix races in character device registration and deregistraion
usb: gadget: mass_storage: Fix races between fsg_disable and fsg_set_alt
usb: gadget: composite: Clear "suspended" on reset/disconnect
usb: gadget: udc: renesas_usb3: Fix sysfs interface of "role"
USB: serial: option: add D-Link DWM-222 device ID
USB: serial: option: Add support for ZTE MF871A

+72 -42
+12 -7
drivers/usb/chipidea/ci_hdrc_imx.c
··· 454 454 imx_disable_unprepare_clks(dev); 455 455 disable_hsic_regulator: 456 456 if (data->hsic_pad_regulator) 457 - ret = regulator_disable(data->hsic_pad_regulator); 457 + /* don't overwrite original ret (cf. EPROBE_DEFER) */ 458 + regulator_disable(data->hsic_pad_regulator); 458 459 if (pdata.flags & CI_HDRC_PMQOS) 459 460 pm_qos_remove_request(&data->pm_qos_req); 461 + data->ci_pdev = NULL; 460 462 return ret; 461 463 } 462 464 ··· 471 469 pm_runtime_disable(&pdev->dev); 472 470 pm_runtime_put_noidle(&pdev->dev); 473 471 } 474 - ci_hdrc_remove_device(data->ci_pdev); 472 + if (data->ci_pdev) 473 + ci_hdrc_remove_device(data->ci_pdev); 475 474 if (data->override_phy_control) 476 475 usb_phy_shutdown(data->phy); 477 - imx_disable_unprepare_clks(&pdev->dev); 478 - if (data->plat_data->flags & CI_HDRC_PMQOS) 479 - pm_qos_remove_request(&data->pm_qos_req); 480 - if (data->hsic_pad_regulator) 481 - regulator_disable(data->hsic_pad_regulator); 476 + if (data->ci_pdev) { 477 + imx_disable_unprepare_clks(&pdev->dev); 478 + if (data->plat_data->flags & CI_HDRC_PMQOS) 479 + pm_qos_remove_request(&data->pm_qos_req); 480 + if (data->hsic_pad_regulator) 481 + regulator_disable(data->hsic_pad_regulator); 482 + } 482 483 483 484 return 0; 484 485 }
+7 -5
drivers/usb/class/cdc-acm.c
··· 1301 1301 tty_port_init(&acm->port); 1302 1302 acm->port.ops = &acm_port_ops; 1303 1303 1304 - minor = acm_alloc_minor(acm); 1305 - if (minor < 0) 1306 - goto alloc_fail1; 1307 - 1308 1304 ctrlsize = usb_endpoint_maxp(epctrl); 1309 1305 readsize = usb_endpoint_maxp(epread) * 1310 1306 (quirks == SINGLE_RX_URB ? 1 : 2); ··· 1308 1312 acm->writesize = usb_endpoint_maxp(epwrite) * 20; 1309 1313 acm->control = control_interface; 1310 1314 acm->data = data_interface; 1315 + 1316 + usb_get_intf(acm->control); /* undone in destruct() */ 1317 + 1318 + minor = acm_alloc_minor(acm); 1319 + if (minor < 0) 1320 + goto alloc_fail1; 1321 + 1311 1322 acm->minor = minor; 1312 1323 acm->dev = usb_dev; 1313 1324 if (h.usb_cdc_acm_descriptor) ··· 1461 1458 usb_driver_claim_interface(&acm_driver, data_interface, acm); 1462 1459 usb_set_intfdata(data_interface, acm); 1463 1460 1464 - usb_get_intf(control_interface); 1465 1461 tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor, 1466 1462 &control_interface->dev); 1467 1463 if (IS_ERR(tty_dev)) {
+3 -7
drivers/usb/core/buffer.c
··· 66 66 char name[16]; 67 67 int i, size; 68 68 69 - if (!IS_ENABLED(CONFIG_HAS_DMA) || 70 - (!is_device_dma_capable(hcd->self.sysdev) && 71 - !hcd->localmem_pool)) 69 + if (hcd->localmem_pool || !hcd_uses_dma(hcd)) 72 70 return 0; 73 71 74 72 for (i = 0; i < HCD_BUFFER_POOLS; i++) { ··· 127 129 return gen_pool_dma_alloc(hcd->localmem_pool, size, dma); 128 130 129 131 /* some USB hosts just use PIO */ 130 - if (!IS_ENABLED(CONFIG_HAS_DMA) || 131 - !is_device_dma_capable(bus->sysdev)) { 132 + if (!hcd_uses_dma(hcd)) { 132 133 *dma = ~(dma_addr_t) 0; 133 134 return kmalloc(size, mem_flags); 134 135 } ··· 157 160 return; 158 161 } 159 162 160 - if (!IS_ENABLED(CONFIG_HAS_DMA) || 161 - !is_device_dma_capable(bus->sysdev)) { 163 + if (!hcd_uses_dma(hcd)) { 162 164 kfree(addr); 163 165 return; 164 166 }
+5 -5
drivers/usb/core/file.c
··· 193 193 intf->minor = minor; 194 194 break; 195 195 } 196 - up_write(&minor_rwsem); 197 - if (intf->minor < 0) 196 + if (intf->minor < 0) { 197 + up_write(&minor_rwsem); 198 198 return -EXFULL; 199 + } 199 200 200 201 /* create a usb class device for this usb interface */ 201 202 snprintf(name, sizeof(name), class_driver->name, minor - minor_base); ··· 204 203 MKDEV(USB_MAJOR, minor), class_driver, 205 204 "%s", kbasename(name)); 206 205 if (IS_ERR(intf->usb_dev)) { 207 - down_write(&minor_rwsem); 208 206 usb_minors[minor] = NULL; 209 207 intf->minor = -1; 210 - up_write(&minor_rwsem); 211 208 retval = PTR_ERR(intf->usb_dev); 212 209 } 210 + up_write(&minor_rwsem); 213 211 return retval; 214 212 } 215 213 EXPORT_SYMBOL_GPL(usb_register_dev); ··· 234 234 return; 235 235 236 236 dev_dbg(&intf->dev, "removing %d minor\n", intf->minor); 237 + device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); 237 238 238 239 down_write(&minor_rwsem); 239 240 usb_minors[intf->minor] = NULL; 240 241 up_write(&minor_rwsem); 241 242 242 - device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); 243 243 intf->usb_dev = NULL; 244 244 intf->minor = -1; 245 245 destroy_usb_class();
+2 -2
drivers/usb/core/hcd.c
··· 1412 1412 if (usb_endpoint_xfer_control(&urb->ep->desc)) { 1413 1413 if (hcd->self.uses_pio_for_control) 1414 1414 return ret; 1415 - if (IS_ENABLED(CONFIG_HAS_DMA) && hcd->self.uses_dma) { 1415 + if (hcd_uses_dma(hcd)) { 1416 1416 if (is_vmalloc_addr(urb->setup_packet)) { 1417 1417 WARN_ONCE(1, "setup packet is not dma capable\n"); 1418 1418 return -EAGAIN; ··· 1446 1446 dir = usb_urb_dir_in(urb) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; 1447 1447 if (urb->transfer_buffer_length != 0 1448 1448 && !(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)) { 1449 - if (IS_ENABLED(CONFIG_HAS_DMA) && hcd->self.uses_dma) { 1449 + if (hcd_uses_dma(hcd)) { 1450 1450 if (urb->num_sgs) { 1451 1451 int n; 1452 1452
+2 -2
drivers/usb/core/message.c
··· 2218 2218 (struct usb_cdc_dmm_desc *)buffer; 2219 2219 break; 2220 2220 case USB_CDC_MDLM_TYPE: 2221 - if (elength < sizeof(struct usb_cdc_mdlm_desc *)) 2221 + if (elength < sizeof(struct usb_cdc_mdlm_desc)) 2222 2222 goto next_desc; 2223 2223 if (desc) 2224 2224 return -EINVAL; 2225 2225 desc = (struct usb_cdc_mdlm_desc *)buffer; 2226 2226 break; 2227 2227 case USB_CDC_MDLM_DETAIL_TYPE: 2228 - if (elength < sizeof(struct usb_cdc_mdlm_detail_desc *)) 2228 + if (elength < sizeof(struct usb_cdc_mdlm_detail_desc)) 2229 2229 goto next_desc; 2230 2230 if (detail) 2231 2231 return -EINVAL;
+1 -1
drivers/usb/dwc2/hcd.c
··· 4608 4608 4609 4609 buf = urb->transfer_buffer; 4610 4610 4611 - if (hcd->self.uses_dma) { 4611 + if (hcd_uses_dma(hcd)) { 4612 4612 if (!buf && (urb->transfer_dma & 3)) { 4613 4613 dev_err(hsotg->dev, 4614 4614 "%s: unaligned transfer with no transfer_buffer",
+1
drivers/usb/gadget/composite.c
··· 1976 1976 * disconnect callbacks? 1977 1977 */ 1978 1978 spin_lock_irqsave(&cdev->lock, flags); 1979 + cdev->suspended = 0; 1979 1980 if (cdev->config) 1980 1981 reset_config(cdev); 1981 1982 if (cdev->driver->disconnect)
+18 -10
drivers/usb/gadget/function/f_mass_storage.c
··· 261 261 struct fsg_common { 262 262 struct usb_gadget *gadget; 263 263 struct usb_composite_dev *cdev; 264 - struct fsg_dev *fsg, *new_fsg; 264 + struct fsg_dev *fsg; 265 265 wait_queue_head_t io_wait; 266 266 wait_queue_head_t fsg_wait; 267 267 ··· 290 290 unsigned int bulk_out_maxpacket; 291 291 enum fsg_state state; /* For exception handling */ 292 292 unsigned int exception_req_tag; 293 + void *exception_arg; 293 294 294 295 enum data_direction data_dir; 295 296 u32 data_size; ··· 392 391 393 392 /* These routines may be called in process context or in_irq */ 394 393 395 - static void raise_exception(struct fsg_common *common, enum fsg_state new_state) 394 + static void __raise_exception(struct fsg_common *common, enum fsg_state new_state, 395 + void *arg) 396 396 { 397 397 unsigned long flags; 398 398 ··· 406 404 if (common->state <= new_state) { 407 405 common->exception_req_tag = common->ep0_req_tag; 408 406 common->state = new_state; 407 + common->exception_arg = arg; 409 408 if (common->thread_task) 410 409 send_sig_info(SIGUSR1, SEND_SIG_PRIV, 411 410 common->thread_task); ··· 414 411 spin_unlock_irqrestore(&common->lock, flags); 415 412 } 416 413 414 + static void raise_exception(struct fsg_common *common, enum fsg_state new_state) 415 + { 416 + __raise_exception(common, new_state, NULL); 417 + } 417 418 418 419 /*-------------------------------------------------------------------------*/ 419 420 ··· 2292 2285 static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) 2293 2286 { 2294 2287 struct fsg_dev *fsg = fsg_from_func(f); 2295 - fsg->common->new_fsg = fsg; 2296 - raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); 2288 + 2289 + __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, fsg); 2297 2290 return USB_GADGET_DELAYED_STATUS; 2298 2291 } 2299 2292 2300 2293 static void fsg_disable(struct usb_function *f) 2301 2294 { 2302 2295 struct fsg_dev *fsg = fsg_from_func(f); 2303 - fsg->common->new_fsg = NULL; 2304 - raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); 2296 + 2297 + __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL); 2305 2298 } 2306 2299 2307 2300 ··· 2314 2307 enum fsg_state old_state; 2315 2308 struct fsg_lun *curlun; 2316 2309 unsigned int exception_req_tag; 2310 + struct fsg_dev *new_fsg; 2317 2311 2318 2312 /* 2319 2313 * Clear the existing signals. Anything but SIGUSR1 is converted ··· 2368 2360 common->next_buffhd_to_fill = &common->buffhds[0]; 2369 2361 common->next_buffhd_to_drain = &common->buffhds[0]; 2370 2362 exception_req_tag = common->exception_req_tag; 2363 + new_fsg = common->exception_arg; 2371 2364 old_state = common->state; 2372 2365 common->state = FSG_STATE_NORMAL; 2373 2366 ··· 2422 2413 break; 2423 2414 2424 2415 case FSG_STATE_CONFIG_CHANGE: 2425 - do_set_interface(common, common->new_fsg); 2426 - if (common->new_fsg) 2416 + do_set_interface(common, new_fsg); 2417 + if (new_fsg) 2427 2418 usb_composite_setup_continue(common->cdev); 2428 2419 break; 2429 2420 ··· 2998 2989 2999 2990 DBG(fsg, "unbind\n"); 3000 2991 if (fsg->common->fsg == fsg) { 3001 - fsg->common->new_fsg = NULL; 3002 - raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); 2992 + __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL); 3003 2993 /* FIXME: make interruptible or killable somehow? */ 3004 2994 wait_event(common->fsg_wait, common->fsg != fsg); 3005 2995 }
+3 -2
drivers/usb/gadget/udc/renesas_usb3.c
··· 19 19 #include <linux/pm_runtime.h> 20 20 #include <linux/sizes.h> 21 21 #include <linux/slab.h> 22 + #include <linux/string.h> 22 23 #include <linux/sys_soc.h> 23 24 #include <linux/uaccess.h> 24 25 #include <linux/usb/ch9.h> ··· 2451 2450 if (usb3->forced_b_device) 2452 2451 return -EBUSY; 2453 2452 2454 - if (!strncmp(buf, "host", strlen("host"))) 2453 + if (sysfs_streq(buf, "host")) 2455 2454 new_mode_is_host = true; 2456 - else if (!strncmp(buf, "peripheral", strlen("peripheral"))) 2455 + else if (sysfs_streq(buf, "peripheral")) 2457 2456 new_mode_is_host = false; 2458 2457 else 2459 2458 return -EINVAL;
+4
drivers/usb/host/fotg210-hcd.c
··· 1629 1629 /* see what we found out */ 1630 1630 temp = check_reset_complete(fotg210, wIndex, status_reg, 1631 1631 fotg210_readl(fotg210, status_reg)); 1632 + 1633 + /* restart schedule */ 1634 + fotg210->command |= CMD_RUN; 1635 + fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command); 1632 1636 } 1633 1637 1634 1638 if (!(temp & (PORT_RESUME|PORT_RESET))) {
+10
drivers/usb/serial/option.c
··· 968 968 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7B) }, 969 969 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7C) }, 970 970 971 + /* Motorola devices */ 972 + { USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x2a70, 0xff, 0xff, 0xff) }, /* mdm6600 */ 973 + { USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x2e0a, 0xff, 0xff, 0xff) }, /* mdm9600 */ 974 + { USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x4281, 0x0a, 0x00, 0xfc) }, /* mdm ram dl */ 975 + { USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x900e, 0xff, 0xff, 0xff) }, /* mdm qc dl */ 971 976 972 977 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, 973 978 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, ··· 1554 1549 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G v2 */ 1555 1550 .driver_info = RSVD(2) }, 1556 1551 { USB_DEVICE_INTERFACE_CLASS(ZTE_VENDOR_ID, 0x1476, 0xff) }, /* GosunCn ZTE WeLink ME3630 (ECM/NCM mode) */ 1552 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1481, 0xff, 0x00, 0x00) }, /* ZTE MF871A */ 1557 1553 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) }, 1558 1554 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) }, 1559 1555 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) }, ··· 1958 1952 .driver_info = RSVD(4) }, 1959 1953 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e35, 0xff), /* D-Link DWM-222 */ 1960 1954 .driver_info = RSVD(4) }, 1955 + { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e3d, 0xff), /* D-Link DWM-222 A2 */ 1956 + .driver_info = RSVD(4) }, 1961 1957 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ 1962 1958 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ 1963 1959 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ 1964 1960 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */ 1961 + .driver_info = RSVD(4) }, 1962 + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2060, 0xff), /* BroadMobi BM818 */ 1965 1963 .driver_info = RSVD(4) }, 1966 1964 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ 1967 1965 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
+1 -1
include/linux/usb.h
··· 1457 1457 * field rather than determining a dma address themselves. 1458 1458 * 1459 1459 * Note that transfer_buffer must still be set if the controller 1460 - * does not support DMA (as indicated by bus.uses_dma) and when talking 1460 + * does not support DMA (as indicated by hcd_uses_dma()) and when talking 1461 1461 * to root hub. If you have to trasfer between highmem zone and the device 1462 1462 * on such controller, create a bounce buffer or bail out with an error. 1463 1463 * If transfer_buffer cannot be set (is in highmem) and the controller is DMA
+3
include/linux/usb/hcd.h
··· 422 422 return hcd->high_prio_bh.completing_ep == ep; 423 423 } 424 424 425 + #define hcd_uses_dma(hcd) \ 426 + (IS_ENABLED(CONFIG_HAS_DMA) && (hcd)->self.uses_dma) 427 + 425 428 extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 426 429 extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, 427 430 int status);