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

Pull USB fixes from Greg KH:
"Here are some small USB driver fixes for 6.17-rc3 to resolve a bunch
of reported issues. Included in here are:

- typec driver fixes

- dwc3 new device id

- dwc3 driver fixes

- new usb-storage driver quirks

- xhci driver fixes

- other tiny USB driver fixes to resolve bugs

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

* tag 'usb-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: xhci: fix host not responding after suspend and resume
usb: xhci: Fix slot_id resource race conflict
usb: typec: fusb302: Revert incorrect threaded irq fix
USB: core: Update kerneldoc for usb_hcd_giveback_urb()
usb: typec: maxim_contaminant: re-enable cc toggle if cc is open and port is clean
usb: typec: maxim_contaminant: disable low power mode when reading comparator values
usb: dwc3: Remove WARN_ON for device endpoint command timeouts
USB: storage: Ignore driver CD mode for Realtek multi-mode Wi-Fi dongles
usb: storage: realtek_cr: Use correct byte order for bcs->Residue
usb: chipidea: imx: improve usbmisc_imx7d_pullup()
kcov, usb: Don't disable interrupts in kcov_remote_start_usb_softirq()
usb: dwc3: pci: add support for the Intel Wildcat Lake
usb: dwc3: Ignore late xferNotReady event to prevent halt timeout
USB: storage: Add unusual-devs entry for Novatek NTK96550-based camera
usb: core: hcd: fix accessing unmapped memory in SINGLE_STEP_SET_FEATURE test
usb: renesas-xhci: Fix External ROM access timeouts
usb: gadget: tegra-xudc: fix PM use count underflow
usb: quirks: Add DELAY_INIT quick for another SanDisk 3.2Gen1 Flash Drive

+224 -97
+2 -1
drivers/usb/chipidea/ci_hdrc_imx.c
··· 338 338 schedule_work(&ci->usb_phy->chg_work); 339 339 break; 340 340 case CI_HDRC_CONTROLLER_PULLUP_EVENT: 341 - if (ci->role == CI_ROLE_GADGET) 341 + if (ci->role == CI_ROLE_GADGET && 342 + ci->gadget.speed == USB_SPEED_HIGH) 342 343 imx_usbmisc_pullup(data->usbmisc_data, 343 344 ci->gadget.connected); 344 345 break;
+16 -7
drivers/usb/chipidea/usbmisc_imx.c
··· 1068 1068 unsigned long flags; 1069 1069 u32 val; 1070 1070 1071 + if (on) 1072 + return; 1073 + 1071 1074 spin_lock_irqsave(&usbmisc->lock, flags); 1072 1075 val = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2); 1073 - if (!on) { 1074 - val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_MASK; 1075 - val |= MX7D_USBNC_USB_CTRL2_OPMODE(1); 1076 - val |= MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN; 1077 - } else { 1078 - val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN; 1079 - } 1076 + val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_MASK; 1077 + val |= MX7D_USBNC_USB_CTRL2_OPMODE(1); 1078 + val |= MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN; 1079 + writel(val, usbmisc->base + MX7D_USBNC_USB_CTRL2); 1080 + spin_unlock_irqrestore(&usbmisc->lock, flags); 1081 + 1082 + /* Last for at least 1 micro-frame to let host see disconnect signal */ 1083 + usleep_range(125, 150); 1084 + 1085 + spin_lock_irqsave(&usbmisc->lock, flags); 1086 + val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_MASK; 1087 + val |= MX7D_USBNC_USB_CTRL2_OPMODE(0); 1088 + val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN; 1080 1089 writel(val, usbmisc->base + MX7D_USBNC_USB_CTRL2); 1081 1090 spin_unlock_irqrestore(&usbmisc->lock, flags); 1082 1091 }
+16 -12
drivers/usb/core/hcd.c
··· 1636 1636 struct usb_hcd *hcd = bus_to_hcd(urb->dev->bus); 1637 1637 struct usb_anchor *anchor = urb->anchor; 1638 1638 int status = urb->unlinked; 1639 - unsigned long flags; 1640 1639 1641 1640 urb->hcpriv = NULL; 1642 1641 if (unlikely((urb->transfer_flags & URB_SHORT_NOT_OK) && ··· 1653 1654 /* pass ownership to the completion handler */ 1654 1655 urb->status = status; 1655 1656 /* 1656 - * Only collect coverage in the softirq context and disable interrupts 1657 - * to avoid scenarios with nested remote coverage collection sections 1658 - * that KCOV does not support. 1659 - * See the comment next to kcov_remote_start_usb_softirq() for details. 1657 + * This function can be called in task context inside another remote 1658 + * coverage collection section, but kcov doesn't support that kind of 1659 + * recursion yet. Only collect coverage in softirq context for now. 1660 1660 */ 1661 - flags = kcov_remote_start_usb_softirq((u64)urb->dev->bus->busnum); 1661 + kcov_remote_start_usb_softirq((u64)urb->dev->bus->busnum); 1662 1662 urb->complete(urb); 1663 - kcov_remote_stop_softirq(flags); 1663 + kcov_remote_stop_softirq(); 1664 1664 1665 1665 usb_anchor_resume_wakeups(anchor); 1666 1666 atomic_dec(&urb->use_count); ··· 1717 1719 * @urb: urb being returned to the USB device driver. 1718 1720 * @status: completion status code for the URB. 1719 1721 * 1720 - * Context: atomic. The completion callback is invoked in caller's context. 1721 - * For HCDs with HCD_BH flag set, the completion callback is invoked in BH 1722 - * context (except for URBs submitted to the root hub which always complete in 1723 - * caller's context). 1722 + * Context: atomic. The completion callback is invoked either in a work queue 1723 + * (BH) context or in the caller's context, depending on whether the HCD_BH 1724 + * flag is set in the @hcd structure, except that URBs submitted to the 1725 + * root hub always complete in BH context. 1724 1726 * 1725 1727 * This hands the URB from HCD to its USB device driver, using its 1726 1728 * completion function. The HCD has freed all per-urb resources ··· 2164 2166 urb->complete = usb_ehset_completion; 2165 2167 urb->status = -EINPROGRESS; 2166 2168 urb->actual_length = 0; 2167 - urb->transfer_flags = URB_DIR_IN; 2169 + urb->transfer_flags = URB_DIR_IN | URB_NO_TRANSFER_DMA_MAP; 2168 2170 usb_get_urb(urb); 2169 2171 atomic_inc(&urb->use_count); 2170 2172 atomic_inc(&urb->dev->urbnum); ··· 2228 2230 2229 2231 /* Complete remaining DATA and STATUS stages using the same URB */ 2230 2232 urb->status = -EINPROGRESS; 2233 + urb->transfer_flags &= ~URB_NO_TRANSFER_DMA_MAP; 2231 2234 usb_get_urb(urb); 2232 2235 atomic_inc(&urb->use_count); 2233 2236 atomic_inc(&urb->dev->urbnum); 2237 + if (map_urb_for_dma(hcd, urb, GFP_KERNEL)) { 2238 + usb_put_urb(urb); 2239 + goto out1; 2240 + } 2241 + 2234 2242 retval = hcd->driver->submit_single_step_set_feature(hcd, urb, 0); 2235 2243 if (!retval && !wait_for_completion_timeout(&done, 2236 2244 msecs_to_jiffies(2000))) {
+1
drivers/usb/core/quirks.c
··· 371 371 { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, 372 372 373 373 /* SanDisk Corp. SanDisk 3.2Gen1 */ 374 + { USB_DEVICE(0x0781, 0x5596), .driver_info = USB_QUIRK_DELAY_INIT }, 374 375 { USB_DEVICE(0x0781, 0x55a3), .driver_info = USB_QUIRK_DELAY_INIT }, 375 376 376 377 /* SanDisk Extreme 55AE */
+2
drivers/usb/dwc3/dwc3-pci.c
··· 41 41 #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee 42 42 #define PCI_DEVICE_ID_INTEL_TGPH 0x43ee 43 43 #define PCI_DEVICE_ID_INTEL_JSP 0x4dee 44 + #define PCI_DEVICE_ID_INTEL_WCL 0x4d7e 44 45 #define PCI_DEVICE_ID_INTEL_ADL 0x460e 45 46 #define PCI_DEVICE_ID_INTEL_ADL_PCH 0x51ee 46 47 #define PCI_DEVICE_ID_INTEL_ADLN 0x465e ··· 432 431 { PCI_DEVICE_DATA(INTEL, TGPLP, &dwc3_pci_intel_swnode) }, 433 432 { PCI_DEVICE_DATA(INTEL, TGPH, &dwc3_pci_intel_swnode) }, 434 433 { PCI_DEVICE_DATA(INTEL, JSP, &dwc3_pci_intel_swnode) }, 434 + { PCI_DEVICE_DATA(INTEL, WCL, &dwc3_pci_intel_swnode) }, 435 435 { PCI_DEVICE_DATA(INTEL, ADL, &dwc3_pci_intel_swnode) }, 436 436 { PCI_DEVICE_DATA(INTEL, ADL_PCH, &dwc3_pci_intel_swnode) }, 437 437 { PCI_DEVICE_DATA(INTEL, ADLN, &dwc3_pci_intel_swnode) },
+16 -4
drivers/usb/dwc3/ep0.c
··· 288 288 dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 8, 289 289 DWC3_TRBCTL_CONTROL_SETUP, false); 290 290 ret = dwc3_ep0_start_trans(dep); 291 - WARN_ON(ret < 0); 291 + if (ret < 0) 292 + dev_err(dwc->dev, "ep0 out start transfer failed: %d\n", ret); 293 + 292 294 for (i = 2; i < DWC3_ENDPOINTS_NUM; i++) { 293 295 struct dwc3_ep *dwc3_ep; 294 296 ··· 1063 1061 ret = dwc3_ep0_start_trans(dep); 1064 1062 } 1065 1063 1066 - WARN_ON(ret < 0); 1064 + if (ret < 0) 1065 + dev_err(dwc->dev, 1066 + "ep0 data phase start transfer failed: %d\n", ret); 1067 1067 } 1068 1068 1069 1069 static int dwc3_ep0_start_control_status(struct dwc3_ep *dep) ··· 1082 1078 1083 1079 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) 1084 1080 { 1085 - WARN_ON(dwc3_ep0_start_control_status(dep)); 1081 + int ret; 1082 + 1083 + ret = dwc3_ep0_start_control_status(dep); 1084 + if (ret) 1085 + dev_err(dwc->dev, 1086 + "ep0 status phase start transfer failed: %d\n", ret); 1086 1087 } 1087 1088 1088 1089 static void dwc3_ep0_do_control_status(struct dwc3 *dwc, ··· 1130 1121 cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); 1131 1122 memset(&params, 0, sizeof(params)); 1132 1123 ret = dwc3_send_gadget_ep_cmd(dep, cmd, &params); 1133 - WARN_ON_ONCE(ret); 1124 + if (ret) 1125 + dev_err_ratelimited(dwc->dev, 1126 + "ep0 data phase end transfer failed: %d\n", ret); 1127 + 1134 1128 dep->resource_index = 0; 1135 1129 } 1136 1130
+17 -2
drivers/usb/dwc3/gadget.c
··· 1772 1772 dep->flags |= DWC3_EP_DELAY_STOP; 1773 1773 return 0; 1774 1774 } 1775 - WARN_ON_ONCE(ret); 1775 + 1776 + if (ret) 1777 + dev_err_ratelimited(dep->dwc->dev, 1778 + "end transfer failed: %d\n", ret); 1779 + 1776 1780 dep->resource_index = 0; 1777 1781 1778 1782 if (!interrupt) ··· 3781 3777 static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep, 3782 3778 const struct dwc3_event_depevt *event) 3783 3779 { 3780 + /* 3781 + * During a device-initiated disconnect, a late xferNotReady event can 3782 + * be generated after the End Transfer command resets the event filter, 3783 + * but before the controller is halted. Ignore it to prevent a new 3784 + * transfer from starting. 3785 + */ 3786 + if (!dep->dwc->connected) 3787 + return; 3788 + 3784 3789 dwc3_gadget_endpoint_frame_from_event(dep, event); 3785 3790 3786 3791 /* ··· 4052 4039 dep->flags &= ~DWC3_EP_STALL; 4053 4040 4054 4041 ret = dwc3_send_clear_stall_ep_cmd(dep); 4055 - WARN_ON_ONCE(ret); 4042 + if (ret) 4043 + dev_err_ratelimited(dwc->dev, 4044 + "failed to clear STALL on %s\n", dep->name); 4056 4045 } 4057 4046 } 4058 4047
+7 -2
drivers/usb/gadget/udc/tegra-xudc.c
··· 502 502 struct clk_bulk_data *clks; 503 503 504 504 bool device_mode; 505 + bool current_device_mode; 505 506 struct work_struct usb_role_sw_work; 506 507 507 508 struct phy **usb3_phy; ··· 716 715 717 716 phy_set_mode_ext(xudc->curr_utmi_phy, PHY_MODE_USB_OTG, 718 717 USB_ROLE_DEVICE); 718 + 719 + xudc->current_device_mode = true; 719 720 } 720 721 721 722 static void tegra_xudc_device_mode_off(struct tegra_xudc *xudc) ··· 727 724 int err; 728 725 729 726 dev_dbg(xudc->dev, "device mode off\n"); 727 + 728 + xudc->current_device_mode = false; 730 729 731 730 connected = !!(xudc_readl(xudc, PORTSC) & PORTSC_CCS); 732 731 ··· 4049 4044 4050 4045 spin_lock_irqsave(&xudc->lock, flags); 4051 4046 xudc->suspended = false; 4047 + if (xudc->device_mode != xudc->current_device_mode) 4048 + schedule_work(&xudc->usb_role_sw_work); 4052 4049 spin_unlock_irqrestore(&xudc->lock, flags); 4053 - 4054 - schedule_work(&xudc->usb_role_sw_work); 4055 4050 4056 4051 pm_runtime_enable(dev); 4057 4052
+1 -2
drivers/usb/host/xhci-hub.c
··· 704 704 if (!xhci->devs[i]) 705 705 continue; 706 706 707 - retval = xhci_disable_slot(xhci, i); 708 - xhci_free_virt_device(xhci, i); 707 + retval = xhci_disable_and_free_slot(xhci, i); 709 708 if (retval) 710 709 xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", 711 710 i, retval);
+11 -11
drivers/usb/host/xhci-mem.c
··· 865 865 * will be manipulated by the configure endpoint, allocate device, or update 866 866 * hub functions while this function is removing the TT entries from the list. 867 867 */ 868 - void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id) 868 + void xhci_free_virt_device(struct xhci_hcd *xhci, struct xhci_virt_device *dev, 869 + int slot_id) 869 870 { 870 - struct xhci_virt_device *dev; 871 871 int i; 872 872 int old_active_eps = 0; 873 873 874 874 /* Slot ID 0 is reserved */ 875 - if (slot_id == 0 || !xhci->devs[slot_id]) 875 + if (slot_id == 0 || !dev) 876 876 return; 877 877 878 - dev = xhci->devs[slot_id]; 879 - 880 - xhci->dcbaa->dev_context_ptrs[slot_id] = 0; 881 - if (!dev) 882 - return; 878 + /* If device ctx array still points to _this_ device, clear it */ 879 + if (dev->out_ctx && 880 + xhci->dcbaa->dev_context_ptrs[slot_id] == cpu_to_le64(dev->out_ctx->dma)) 881 + xhci->dcbaa->dev_context_ptrs[slot_id] = 0; 883 882 884 883 trace_xhci_free_virt_device(dev); 885 884 ··· 919 920 dev->udev->slot_id = 0; 920 921 if (dev->rhub_port && dev->rhub_port->slot_id == slot_id) 921 922 dev->rhub_port->slot_id = 0; 922 - kfree(xhci->devs[slot_id]); 923 - xhci->devs[slot_id] = NULL; 923 + if (xhci->devs[slot_id] == dev) 924 + xhci->devs[slot_id] = NULL; 925 + kfree(dev); 924 926 } 925 927 926 928 /* ··· 962 962 out: 963 963 /* we are now at a leaf device */ 964 964 xhci_debugfs_remove_slot(xhci, slot_id); 965 - xhci_free_virt_device(xhci, slot_id); 965 + xhci_free_virt_device(xhci, vdev, slot_id); 966 966 } 967 967 968 968 int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
+4 -3
drivers/usb/host/xhci-pci-renesas.c
··· 47 47 #define RENESAS_ROM_ERASE_MAGIC 0x5A65726F 48 48 #define RENESAS_ROM_WRITE_MAGIC 0x53524F4D 49 49 50 - #define RENESAS_RETRY 10000 51 - #define RENESAS_DELAY 10 50 + #define RENESAS_RETRY 50000 /* 50000 * RENESAS_DELAY ~= 500ms */ 51 + #define RENESAS_CHIP_ERASE_RETRY 500000 /* 500000 * RENESAS_DELAY ~= 5s */ 52 + #define RENESAS_DELAY 10 52 53 53 54 #define RENESAS_FW_NAME "renesas_usb_fw.mem" 54 55 ··· 408 407 /* sleep a bit while ROM is erased */ 409 408 msleep(20); 410 409 411 - for (i = 0; i < RENESAS_RETRY; i++) { 410 + for (i = 0; i < RENESAS_CHIP_ERASE_RETRY; i++) { 412 411 retval = pci_read_config_byte(pdev, RENESAS_ROM_STATUS, 413 412 &status); 414 413 status &= RENESAS_ROM_STATUS_ERASE;
+7 -2
drivers/usb/host/xhci-ring.c
··· 1592 1592 command->slot_id = 0; 1593 1593 } 1594 1594 1595 - static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) 1595 + static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id, 1596 + u32 cmd_comp_code) 1596 1597 { 1597 1598 struct xhci_virt_device *virt_dev; 1598 1599 struct xhci_slot_ctx *slot_ctx; ··· 1608 1607 if (xhci->quirks & XHCI_EP_LIMIT_QUIRK) 1609 1608 /* Delete default control endpoint resources */ 1610 1609 xhci_free_device_endpoint_resources(xhci, virt_dev, true); 1610 + if (cmd_comp_code == COMP_SUCCESS) { 1611 + xhci->dcbaa->dev_context_ptrs[slot_id] = 0; 1612 + xhci->devs[slot_id] = NULL; 1613 + } 1611 1614 } 1612 1615 1613 1616 static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id) ··· 1861 1856 xhci_handle_cmd_enable_slot(slot_id, cmd, cmd_comp_code); 1862 1857 break; 1863 1858 case TRB_DISABLE_SLOT: 1864 - xhci_handle_cmd_disable_slot(xhci, slot_id); 1859 + xhci_handle_cmd_disable_slot(xhci, slot_id, cmd_comp_code); 1865 1860 break; 1866 1861 case TRB_CONFIG_EP: 1867 1862 if (!cmd->completion)
+16 -7
drivers/usb/host/xhci.c
··· 309 309 return -EINVAL; 310 310 311 311 iman = readl(&ir->ir_set->iman); 312 + iman &= ~IMAN_IP; 312 313 iman |= IMAN_IE; 313 314 writel(iman, &ir->ir_set->iman); 314 315 ··· 326 325 return -EINVAL; 327 326 328 327 iman = readl(&ir->ir_set->iman); 328 + iman &= ~IMAN_IP; 329 329 iman &= ~IMAN_IE; 330 330 writel(iman, &ir->ir_set->iman); 331 331 ··· 3934 3932 * Obtaining a new device slot to inform the xHCI host that 3935 3933 * the USB device has been reset. 3936 3934 */ 3937 - ret = xhci_disable_slot(xhci, udev->slot_id); 3938 - xhci_free_virt_device(xhci, udev->slot_id); 3935 + ret = xhci_disable_and_free_slot(xhci, udev->slot_id); 3939 3936 if (!ret) { 3940 3937 ret = xhci_alloc_dev(hcd, udev); 3941 3938 if (ret == 1) ··· 4091 4090 xhci_disable_slot(xhci, udev->slot_id); 4092 4091 4093 4092 spin_lock_irqsave(&xhci->lock, flags); 4094 - xhci_free_virt_device(xhci, udev->slot_id); 4093 + xhci_free_virt_device(xhci, virt_dev, udev->slot_id); 4095 4094 spin_unlock_irqrestore(&xhci->lock, flags); 4096 4095 4097 4096 } ··· 4138 4137 xhci_free_command(xhci, command); 4139 4138 4140 4139 return 0; 4140 + } 4141 + 4142 + int xhci_disable_and_free_slot(struct xhci_hcd *xhci, u32 slot_id) 4143 + { 4144 + struct xhci_virt_device *vdev = xhci->devs[slot_id]; 4145 + int ret; 4146 + 4147 + ret = xhci_disable_slot(xhci, slot_id); 4148 + xhci_free_virt_device(xhci, vdev, slot_id); 4149 + return ret; 4141 4150 } 4142 4151 4143 4152 /* ··· 4256 4245 return 1; 4257 4246 4258 4247 disable_slot: 4259 - xhci_disable_slot(xhci, udev->slot_id); 4260 - xhci_free_virt_device(xhci, udev->slot_id); 4248 + xhci_disable_and_free_slot(xhci, udev->slot_id); 4261 4249 4262 4250 return 0; 4263 4251 } ··· 4392 4382 dev_warn(&udev->dev, "Device not responding to setup %s.\n", act); 4393 4383 4394 4384 mutex_unlock(&xhci->mutex); 4395 - ret = xhci_disable_slot(xhci, udev->slot_id); 4396 - xhci_free_virt_device(xhci, udev->slot_id); 4385 + ret = xhci_disable_and_free_slot(xhci, udev->slot_id); 4397 4386 if (!ret) { 4398 4387 if (xhci_alloc_dev(hcd, udev) == 1) 4399 4388 xhci_setup_addressable_virt_dev(xhci, udev);
+2 -1
drivers/usb/host/xhci.h
··· 1791 1791 /* xHCI memory management */ 1792 1792 void xhci_mem_cleanup(struct xhci_hcd *xhci); 1793 1793 int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags); 1794 - void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); 1794 + void xhci_free_virt_device(struct xhci_hcd *xhci, struct xhci_virt_device *dev, int slot_id); 1795 1795 int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); 1796 1796 int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); 1797 1797 void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci, ··· 1888 1888 int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, 1889 1889 struct usb_tt *tt, gfp_t mem_flags); 1890 1890 int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id); 1891 + int xhci_disable_and_free_slot(struct xhci_hcd *xhci, u32 slot_id); 1891 1892 int xhci_ext_cap_init(struct xhci_hcd *xhci); 1892 1893 1893 1894 int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup);
+1 -1
drivers/usb/storage/realtek_cr.c
··· 252 252 return USB_STOR_TRANSPORT_ERROR; 253 253 } 254 254 255 - residue = bcs->Residue; 255 + residue = le32_to_cpu(bcs->Residue); 256 256 if (bcs->Tag != us->tag) 257 257 return USB_STOR_TRANSPORT_ERROR; 258 258
+29
drivers/usb/storage/unusual_devs.h
··· 934 934 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 935 935 US_FL_SANE_SENSE ), 936 936 937 + /* Added by Maël GUERIN <mael.guerin@murena.io> */ 938 + UNUSUAL_DEV( 0x0603, 0x8611, 0x0000, 0xffff, 939 + "Novatek", 940 + "NTK96550-based camera", 941 + USB_SC_SCSI, USB_PR_BULK, NULL, 942 + US_FL_BULK_IGNORE_TAG ), 943 + 937 944 /* 938 945 * Reported by Hanno Boeck <hanno@gmx.de> 939 946 * Taken from the Lycoris Kernel ··· 1500 1493 "External", 1501 1494 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 1502 1495 US_FL_NO_WP_DETECT ), 1496 + 1497 + /* 1498 + * Reported by Zenm Chen <zenmchen@gmail.com> 1499 + * Ignore driver CD mode, otherwise usb_modeswitch may fail to switch 1500 + * the device into Wi-Fi mode. 1501 + */ 1502 + UNUSUAL_DEV( 0x0bda, 0x1a2b, 0x0000, 0xffff, 1503 + "Realtek", 1504 + "DISK", 1505 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 1506 + US_FL_IGNORE_DEVICE ), 1507 + 1508 + /* 1509 + * Reported by Zenm Chen <zenmchen@gmail.com> 1510 + * Ignore driver CD mode, otherwise usb_modeswitch may fail to switch 1511 + * the device into Wi-Fi mode. 1512 + */ 1513 + UNUSUAL_DEV( 0x0bda, 0xa192, 0x0000, 0xffff, 1514 + "Realtek", 1515 + "DISK", 1516 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 1517 + US_FL_IGNORE_DEVICE ), 1503 1518 1504 1519 UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999, 1505 1520 "Maxtor",
+8 -4
drivers/usb/typec/tcpm/fusb302.c
··· 1485 1485 struct fusb302_chip *chip = dev_id; 1486 1486 unsigned long flags; 1487 1487 1488 + /* Disable our level triggered IRQ until our irq_work has cleared it */ 1489 + disable_irq_nosync(chip->gpio_int_n_irq); 1490 + 1488 1491 spin_lock_irqsave(&chip->irq_lock, flags); 1489 1492 if (chip->irq_suspended) 1490 1493 chip->irq_while_suspended = true; ··· 1630 1627 } 1631 1628 done: 1632 1629 mutex_unlock(&chip->lock); 1630 + enable_irq(chip->gpio_int_n_irq); 1633 1631 } 1634 1632 1635 1633 static int init_gpio(struct fusb302_chip *chip) ··· 1755 1751 goto destroy_workqueue; 1756 1752 } 1757 1753 1758 - ret = devm_request_threaded_irq(dev, chip->gpio_int_n_irq, 1759 - NULL, fusb302_irq_intn, 1760 - IRQF_ONESHOT | IRQF_TRIGGER_LOW, 1761 - "fsc_interrupt_int_n", chip); 1754 + ret = request_irq(chip->gpio_int_n_irq, fusb302_irq_intn, 1755 + IRQF_ONESHOT | IRQF_TRIGGER_LOW, 1756 + "fsc_interrupt_int_n", chip); 1762 1757 if (ret < 0) { 1763 1758 dev_err(dev, "cannot request IRQ for GPIO Int_N, ret=%d", ret); 1764 1759 goto tcpm_unregister_port; ··· 1782 1779 struct fusb302_chip *chip = i2c_get_clientdata(client); 1783 1780 1784 1781 disable_irq_wake(chip->gpio_int_n_irq); 1782 + free_irq(chip->gpio_int_n_irq, chip); 1785 1783 cancel_work_sync(&chip->irq_work); 1786 1784 cancel_delayed_work_sync(&chip->bc_lvl_handler); 1787 1785 tcpm_unregister_port(chip->tcpm_port);
+58
drivers/usb/typec/tcpm/maxim_contaminant.c
··· 188 188 if (ret < 0) 189 189 return ret; 190 190 191 + /* Disable low power mode */ 192 + ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCLPMODESEL, 193 + FIELD_PREP(CCLPMODESEL, 194 + LOW_POWER_MODE_DISABLE)); 195 + 191 196 /* Sleep to allow comparators settle */ 192 197 usleep_range(5000, 6000); 193 198 ret = regmap_update_bits(regmap, TCPC_TCPC_CTRL, TCPC_TCPC_CTRL_ORIENTATION, PLUG_ORNT_CC1); ··· 329 324 return 0; 330 325 } 331 326 327 + static int max_contaminant_enable_toggling(struct max_tcpci_chip *chip) 328 + { 329 + struct regmap *regmap = chip->data.regmap; 330 + int ret; 331 + 332 + /* Disable dry detection if enabled. */ 333 + ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCLPMODESEL, 334 + FIELD_PREP(CCLPMODESEL, 335 + LOW_POWER_MODE_DISABLE)); 336 + if (ret) 337 + return ret; 338 + 339 + ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL1, CCCONNDRY, 0); 340 + if (ret) 341 + return ret; 342 + 343 + ret = max_tcpci_write8(chip, TCPC_ROLE_CTRL, TCPC_ROLE_CTRL_DRP | 344 + FIELD_PREP(TCPC_ROLE_CTRL_CC1, 345 + TCPC_ROLE_CTRL_CC_RD) | 346 + FIELD_PREP(TCPC_ROLE_CTRL_CC2, 347 + TCPC_ROLE_CTRL_CC_RD)); 348 + if (ret) 349 + return ret; 350 + 351 + ret = regmap_update_bits(regmap, TCPC_TCPC_CTRL, 352 + TCPC_TCPC_CTRL_EN_LK4CONN_ALRT, 353 + TCPC_TCPC_CTRL_EN_LK4CONN_ALRT); 354 + if (ret) 355 + return ret; 356 + 357 + return max_tcpci_write8(chip, TCPC_COMMAND, TCPC_CMD_LOOK4CONNECTION); 358 + } 359 + 332 360 bool max_contaminant_is_contaminant(struct max_tcpci_chip *chip, bool disconnect_while_debounce, 333 361 bool *cc_handled) 334 362 { ··· 377 339 ret = max_tcpci_read8(chip, TCPC_POWER_CTRL, &pwr_cntl); 378 340 if (ret < 0) 379 341 return false; 342 + 343 + if (cc_status & TCPC_CC_STATUS_TOGGLING) { 344 + if (chip->contaminant_state == DETECTED) 345 + return true; 346 + return false; 347 + } 380 348 381 349 if (chip->contaminant_state == NOT_DETECTED || chip->contaminant_state == SINK) { 382 350 if (!disconnect_while_debounce) ··· 416 372 max_contaminant_enable_dry_detection(chip); 417 373 return true; 418 374 } 375 + 376 + ret = max_contaminant_enable_toggling(chip); 377 + if (ret) 378 + dev_err(chip->dev, 379 + "Failed to enable toggling, ret=%d", 380 + ret); 419 381 } 420 382 } else if (chip->contaminant_state == DETECTED) { 421 383 if (!(cc_status & TCPC_CC_STATUS_TOGGLING)) { ··· 429 379 if (chip->contaminant_state == DETECTED) { 430 380 max_contaminant_enable_dry_detection(chip); 431 381 return true; 382 + } else { 383 + ret = max_contaminant_enable_toggling(chip); 384 + if (ret) { 385 + dev_err(chip->dev, 386 + "Failed to enable toggling, ret=%d", 387 + ret); 388 + return true; 389 + } 432 390 } 433 391 } 434 392 }
+1
drivers/usb/typec/tcpm/tcpci_maxim.h
··· 21 21 #define CCOVPDIS BIT(6) 22 22 #define SBURPCTRL BIT(5) 23 23 #define CCLPMODESEL GENMASK(4, 3) 24 + #define LOW_POWER_MODE_DISABLE 0 24 25 #define ULTRA_LOW_POWER_MODE 1 25 26 #define CCRPCTRL GENMASK(2, 0) 26 27 #define UA_1_SRC 1
+9 -38
include/linux/kcov.h
··· 57 57 58 58 /* 59 59 * The softirq flavor of kcov_remote_*() functions is introduced as a temporary 60 - * workaround for KCOV's lack of nested remote coverage sections support. 61 - * 62 - * Adding support is tracked in https://bugzilla.kernel.org/show_bug.cgi?id=210337. 63 - * 64 - * kcov_remote_start_usb_softirq(): 65 - * 66 - * 1. Only collects coverage when called in the softirq context. This allows 67 - * avoiding nested remote coverage collection sections in the task context. 68 - * For example, USB/IP calls usb_hcd_giveback_urb() in the task context 69 - * within an existing remote coverage collection section. Thus, KCOV should 70 - * not attempt to start collecting coverage within the coverage collection 71 - * section in __usb_hcd_giveback_urb() in this case. 72 - * 73 - * 2. Disables interrupts for the duration of the coverage collection section. 74 - * This allows avoiding nested remote coverage collection sections in the 75 - * softirq context (a softirq might occur during the execution of a work in 76 - * the BH workqueue, which runs with in_serving_softirq() > 0). 77 - * For example, usb_giveback_urb_bh() runs in the BH workqueue with 78 - * interrupts enabled, so __usb_hcd_giveback_urb() might be interrupted in 79 - * the middle of its remote coverage collection section, and the interrupt 80 - * handler might invoke __usb_hcd_giveback_urb() again. 60 + * work around for kcov's lack of nested remote coverage sections support in 61 + * task context. Adding support for nested sections is tracked in: 62 + * https://bugzilla.kernel.org/show_bug.cgi?id=210337 81 63 */ 82 64 83 - static inline unsigned long kcov_remote_start_usb_softirq(u64 id) 65 + static inline void kcov_remote_start_usb_softirq(u64 id) 84 66 { 85 - unsigned long flags = 0; 86 - 87 - if (in_serving_softirq()) { 88 - local_irq_save(flags); 67 + if (in_serving_softirq() && !in_hardirq()) 89 68 kcov_remote_start_usb(id); 90 - } 91 - 92 - return flags; 93 69 } 94 70 95 - static inline void kcov_remote_stop_softirq(unsigned long flags) 71 + static inline void kcov_remote_stop_softirq(void) 96 72 { 97 - if (in_serving_softirq()) { 73 + if (in_serving_softirq() && !in_hardirq()) 98 74 kcov_remote_stop(); 99 - local_irq_restore(flags); 100 - } 101 75 } 102 76 103 77 #ifdef CONFIG_64BIT ··· 105 131 } 106 132 static inline void kcov_remote_start_common(u64 id) {} 107 133 static inline void kcov_remote_start_usb(u64 id) {} 108 - static inline unsigned long kcov_remote_start_usb_softirq(u64 id) 109 - { 110 - return 0; 111 - } 112 - static inline void kcov_remote_stop_softirq(unsigned long flags) {} 134 + static inline void kcov_remote_start_usb_softirq(u64 id) {} 135 + static inline void kcov_remote_stop_softirq(void) {} 113 136 114 137 #endif /* CONFIG_KCOV */ 115 138 #endif /* _LINUX_KCOV_H */