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

Pull USB fixes from Greg KH:
"Here are a number of USB driver fixes for 5.7-rc3.

Nothing huge, just the usual collection of:

- xhci fixes

- gadget driver fixes

- syzkaller fuzzing fixes

- new device ids and DT bindings

- new quirks added for broken devices

A few of the gadget driver fixes show up twice here as they were
applied to my branch, and also by Felipe to his branch which I then
pulled in as we got out of sync a bit.

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

* tag 'usb-5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (33 commits)
USB: sisusbvga: Change port variable from signed to unsigned
usb-storage: Add unusual_devs entry for JMicron JMS566
USB: hub: Revert commit bd0e6c9614b9 ("usb: hub: try old enumeration scheme first for high speed devices")
USB: hub: Fix handling of connect changes during sleep
usb: typec: altmode: Fix typec_altmode_get_partner sometimes returning an invalid pointer
xhci: Don't clear hub TT buffer on ep0 protocol stall
xhci: prevent bus suspend if a roothub port detected a over-current condition
xhci: Fix handling halted endpoint even if endpoint ring appears empty
usb: raw-gadget: Fix copy_to/from_user() checks
usb: raw-gadget: fix raw_event_queue_fetch locking
usb: gadget: udc: atmel: Fix vbus disconnect handling
usb: dwc3: gadget: Fix request completion check
USB: Add USB_QUIRK_DELAY_CTRL_MSG and USB_QUIRK_DELAY_INIT for Corsair K70 RGB RAPIDFIRE
phy: tegra: Select USB_COMMON for usb_get_maximum_speed()
usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change
usb: f_fs: Clear OS Extended descriptor counts to zero in ffs_data_reset()
cdc-acm: introduce a cool down
cdc-acm: close race betrween suspend() and acm_softint
UAS: fix deadlock in error handling and PM flushing work
UAS: no use logging any details in case of ENODEV
...

+349 -121
+1 -2
Documentation/admin-guide/kernel-parameters.txt
··· 5187 5187 5188 5188 usbcore.old_scheme_first= 5189 5189 [USB] Start with the old device initialization 5190 - scheme, applies only to low and full-speed devices 5191 - (default 0 = off). 5190 + scheme (default 0 = off). 5192 5191 5193 5192 usbcore.usbfs_memory_mb= 5194 5193 [USB] Memory limit (in MB) for buffers allocated by
+1
Documentation/devicetree/bindings/usb/renesas,usb3-peri.yaml
··· 18 18 - renesas,r8a774c0-usb3-peri # RZ/G2E 19 19 - renesas,r8a7795-usb3-peri # R-Car H3 20 20 - renesas,r8a7796-usb3-peri # R-Car M3-W 21 + - renesas,r8a77961-usb3-peri # R-Car M3-W+ 21 22 - renesas,r8a77965-usb3-peri # R-Car M3-N 22 23 - renesas,r8a77990-usb3-peri # R-Car E3 23 24 - const: renesas,rcar-gen3-usb3-peri
+1
Documentation/devicetree/bindings/usb/renesas,usbhs.yaml
··· 40 40 - renesas,usbhs-r8a774c0 # RZ/G2E 41 41 - renesas,usbhs-r8a7795 # R-Car H3 42 42 - renesas,usbhs-r8a7796 # R-Car M3-W 43 + - renesas,usbhs-r8a77961 # R-Car M3-W+ 43 44 - renesas,usbhs-r8a77965 # R-Car M3-N 44 45 - renesas,usbhs-r8a77990 # R-Car E3 45 46 - renesas,usbhs-r8a77995 # R-Car D3
+2 -1
Documentation/devicetree/bindings/usb/usb-xhci.txt
··· 16 16 - "renesas,xhci-r8a7791" for r8a7791 SoC 17 17 - "renesas,xhci-r8a7793" for r8a7793 SoC 18 18 - "renesas,xhci-r8a7795" for r8a7795 SoC 19 - - "renesas,xhci-r8a7796" for r8a7796 SoC 19 + - "renesas,xhci-r8a7796" for r8a77960 SoC 20 + - "renesas,xhci-r8a77961" for r8a77961 SoC 20 21 - "renesas,xhci-r8a77965" for r8a77965 SoC 21 22 - "renesas,xhci-r8a77990" for r8a77990 SoC 22 23 - "renesas,rcar-gen2-xhci" for a generic R-Car Gen2 or RZ/G1 compatible
+2 -1
drivers/phy/tegra/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 config PHY_TEGRA_XUSB 3 3 tristate "NVIDIA Tegra XUSB pad controller driver" 4 - depends on ARCH_TEGRA 4 + depends on ARCH_TEGRA && USB_SUPPORT 5 + select USB_COMMON 5 6 select USB_CONN_GPIO 6 7 select USB_PHY 7 8 help
+31 -5
drivers/usb/class/cdc-acm.c
··· 412 412 413 413 exit: 414 414 retval = usb_submit_urb(urb, GFP_ATOMIC); 415 - if (retval && retval != -EPERM) 415 + if (retval && retval != -EPERM && retval != -ENODEV) 416 416 dev_err(&acm->control->dev, 417 417 "%s - usb_submit_urb failed: %d\n", __func__, retval); 418 + else 419 + dev_vdbg(&acm->control->dev, 420 + "control resubmission terminated %d\n", retval); 418 421 } 419 422 420 423 static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags) ··· 433 430 dev_err(&acm->data->dev, 434 431 "urb %d failed submission with %d\n", 435 432 index, res); 433 + } else { 434 + dev_vdbg(&acm->data->dev, "intended failure %d\n", res); 436 435 } 437 436 set_bit(index, &acm->read_urbs_free); 438 437 return res; ··· 476 471 int status = urb->status; 477 472 bool stopped = false; 478 473 bool stalled = false; 474 + bool cooldown = false; 479 475 480 476 dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", 481 477 rb->index, urb->actual_length, status); ··· 503 497 __func__, status); 504 498 stopped = true; 505 499 break; 500 + case -EOVERFLOW: 501 + case -EPROTO: 502 + dev_dbg(&acm->data->dev, 503 + "%s - cooling babbling device\n", __func__); 504 + usb_mark_last_busy(acm->dev); 505 + set_bit(rb->index, &acm->urbs_in_error_delay); 506 + cooldown = true; 507 + break; 506 508 default: 507 509 dev_dbg(&acm->data->dev, 508 510 "%s - nonzero urb status received: %d\n", ··· 532 518 */ 533 519 smp_mb__after_atomic(); 534 520 535 - if (stopped || stalled) { 521 + if (stopped || stalled || cooldown) { 536 522 if (stalled) 537 523 schedule_work(&acm->work); 524 + else if (cooldown) 525 + schedule_delayed_work(&acm->dwork, HZ / 2); 538 526 return; 539 527 } 540 528 ··· 573 557 struct acm *acm = container_of(work, struct acm, work); 574 558 575 559 if (test_bit(EVENT_RX_STALL, &acm->flags)) { 576 - if (!(usb_autopm_get_interface(acm->data))) { 560 + smp_mb(); /* against acm_suspend() */ 561 + if (!acm->susp_count) { 577 562 for (i = 0; i < acm->rx_buflimit; i++) 578 563 usb_kill_urb(acm->read_urbs[i]); 579 564 usb_clear_halt(acm->dev, acm->in); 580 565 acm_submit_read_urbs(acm, GFP_KERNEL); 581 - usb_autopm_put_interface(acm->data); 566 + clear_bit(EVENT_RX_STALL, &acm->flags); 582 567 } 583 - clear_bit(EVENT_RX_STALL, &acm->flags); 568 + } 569 + 570 + if (test_and_clear_bit(ACM_ERROR_DELAY, &acm->flags)) { 571 + for (i = 0; i < ACM_NR; i++) 572 + if (test_and_clear_bit(i, &acm->urbs_in_error_delay)) 573 + acm_submit_read_urb(acm, i, GFP_NOIO); 584 574 } 585 575 586 576 if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags)) ··· 1355 1333 acm->readsize = readsize; 1356 1334 acm->rx_buflimit = num_rx_buf; 1357 1335 INIT_WORK(&acm->work, acm_softint); 1336 + INIT_DELAYED_WORK(&acm->dwork, acm_softint); 1358 1337 init_waitqueue_head(&acm->wioctl); 1359 1338 spin_lock_init(&acm->write_lock); 1360 1339 spin_lock_init(&acm->read_lock); ··· 1565 1542 1566 1543 acm_kill_urbs(acm); 1567 1544 cancel_work_sync(&acm->work); 1545 + cancel_delayed_work_sync(&acm->dwork); 1568 1546 1569 1547 tty_unregister_device(acm_tty_driver, acm->minor); 1570 1548 ··· 1608 1584 1609 1585 acm_kill_urbs(acm); 1610 1586 cancel_work_sync(&acm->work); 1587 + cancel_delayed_work_sync(&acm->dwork); 1588 + acm->urbs_in_error_delay = 0; 1611 1589 1612 1590 return 0; 1613 1591 }
+4 -1
drivers/usb/class/cdc-acm.h
··· 109 109 # define EVENT_TTY_WAKEUP 0 110 110 # define EVENT_RX_STALL 1 111 111 # define ACM_THROTTLED 2 112 + # define ACM_ERROR_DELAY 3 113 + unsigned long urbs_in_error_delay; /* these need to be restarted after a delay */ 112 114 struct usb_cdc_line_coding line; /* bits, stop, parity */ 113 - struct work_struct work; /* work queue entry for line discipline waking up */ 115 + struct work_struct work; /* work queue entry for various purposes*/ 116 + struct delayed_work dwork; /* for cool downs needed in error recovery */ 114 117 unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ 115 118 unsigned int ctrlout; /* output control lines (DTR, RTS) */ 116 119 struct async_icount iocount; /* counters for control line changes */
+15 -3
drivers/usb/core/hub.c
··· 1223 1223 #ifdef CONFIG_PM 1224 1224 udev->reset_resume = 1; 1225 1225 #endif 1226 + /* Don't set the change_bits when the device 1227 + * was powered off. 1228 + */ 1229 + if (test_bit(port1, hub->power_bits)) 1230 + set_bit(port1, hub->change_bits); 1226 1231 1227 1232 } else { 1228 1233 /* The power session is gone; tell hub_wq */ ··· 2728 2723 { 2729 2724 int old_scheme_first_port = 2730 2725 port_dev->quirks & USB_PORT_QUIRK_OLD_SCHEME; 2731 - int quick_enumeration = (udev->speed == USB_SPEED_HIGH); 2732 2726 2733 2727 if (udev->speed >= USB_SPEED_SUPER) 2734 2728 return false; 2735 2729 2736 - return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first 2737 - || quick_enumeration); 2730 + return USE_NEW_SCHEME(retry, old_scheme_first_port || old_scheme_first); 2738 2731 } 2739 2732 2740 2733 /* Is a USB 3.0 port in the Inactive or Compliance Mode state? ··· 3091 3088 if (portchange & USB_PORT_STAT_C_ENABLE) 3092 3089 usb_clear_port_feature(hub->hdev, port1, 3093 3090 USB_PORT_FEAT_C_ENABLE); 3091 + 3092 + /* 3093 + * Whatever made this reset-resume necessary may have 3094 + * turned on the port1 bit in hub->change_bits. But after 3095 + * a successful reset-resume we want the bit to be clear; 3096 + * if it was on it would indicate that something happened 3097 + * following the reset-resume. 3098 + */ 3099 + clear_bit(port1, hub->change_bits); 3094 3100 } 3095 3101 3096 3102 return status;
+8 -1
drivers/usb/core/message.c
··· 589 589 int i, retval; 590 590 591 591 spin_lock_irqsave(&io->lock, flags); 592 - if (io->status) { 592 + if (io->status || io->count == 0) { 593 593 spin_unlock_irqrestore(&io->lock, flags); 594 594 return; 595 595 } 596 596 /* shut everything down */ 597 597 io->status = -ECONNRESET; 598 + io->count++; /* Keep the request alive until we're done */ 598 599 spin_unlock_irqrestore(&io->lock, flags); 599 600 600 601 for (i = io->entries - 1; i >= 0; --i) { ··· 609 608 dev_warn(&io->dev->dev, "%s, unlink --> %d\n", 610 609 __func__, retval); 611 610 } 611 + 612 + spin_lock_irqsave(&io->lock, flags); 613 + io->count--; 614 + if (!io->count) 615 + complete(&io->complete); 616 + spin_unlock_irqrestore(&io->lock, flags); 612 617 } 613 618 EXPORT_SYMBOL_GPL(usb_sg_cancel); 614 619
+4
drivers/usb/core/quirks.c
··· 430 430 /* Corsair K70 LUX */ 431 431 { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, 432 432 433 + /* Corsair K70 RGB RAPDIFIRE */ 434 + { USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT | 435 + USB_QUIRK_DELAY_CTRL_MSG }, 436 + 433 437 /* MIDI keyboard WORLDE MINI */ 434 438 { USB_DEVICE(0x1c75, 0x0204), .driver_info = 435 439 USB_QUIRK_CONFIG_INTF_STRINGS },
+6 -2
drivers/usb/dwc3/core.h
··· 307 307 308 308 /* Global TX Fifo Size Register */ 309 309 #define DWC31_GTXFIFOSIZ_TXFRAMNUM BIT(15) /* DWC_usb31 only */ 310 - #define DWC31_GTXFIFOSIZ_TXFDEF(n) ((n) & 0x7fff) /* DWC_usb31 only */ 311 - #define DWC3_GTXFIFOSIZ_TXFDEF(n) ((n) & 0xffff) 310 + #define DWC31_GTXFIFOSIZ_TXFDEP(n) ((n) & 0x7fff) /* DWC_usb31 only */ 311 + #define DWC3_GTXFIFOSIZ_TXFDEP(n) ((n) & 0xffff) 312 312 #define DWC3_GTXFIFOSIZ_TXFSTADDR(n) ((n) & 0xffff0000) 313 + 314 + /* Global RX Fifo Size Register */ 315 + #define DWC31_GRXFIFOSIZ_RXFDEP(n) ((n) & 0x7fff) /* DWC_usb31 only */ 316 + #define DWC3_GRXFIFOSIZ_RXFDEP(n) ((n) & 0xffff) 313 317 314 318 /* Global Event Size Registers */ 315 319 #define DWC3_GEVNTSIZ_INTMASK BIT(31)
+47 -29
drivers/usb/dwc3/gadget.c
··· 1728 1728 u32 reg; 1729 1729 1730 1730 u8 link_state; 1731 - u8 speed; 1732 1731 1733 1732 /* 1734 1733 * According to the Databook Remote wakeup request should ··· 1737 1738 */ 1738 1739 reg = dwc3_readl(dwc->regs, DWC3_DSTS); 1739 1740 1740 - speed = reg & DWC3_DSTS_CONNECTSPD; 1741 - if ((speed == DWC3_DSTS_SUPERSPEED) || 1742 - (speed == DWC3_DSTS_SUPERSPEED_PLUS)) 1743 - return 0; 1744 - 1745 1741 link_state = DWC3_DSTS_USBLNKST(reg); 1746 1742 1747 1743 switch (link_state) { 1744 + case DWC3_LINK_STATE_RESET: 1748 1745 case DWC3_LINK_STATE_RX_DET: /* in HS, means Early Suspend */ 1749 1746 case DWC3_LINK_STATE_U3: /* in HS, means SUSPEND */ 1747 + case DWC3_LINK_STATE_RESUME: 1750 1748 break; 1751 1749 default: 1752 1750 return -EINVAL; ··· 2223 2227 { 2224 2228 struct dwc3 *dwc = dep->dwc; 2225 2229 int mdwidth; 2226 - int kbytes; 2227 2230 int size; 2228 2231 2229 2232 mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0); ··· 2231 2236 2232 2237 size = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(dep->number >> 1)); 2233 2238 if (dwc3_is_usb31(dwc)) 2234 - size = DWC31_GTXFIFOSIZ_TXFDEF(size); 2239 + size = DWC31_GTXFIFOSIZ_TXFDEP(size); 2235 2240 else 2236 - size = DWC3_GTXFIFOSIZ_TXFDEF(size); 2241 + size = DWC3_GTXFIFOSIZ_TXFDEP(size); 2237 2242 2238 2243 /* FIFO Depth is in MDWDITH bytes. Multiply */ 2239 2244 size *= mdwidth; 2240 2245 2241 - kbytes = size / 1024; 2242 - if (kbytes == 0) 2243 - kbytes = 1; 2244 - 2245 2246 /* 2246 - * FIFO sizes account an extra MDWIDTH * (kbytes + 1) bytes for 2247 - * internal overhead. We don't really know how these are used, 2248 - * but documentation say it exists. 2247 + * To meet performance requirement, a minimum TxFIFO size of 3x 2248 + * MaxPacketSize is recommended for endpoints that support burst and a 2249 + * minimum TxFIFO size of 2x MaxPacketSize for endpoints that don't 2250 + * support burst. Use those numbers and we can calculate the max packet 2251 + * limit as below. 2249 2252 */ 2250 - size -= mdwidth * (kbytes + 1); 2251 - size /= kbytes; 2253 + if (dwc->maximum_speed >= USB_SPEED_SUPER) 2254 + size /= 3; 2255 + else 2256 + size /= 2; 2252 2257 2253 2258 usb_ep_set_maxpacket_limit(&dep->endpoint, size); 2254 2259 ··· 2266 2271 static int dwc3_gadget_init_out_endpoint(struct dwc3_ep *dep) 2267 2272 { 2268 2273 struct dwc3 *dwc = dep->dwc; 2274 + int mdwidth; 2275 + int size; 2269 2276 2270 - usb_ep_set_maxpacket_limit(&dep->endpoint, 1024); 2277 + mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0); 2278 + 2279 + /* MDWIDTH is represented in bits, convert to bytes */ 2280 + mdwidth /= 8; 2281 + 2282 + /* All OUT endpoints share a single RxFIFO space */ 2283 + size = dwc3_readl(dwc->regs, DWC3_GRXFIFOSIZ(0)); 2284 + if (dwc3_is_usb31(dwc)) 2285 + size = DWC31_GRXFIFOSIZ_RXFDEP(size); 2286 + else 2287 + size = DWC3_GRXFIFOSIZ_RXFDEP(size); 2288 + 2289 + /* FIFO depth is in MDWDITH bytes */ 2290 + size *= mdwidth; 2291 + 2292 + /* 2293 + * To meet performance requirement, a minimum recommended RxFIFO size 2294 + * is defined as follow: 2295 + * RxFIFO size >= (3 x MaxPacketSize) + 2296 + * (3 x 8 bytes setup packets size) + (16 bytes clock crossing margin) 2297 + * 2298 + * Then calculate the max packet limit as below. 2299 + */ 2300 + size -= (3 * 8) + 16; 2301 + if (size < 0) 2302 + size = 0; 2303 + else 2304 + size /= 3; 2305 + 2306 + usb_ep_set_maxpacket_limit(&dep->endpoint, size); 2271 2307 dep->endpoint.max_streams = 15; 2272 2308 dep->endpoint.ops = &dwc3_gadget_ep_ops; 2273 2309 list_add_tail(&dep->endpoint.ep_list, ··· 2510 2484 2511 2485 static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) 2512 2486 { 2513 - /* 2514 - * For OUT direction, host may send less than the setup 2515 - * length. Return true for all OUT requests. 2516 - */ 2517 - if (!req->direction) 2518 - return true; 2519 - 2520 - return req->request.actual == req->request.length; 2487 + return req->num_pending_sgs == 0; 2521 2488 } 2522 2489 2523 2490 static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, ··· 2534 2515 2535 2516 req->request.actual = req->request.length - req->remaining; 2536 2517 2537 - if (!dwc3_gadget_ep_request_completed(req) || 2538 - req->num_pending_sgs) { 2518 + if (!dwc3_gadget_ep_request_completed(req)) { 2539 2519 __dwc3_gadget_kick_transfer(dep); 2540 2520 goto out; 2541 2521 }
+4 -4
drivers/usb/early/xhci-dbc.c
··· 728 728 case COMP_USB_TRANSACTION_ERROR: 729 729 case COMP_STALL_ERROR: 730 730 default: 731 - if (ep_id == XDBC_EPID_OUT) 731 + if (ep_id == XDBC_EPID_OUT || ep_id == XDBC_EPID_OUT_INTEL) 732 732 xdbc.flags |= XDBC_FLAGS_OUT_STALL; 733 - if (ep_id == XDBC_EPID_IN) 733 + if (ep_id == XDBC_EPID_IN || ep_id == XDBC_EPID_IN_INTEL) 734 734 xdbc.flags |= XDBC_FLAGS_IN_STALL; 735 735 736 736 xdbc_trace("endpoint %d stalled\n", ep_id); 737 737 break; 738 738 } 739 739 740 - if (ep_id == XDBC_EPID_IN) { 740 + if (ep_id == XDBC_EPID_IN || ep_id == XDBC_EPID_IN_INTEL) { 741 741 xdbc.flags &= ~XDBC_FLAGS_IN_PROCESS; 742 742 xdbc_bulk_transfer(NULL, XDBC_MAX_PACKET, true); 743 - } else if (ep_id == XDBC_EPID_OUT) { 743 + } else if (ep_id == XDBC_EPID_OUT || ep_id == XDBC_EPID_OUT_INTEL) { 744 744 xdbc.flags &= ~XDBC_FLAGS_OUT_PROCESS; 745 745 } else { 746 746 xdbc_trace("invalid endpoint id %d\n", ep_id);
+16 -2
drivers/usb/early/xhci-dbc.h
··· 120 120 u32 cycle_state; 121 121 }; 122 122 123 - #define XDBC_EPID_OUT 2 124 - #define XDBC_EPID_IN 3 123 + /* 124 + * These are the "Endpoint ID" (also known as "Context Index") values for the 125 + * OUT Transfer Ring and the IN Transfer Ring of a Debug Capability Context data 126 + * structure. 127 + * According to the "eXtensible Host Controller Interface for Universal Serial 128 + * Bus (xHCI)" specification, section "7.6.3.2 Endpoint Contexts and Transfer 129 + * Rings", these should be 0 and 1, and those are the values AMD machines give 130 + * you; but Intel machines seem to use the formula from section "4.5.1 Device 131 + * Context Index", which is supposed to be used for the Device Context only. 132 + * Luckily the values from Intel don't overlap with those from AMD, so we can 133 + * just test for both. 134 + */ 135 + #define XDBC_EPID_OUT 0 136 + #define XDBC_EPID_IN 1 137 + #define XDBC_EPID_OUT_INTEL 2 138 + #define XDBC_EPID_IN_INTEL 3 125 139 126 140 struct xdbc_state { 127 141 u16 vendor;
+4
drivers/usb/gadget/function/f_fs.c
··· 1813 1813 ffs->state = FFS_READ_DESCRIPTORS; 1814 1814 ffs->setup_state = FFS_NO_SETUP; 1815 1815 ffs->flags = 0; 1816 + 1817 + ffs->ms_os_descs_ext_prop_count = 0; 1818 + ffs->ms_os_descs_ext_prop_name_len = 0; 1819 + ffs->ms_os_descs_ext_prop_data_len = 0; 1816 1820 } 1817 1821 1818 1822
+42 -29
drivers/usb/gadget/legacy/raw_gadget.c
··· 81 81 static struct usb_raw_event *raw_event_queue_fetch( 82 82 struct raw_event_queue *queue) 83 83 { 84 + int ret; 84 85 unsigned long flags; 85 86 struct usb_raw_event *event; 86 87 ··· 90 89 * there's at least one event queued by decrementing the semaphore, 91 90 * and then take the lock to protect queue struct fields. 92 91 */ 93 - if (down_interruptible(&queue->sema)) 94 - return NULL; 92 + ret = down_interruptible(&queue->sema); 93 + if (ret) 94 + return ERR_PTR(ret); 95 95 spin_lock_irqsave(&queue->lock, flags); 96 - if (WARN_ON(!queue->size)) 97 - return NULL; 96 + /* 97 + * queue->size must have the same value as queue->sema counter (before 98 + * the down_interruptible() call above), so this check is a fail-safe. 99 + */ 100 + if (WARN_ON(!queue->size)) { 101 + spin_unlock_irqrestore(&queue->lock, flags); 102 + return ERR_PTR(-ENODEV); 103 + } 98 104 event = queue->events[0]; 99 105 queue->size--; 100 106 memmove(&queue->events[0], &queue->events[1], ··· 400 392 char *udc_device_name; 401 393 unsigned long flags; 402 394 403 - ret = copy_from_user(&arg, (void __user *)value, sizeof(arg)); 404 - if (ret) 405 - return ret; 395 + if (copy_from_user(&arg, (void __user *)value, sizeof(arg))) 396 + return -EFAULT; 406 397 407 398 switch (arg.speed) { 408 399 case USB_SPEED_UNKNOWN: ··· 508 501 509 502 static int raw_ioctl_event_fetch(struct raw_dev *dev, unsigned long value) 510 503 { 511 - int ret = 0; 512 504 struct usb_raw_event arg; 513 505 unsigned long flags; 514 506 struct usb_raw_event *event; 515 507 uint32_t length; 516 508 517 - ret = copy_from_user(&arg, (void __user *)value, sizeof(arg)); 518 - if (ret) 519 - return ret; 509 + if (copy_from_user(&arg, (void __user *)value, sizeof(arg))) 510 + return -EFAULT; 520 511 521 512 spin_lock_irqsave(&dev->lock, flags); 522 513 if (dev->state != STATE_DEV_RUNNING) { ··· 530 525 spin_unlock_irqrestore(&dev->lock, flags); 531 526 532 527 event = raw_event_queue_fetch(&dev->queue); 533 - if (!event) { 528 + if (PTR_ERR(event) == -EINTR) { 534 529 dev_dbg(&dev->gadget->dev, "event fetching interrupted\n"); 535 530 return -EINTR; 536 531 } 532 + if (IS_ERR(event)) { 533 + dev_err(&dev->gadget->dev, "failed to fetch event\n"); 534 + spin_lock_irqsave(&dev->lock, flags); 535 + dev->state = STATE_DEV_FAILED; 536 + spin_unlock_irqrestore(&dev->lock, flags); 537 + return -ENODEV; 538 + } 537 539 length = min(arg.length, event->length); 538 - ret = copy_to_user((void __user *)value, event, 539 - sizeof(*event) + length); 540 - return ret; 540 + if (copy_to_user((void __user *)value, event, sizeof(*event) + length)) 541 + return -EFAULT; 542 + 543 + return 0; 541 544 } 542 545 543 546 static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, 544 547 bool get_from_user) 545 548 { 546 - int ret; 547 549 void *data; 548 550 549 - ret = copy_from_user(io, ptr, sizeof(*io)); 550 - if (ret) 551 - return ERR_PTR(ret); 551 + if (copy_from_user(io, ptr, sizeof(*io))) 552 + return ERR_PTR(-EFAULT); 552 553 if (io->ep >= USB_RAW_MAX_ENDPOINTS) 553 554 return ERR_PTR(-EINVAL); 554 555 if (!usb_raw_io_flags_valid(io->flags)) ··· 669 658 if (IS_ERR(data)) 670 659 return PTR_ERR(data); 671 660 ret = raw_process_ep0_io(dev, &io, data, false); 672 - if (ret < 0) { 673 - kfree(data); 674 - return ret; 675 - } 661 + if (ret) 662 + goto free; 663 + 676 664 length = min(io.length, (unsigned int)ret); 677 - ret = copy_to_user((void __user *)(value + sizeof(io)), data, length); 665 + if (copy_to_user((void __user *)(value + sizeof(io)), data, length)) 666 + ret = -EFAULT; 667 + free: 678 668 kfree(data); 679 669 return ret; 680 670 } ··· 964 952 if (IS_ERR(data)) 965 953 return PTR_ERR(data); 966 954 ret = raw_process_ep_io(dev, &io, data, false); 967 - if (ret < 0) { 968 - kfree(data); 969 - return ret; 970 - } 955 + if (ret) 956 + goto free; 957 + 971 958 length = min(io.length, (unsigned int)ret); 972 - ret = copy_to_user((void __user *)(value + sizeof(io)), data, length); 959 + if (copy_to_user((void __user *)(value + sizeof(io)), data, length)) 960 + ret = -EFAULT; 961 + free: 973 962 kfree(data); 974 963 return ret; 975 964 }
+2 -2
drivers/usb/gadget/udc/atmel_usba_udc.c
··· 1951 1951 usba_start(udc); 1952 1952 } else { 1953 1953 udc->suspended = false; 1954 - usba_stop(udc); 1955 - 1956 1954 if (udc->driver->disconnect) 1957 1955 udc->driver->disconnect(&udc->gadget); 1956 + 1957 + usba_stop(udc); 1958 1958 } 1959 1959 udc->vbus_prev = vbus; 1960 1960 }
+1 -1
drivers/usb/gadget/udc/bdc/bdc_ep.c
··· 540 540 { 541 541 struct bdc *bdc = ep->bdc; 542 542 543 - if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) 543 + if (req == NULL) 544 544 return; 545 545 546 546 dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status);
+9
drivers/usb/host/xhci-hub.c
··· 1571 1571 } 1572 1572 if ((temp & PORT_RC)) 1573 1573 reset_change = true; 1574 + if (temp & PORT_OC) 1575 + status = 1; 1574 1576 } 1575 1577 if (!status && !reset_change) { 1576 1578 xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); ··· 1637 1635 xhci_dbg(xhci, "port %d polling in bus suspend, waiting\n", 1638 1636 port_index); 1639 1637 goto retry; 1638 + } 1639 + /* bail out if port detected a over-current condition */ 1640 + if (t1 & PORT_OC) { 1641 + bus_state->bus_suspended = 0; 1642 + spin_unlock_irqrestore(&xhci->lock, flags); 1643 + xhci_dbg(xhci, "Bus suspend bailout, port over-current detected\n"); 1644 + return -EBUSY; 1640 1645 } 1641 1646 /* suspend ports in U0, or bail out for new connect changes */ 1642 1647 if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) {
+40 -6
drivers/usb/host/xhci-ring.c
··· 547 547 stream_id); 548 548 return; 549 549 } 550 + /* 551 + * A cancelled TD can complete with a stall if HW cached the trb. 552 + * In this case driver can't find cur_td, but if the ring is empty we 553 + * can move the dequeue pointer to the current enqueue position. 554 + */ 555 + if (!cur_td) { 556 + if (list_empty(&ep_ring->td_list)) { 557 + state->new_deq_seg = ep_ring->enq_seg; 558 + state->new_deq_ptr = ep_ring->enqueue; 559 + state->new_cycle_state = ep_ring->cycle_state; 560 + goto done; 561 + } else { 562 + xhci_warn(xhci, "Can't find new dequeue state, missing cur_td\n"); 563 + return; 564 + } 565 + } 566 + 550 567 /* Dig out the cycle state saved by the xHC during the stop ep cmd */ 551 568 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, 552 569 "Finding endpoint context"); ··· 609 592 state->new_deq_seg = new_seg; 610 593 state->new_deq_ptr = new_deq; 611 594 595 + done: 612 596 /* Don't update the ring cycle state for the producer (us). */ 613 597 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, 614 598 "Cycle state = 0x%x", state->new_cycle_state); ··· 1874 1856 1875 1857 if (reset_type == EP_HARD_RESET) { 1876 1858 ep->ep_state |= EP_HARD_CLEAR_TOGGLE; 1877 - xhci_cleanup_stalled_ring(xhci, ep_index, stream_id, td); 1878 - xhci_clear_hub_tt_buffer(xhci, td, ep); 1859 + xhci_cleanup_stalled_ring(xhci, slot_id, ep_index, stream_id, 1860 + td); 1879 1861 } 1880 1862 xhci_ring_cmd_db(xhci); 1881 1863 } ··· 1996 1978 if (trb_comp_code == COMP_STALL_ERROR || 1997 1979 xhci_requires_manual_halt_cleanup(xhci, ep_ctx, 1998 1980 trb_comp_code)) { 1999 - /* Issue a reset endpoint command to clear the host side 2000 - * halt, followed by a set dequeue command to move the 2001 - * dequeue pointer past the TD. 2002 - * The class driver clears the device side halt later. 1981 + /* 1982 + * xhci internal endpoint state will go to a "halt" state for 1983 + * any stall, including default control pipe protocol stall. 1984 + * To clear the host side halt we need to issue a reset endpoint 1985 + * command, followed by a set dequeue command to move past the 1986 + * TD. 1987 + * Class drivers clear the device side halt from a functional 1988 + * stall later. Hub TT buffer should only be cleared for FS/LS 1989 + * devices behind HS hubs for functional stalls. 2003 1990 */ 1991 + if ((ep_index != 0) || (trb_comp_code != COMP_STALL_ERROR)) 1992 + xhci_clear_hub_tt_buffer(xhci, td, ep); 2004 1993 xhci_cleanup_halted_endpoint(xhci, slot_id, ep_index, 2005 1994 ep_ring->stream_id, td, EP_HARD_RESET); 2006 1995 } else { ··· 2563 2538 ep->skip = false; 2564 2539 xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n", 2565 2540 slot_id, ep_index); 2541 + } 2542 + if (trb_comp_code == COMP_STALL_ERROR || 2543 + xhci_requires_manual_halt_cleanup(xhci, ep_ctx, 2544 + trb_comp_code)) { 2545 + xhci_cleanup_halted_endpoint(xhci, slot_id, 2546 + ep_index, 2547 + ep_ring->stream_id, 2548 + NULL, 2549 + EP_HARD_RESET); 2566 2550 } 2567 2551 goto cleanup; 2568 2552 }
+7 -7
drivers/usb/host/xhci.c
··· 3031 3031 added_ctxs, added_ctxs); 3032 3032 } 3033 3033 3034 - void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, 3035 - unsigned int stream_id, struct xhci_td *td) 3034 + void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int slot_id, 3035 + unsigned int ep_index, unsigned int stream_id, 3036 + struct xhci_td *td) 3036 3037 { 3037 3038 struct xhci_dequeue_state deq_state; 3038 - struct usb_device *udev = td->urb->dev; 3039 3039 3040 3040 xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, 3041 3041 "Cleaning up stalled endpoint ring"); 3042 3042 /* We need to move the HW's dequeue pointer past this TD, 3043 3043 * or it will attempt to resend it on the next doorbell ring. 3044 3044 */ 3045 - xhci_find_new_dequeue_state(xhci, udev->slot_id, 3046 - ep_index, stream_id, td, &deq_state); 3045 + xhci_find_new_dequeue_state(xhci, slot_id, ep_index, stream_id, td, 3046 + &deq_state); 3047 3047 3048 3048 if (!deq_state.new_deq_ptr || !deq_state.new_deq_seg) 3049 3049 return; ··· 3054 3054 if (!(xhci->quirks & XHCI_RESET_EP_QUIRK)) { 3055 3055 xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, 3056 3056 "Queueing new dequeue state"); 3057 - xhci_queue_new_dequeue_state(xhci, udev->slot_id, 3057 + xhci_queue_new_dequeue_state(xhci, slot_id, 3058 3058 ep_index, &deq_state); 3059 3059 } else { 3060 3060 /* Better hope no one uses the input context between now and the ··· 3065 3065 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, 3066 3066 "Setting up input context for " 3067 3067 "configure endpoint command"); 3068 - xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, 3068 + xhci_setup_input_ctx_for_quirk(xhci, slot_id, 3069 3069 ep_index, &deq_state); 3070 3070 } 3071 3071 }
+3 -2
drivers/usb/host/xhci.h
··· 2116 2116 void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, 2117 2117 unsigned int slot_id, unsigned int ep_index, 2118 2118 struct xhci_dequeue_state *deq_state); 2119 - void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, 2120 - unsigned int stream_id, struct xhci_td *td); 2119 + void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int slot_id, 2120 + unsigned int ep_index, unsigned int stream_id, 2121 + struct xhci_td *td); 2121 2122 void xhci_stop_endpoint_command_watchdog(struct timer_list *t); 2122 2123 void xhci_handle_command_timeout(struct work_struct *work); 2123 2124
+10 -10
drivers/usb/misc/sisusbvga/sisusb.c
··· 1199 1199 /* High level: Gfx (indexed) register access */ 1200 1200 1201 1201 #ifdef CONFIG_USB_SISUSBVGA_CON 1202 - int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) 1202 + int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data) 1203 1203 { 1204 1204 return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); 1205 1205 } 1206 1206 1207 - int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) 1207 + int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 *data) 1208 1208 { 1209 1209 return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); 1210 1210 } 1211 1211 #endif 1212 1212 1213 - int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, 1213 + int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, 1214 1214 u8 index, u8 data) 1215 1215 { 1216 1216 int ret; ··· 1220 1220 return ret; 1221 1221 } 1222 1222 1223 - int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, 1223 + int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, 1224 1224 u8 index, u8 *data) 1225 1225 { 1226 1226 int ret; ··· 1230 1230 return ret; 1231 1231 } 1232 1232 1233 - int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, 1233 + int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, u8 idx, 1234 1234 u8 myand, u8 myor) 1235 1235 { 1236 1236 int ret; ··· 1245 1245 } 1246 1246 1247 1247 static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, 1248 - int port, u8 idx, u8 data, u8 mask) 1248 + u32 port, u8 idx, u8 data, u8 mask) 1249 1249 { 1250 1250 int ret; 1251 1251 u8 tmp; ··· 1258 1258 return ret; 1259 1259 } 1260 1260 1261 - int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, 1261 + int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, 1262 1262 u8 index, u8 myor) 1263 1263 { 1264 1264 return sisusb_setidxregandor(sisusb, port, index, 0xff, myor); 1265 1265 } 1266 1266 1267 - int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, 1267 + int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, 1268 1268 u8 idx, u8 myand) 1269 1269 { 1270 1270 return sisusb_setidxregandor(sisusb, port, idx, myand, 0x00); ··· 2785 2785 static int sisusb_handle_command(struct sisusb_usb_data *sisusb, 2786 2786 struct sisusb_command *y, unsigned long arg) 2787 2787 { 2788 - int retval, port, length; 2789 - u32 address; 2788 + int retval, length; 2789 + u32 port, address; 2790 2790 2791 2791 /* All our commands require the device 2792 2792 * to be initialized.
+7 -7
drivers/usb/misc/sisusbvga/sisusb_init.h
··· 812 812 int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); 813 813 int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); 814 814 815 - extern int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data); 816 - extern int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 * data); 817 - extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, 815 + extern int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data); 816 + extern int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 * data); 817 + extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, 818 818 u8 index, u8 data); 819 - extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, 819 + extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, 820 820 u8 index, u8 * data); 821 - extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, 821 + extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, 822 822 u8 idx, u8 myand, u8 myor); 823 - extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, 823 + extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, 824 824 u8 index, u8 myor); 825 - extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, 825 + extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, 826 826 u8 idx, u8 myand); 827 827 828 828 void sisusb_delete(struct kref *kref);
+43 -3
drivers/usb/storage/uas.c
··· 81 81 static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, 82 82 int status); 83 83 84 + /* 85 + * This driver needs its own workqueue, as we need to control memory allocation. 86 + * 87 + * In the course of error handling and power management uas_wait_for_pending_cmnds() 88 + * needs to flush pending work items. In these contexts we cannot allocate memory 89 + * by doing block IO as we would deadlock. For the same reason we cannot wait 90 + * for anything allocating memory not heeding these constraints. 91 + * 92 + * So we have to control all work items that can be on the workqueue we flush. 93 + * Hence we cannot share a queue and need our own. 94 + */ 95 + static struct workqueue_struct *workqueue; 96 + 84 97 static void uas_do_work(struct work_struct *work) 85 98 { 86 99 struct uas_dev_info *devinfo = ··· 122 109 if (!err) 123 110 cmdinfo->state &= ~IS_IN_WORK_LIST; 124 111 else 125 - schedule_work(&devinfo->work); 112 + queue_work(workqueue, &devinfo->work); 126 113 } 127 114 out: 128 115 spin_unlock_irqrestore(&devinfo->lock, flags); ··· 147 134 148 135 lockdep_assert_held(&devinfo->lock); 149 136 cmdinfo->state |= IS_IN_WORK_LIST; 150 - schedule_work(&devinfo->work); 137 + queue_work(workqueue, &devinfo->work); 151 138 } 152 139 153 140 static void uas_zap_pending(struct uas_dev_info *devinfo, int result) ··· 202 189 { 203 190 struct uas_cmd_info *ci = (void *)&cmnd->SCp; 204 191 struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; 192 + 193 + if (status == -ENODEV) /* too late */ 194 + return; 205 195 206 196 scmd_printk(KERN_INFO, cmnd, 207 197 "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", ··· 1242 1226 .id_table = uas_usb_ids, 1243 1227 }; 1244 1228 1245 - module_usb_driver(uas_driver); 1229 + static int __init uas_init(void) 1230 + { 1231 + int rv; 1232 + 1233 + workqueue = alloc_workqueue("uas", WQ_MEM_RECLAIM, 0); 1234 + if (!workqueue) 1235 + return -ENOMEM; 1236 + 1237 + rv = usb_register(&uas_driver); 1238 + if (rv) { 1239 + destroy_workqueue(workqueue); 1240 + return -ENOMEM; 1241 + } 1242 + 1243 + return 0; 1244 + } 1245 + 1246 + static void __exit uas_exit(void) 1247 + { 1248 + usb_deregister(&uas_driver); 1249 + destroy_workqueue(workqueue); 1250 + } 1251 + 1252 + module_init(uas_init); 1253 + module_exit(uas_exit); 1246 1254 1247 1255 MODULE_LICENSE("GPL"); 1248 1256 MODULE_IMPORT_NS(USB_STORAGE);
+7
drivers/usb/storage/unusual_devs.h
··· 2323 2323 USB_SC_DEVICE,USB_PR_DEVICE,NULL, 2324 2324 US_FL_MAX_SECTORS_64 ), 2325 2325 2326 + /* Reported by Cyril Roelandt <tipecaml@gmail.com> */ 2327 + UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114, 2328 + "JMicron", 2329 + "USB to ATA/ATAPI Bridge", 2330 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 2331 + US_FL_BROKEN_FUA ), 2332 + 2326 2333 /* Reported by Andrey Rahmatullin <wrar@altlinux.org> */ 2327 2334 UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, 2328 2335 "iRiver",
+4 -1
drivers/usb/typec/bus.c
··· 198 198 const struct typec_altmode * 199 199 typec_altmode_get_partner(struct typec_altmode *adev) 200 200 { 201 - return adev ? &to_altmode(adev)->partner->adev : NULL; 201 + if (!adev || !to_altmode(adev)->partner) 202 + return NULL; 203 + 204 + return &to_altmode(adev)->partner->adev; 202 205 } 203 206 EXPORT_SYMBOL_GPL(typec_altmode_get_partner); 204 207
+2 -2
drivers/usb/typec/mux/pi3usb30532.c
··· 114 114 static int pi3usb30532_probe(struct i2c_client *client) 115 115 { 116 116 struct device *dev = &client->dev; 117 - struct typec_switch_desc sw_desc; 118 - struct typec_mux_desc mux_desc; 117 + struct typec_switch_desc sw_desc = { }; 118 + struct typec_mux_desc mux_desc = { }; 119 119 struct pi3usb30532 *pi; 120 120 int ret; 121 121
+26
drivers/usb/typec/tcpm/tcpm.c
··· 3794 3794 */ 3795 3795 break; 3796 3796 3797 + case PORT_RESET: 3798 + case PORT_RESET_WAIT_OFF: 3799 + /* 3800 + * State set back to default mode once the timer completes. 3801 + * Ignore CC changes here. 3802 + */ 3803 + break; 3804 + 3797 3805 default: 3798 3806 if (tcpm_port_is_disconnected(port)) 3799 3807 tcpm_set_state(port, unattached_state(port), 0); ··· 3863 3855 case SRC_TRY_DEBOUNCE: 3864 3856 /* Do nothing, waiting for sink detection */ 3865 3857 break; 3858 + 3859 + case PORT_RESET: 3860 + case PORT_RESET_WAIT_OFF: 3861 + /* 3862 + * State set back to default mode once the timer completes. 3863 + * Ignore vbus changes here. 3864 + */ 3865 + break; 3866 + 3866 3867 default: 3867 3868 break; 3868 3869 } ··· 3925 3908 case PORT_RESET_WAIT_OFF: 3926 3909 tcpm_set_state(port, tcpm_default_state(port), 0); 3927 3910 break; 3911 + 3928 3912 case SRC_TRY_WAIT: 3929 3913 case SRC_TRY_DEBOUNCE: 3930 3914 /* Do nothing, waiting for sink detection */ 3931 3915 break; 3916 + 3917 + case PORT_RESET: 3918 + /* 3919 + * State set back to default mode once the timer completes. 3920 + * Ignore vbus changes here. 3921 + */ 3922 + break; 3923 + 3932 3924 default: 3933 3925 if (port->pwr_role == TYPEC_SINK && 3934 3926 port->attached)