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

Pull USB / Thunderbolt fixes from Greg KH:
"Here are some small USB and Thunderbolt driver fixes for 6.12-rc6 that
have been sitting in my tree this week. Included in here are the
following:

- thunderbolt driver fixes for reported issues

- USB typec driver fixes

- xhci driver fixes for reported problems

- dwc2 driver revert for a broken change

- usb phy driver fix

- usbip tool fix

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

* tag 'usb-6.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: typec: tcpm: restrict SNK_WAIT_CAPABILITIES_TIMEOUT transitions to non self-powered devices
usb: phy: Fix API devm_usb_put_phy() can not release the phy
usb: typec: use cleanup facility for 'altmodes_node'
usb: typec: fix unreleased fwnode_handle in typec_port_register_altmodes()
usb: typec: qcom-pmic-typec: fix missing fwnode removal in error path
usb: typec: qcom-pmic-typec: use fwnode_handle_put() to release fwnodes
usb: acpi: fix boot hang due to early incorrect 'tunneled' USB3 device links
Revert "usb: dwc2: Skip clock gating on Broadcom SoCs"
xhci: Fix Link TRB DMA in command ring stopped completion event
xhci: Use pm_runtime_get to prevent RPM on unsupported systems
usbip: tools: Fix detach_port() invalid port error path
thunderbolt: Honor TMU requirements in the domain when setting TMU mode
thunderbolt: Fix KASAN reported stack out-of-bounds read in tb_retimer_scan()

+78 -31
+3 -2
drivers/thunderbolt/retimer.c
··· 516 516 */ 517 517 tb_retimer_set_inbound_sbtx(port); 518 518 519 - for (i = 1; i <= TB_MAX_RETIMER_INDEX; i++) { 519 + for (max = 1, i = 1; i <= TB_MAX_RETIMER_INDEX; i++) { 520 520 /* 521 521 * Last retimer is true only for the last on-board 522 522 * retimer (the one connected directly to the Type-C ··· 527 527 last_idx = i; 528 528 else if (ret < 0) 529 529 break; 530 + 531 + max = i; 530 532 } 531 533 532 - max = i; 533 534 ret = 0; 534 535 535 536 /* Add retimers if they do not exist already */
+42 -6
drivers/thunderbolt/tb.c
··· 288 288 device_for_each_child(&sw->dev, NULL, tb_increase_switch_tmu_accuracy); 289 289 } 290 290 291 + static int tb_switch_tmu_hifi_uni_required(struct device *dev, void *not_used) 292 + { 293 + struct tb_switch *sw = tb_to_switch(dev); 294 + 295 + if (sw && tb_switch_tmu_is_enabled(sw) && 296 + tb_switch_tmu_is_configured(sw, TB_SWITCH_TMU_MODE_HIFI_UNI)) 297 + return 1; 298 + 299 + return device_for_each_child(dev, NULL, 300 + tb_switch_tmu_hifi_uni_required); 301 + } 302 + 303 + static bool tb_tmu_hifi_uni_required(struct tb *tb) 304 + { 305 + return device_for_each_child(&tb->dev, NULL, 306 + tb_switch_tmu_hifi_uni_required) == 1; 307 + } 308 + 291 309 static int tb_enable_tmu(struct tb_switch *sw) 292 310 { 293 311 int ret; ··· 320 302 ret = tb_switch_tmu_configure(sw, 321 303 TB_SWITCH_TMU_MODE_MEDRES_ENHANCED_UNI); 322 304 if (ret == -EOPNOTSUPP) { 323 - if (tb_switch_clx_is_enabled(sw, TB_CL1)) 324 - ret = tb_switch_tmu_configure(sw, 325 - TB_SWITCH_TMU_MODE_LOWRES); 326 - else 327 - ret = tb_switch_tmu_configure(sw, 328 - TB_SWITCH_TMU_MODE_HIFI_BI); 305 + if (tb_switch_clx_is_enabled(sw, TB_CL1)) { 306 + /* 307 + * Figure out uni-directional HiFi TMU requirements 308 + * currently in the domain. If there are no 309 + * uni-directional HiFi requirements we can put the TMU 310 + * into LowRes mode. 311 + * 312 + * Deliberately skip bi-directional HiFi links 313 + * as these work independently of other links 314 + * (and they do not allow any CL states anyway). 315 + */ 316 + if (tb_tmu_hifi_uni_required(sw->tb)) 317 + ret = tb_switch_tmu_configure(sw, 318 + TB_SWITCH_TMU_MODE_HIFI_UNI); 319 + else 320 + ret = tb_switch_tmu_configure(sw, 321 + TB_SWITCH_TMU_MODE_LOWRES); 322 + } else { 323 + ret = tb_switch_tmu_configure(sw, TB_SWITCH_TMU_MODE_HIFI_BI); 324 + } 325 + 326 + /* If not supported, fallback to bi-directional HiFi */ 327 + if (ret == -EOPNOTSUPP) 328 + ret = tb_switch_tmu_configure(sw, TB_SWITCH_TMU_MODE_HIFI_BI); 329 329 } 330 330 if (ret) 331 331 return ret;
+2 -2
drivers/usb/core/usb-acpi.c
··· 170 170 struct fwnode_handle *nhi_fwnode __free(fwnode_handle) = 171 171 fwnode_find_reference(dev_fwnode(&port_dev->dev), "usb4-host-interface", 0); 172 172 173 - if (IS_ERR(nhi_fwnode)) 173 + if (IS_ERR(nhi_fwnode) || !nhi_fwnode->dev) 174 174 return 0; 175 175 176 176 link = device_link_add(&port_dev->child->dev, nhi_fwnode->dev, 177 - DL_FLAG_AUTOREMOVE_CONSUMER | 177 + DL_FLAG_STATELESS | 178 178 DL_FLAG_RPM_ACTIVE | 179 179 DL_FLAG_PM_RUNTIME); 180 180 if (!link) {
-1
drivers/usb/dwc2/params.c
··· 23 23 p->max_transfer_size = 65535; 24 24 p->max_packet_count = 511; 25 25 p->ahbcfg = 0x10; 26 - p->no_clock_gating = true; 27 26 } 28 27 29 28 static void dwc2_set_his_params(struct dwc2_hsotg *hsotg)
+4 -2
drivers/usb/host/xhci-pci.c
··· 640 640 pm_runtime_put_noidle(&dev->dev); 641 641 642 642 if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0) 643 - pm_runtime_forbid(&dev->dev); 643 + pm_runtime_get(&dev->dev); 644 644 else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) 645 645 pm_runtime_allow(&dev->dev); 646 646 ··· 683 683 684 684 xhci->xhc_state |= XHCI_STATE_REMOVING; 685 685 686 - if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) 686 + if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0) 687 + pm_runtime_put(&dev->dev); 688 + else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) 687 689 pm_runtime_forbid(&dev->dev); 688 690 689 691 if (xhci->shared_hcd) {
+8 -8
drivers/usb/host/xhci-ring.c
··· 1718 1718 1719 1719 trace_xhci_handle_command(xhci->cmd_ring, &cmd_trb->generic); 1720 1720 1721 + cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); 1722 + 1723 + /* If CMD ring stopped we own the trbs between enqueue and dequeue */ 1724 + if (cmd_comp_code == COMP_COMMAND_RING_STOPPED) { 1725 + complete_all(&xhci->cmd_ring_stop_completion); 1726 + return; 1727 + } 1728 + 1721 1729 cmd_dequeue_dma = xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, 1722 1730 cmd_trb); 1723 1731 /* ··· 1741 1733 cmd = list_first_entry(&xhci->cmd_list, struct xhci_command, cmd_list); 1742 1734 1743 1735 cancel_delayed_work(&xhci->cmd_timer); 1744 - 1745 - cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); 1746 - 1747 - /* If CMD ring stopped we own the trbs between enqueue and dequeue */ 1748 - if (cmd_comp_code == COMP_COMMAND_RING_STOPPED) { 1749 - complete_all(&xhci->cmd_ring_stop_completion); 1750 - return; 1751 - } 1752 1736 1753 1737 if (cmd->command_trb != xhci->cmd_ring->dequeue) { 1754 1738 xhci_err(xhci,
+1 -1
drivers/usb/phy/phy.c
··· 628 628 { 629 629 int r; 630 630 631 - r = devres_destroy(dev, devm_usb_phy_release, devm_usb_phy_match, phy); 631 + r = devres_release(dev, devm_usb_phy_release, devm_usb_phy_match, phy); 632 632 dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); 633 633 } 634 634 EXPORT_SYMBOL_GPL(devm_usb_put_phy);
+4 -2
drivers/usb/typec/class.c
··· 2293 2293 const struct typec_altmode_ops *ops, void *drvdata, 2294 2294 struct typec_altmode **altmodes, size_t n) 2295 2295 { 2296 - struct fwnode_handle *altmodes_node, *child; 2296 + struct fwnode_handle *child; 2297 2297 struct typec_altmode_desc desc; 2298 2298 struct typec_altmode *alt; 2299 2299 size_t index = 0; ··· 2301 2301 u32 vdo; 2302 2302 int ret; 2303 2303 2304 - altmodes_node = device_get_named_child_node(&port->dev, "altmodes"); 2304 + struct fwnode_handle *altmodes_node __free(fwnode_handle) = 2305 + device_get_named_child_node(&port->dev, "altmodes"); 2306 + 2305 2307 if (!altmodes_node) 2306 2308 return; /* No altmodes specified */ 2307 2309
+6 -4
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
··· 93 93 return -EINVAL; 94 94 95 95 bridge_dev = devm_drm_dp_hpd_bridge_alloc(tcpm->dev, to_of_node(tcpm->tcpc.fwnode)); 96 - if (IS_ERR(bridge_dev)) 97 - return PTR_ERR(bridge_dev); 96 + if (IS_ERR(bridge_dev)) { 97 + ret = PTR_ERR(bridge_dev); 98 + goto fwnode_remove; 99 + } 98 100 99 101 tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc); 100 102 if (IS_ERR(tcpm->tcpm_port)) { ··· 125 123 port_unregister: 126 124 tcpm_unregister_port(tcpm->tcpm_port); 127 125 fwnode_remove: 128 - fwnode_remove_software_node(tcpm->tcpc.fwnode); 126 + fwnode_handle_put(tcpm->tcpc.fwnode); 129 127 130 128 return ret; 131 129 } ··· 137 135 tcpm->pdphy_stop(tcpm); 138 136 tcpm->port_stop(tcpm); 139 137 tcpm_unregister_port(tcpm->tcpm_port); 140 - fwnode_remove_software_node(tcpm->tcpc.fwnode); 138 + fwnode_handle_put(tcpm->tcpc.fwnode); 141 139 } 142 140 143 141 static const struct pmic_typec_resources pm8150b_typec_res = {
+7 -3
drivers/usb/typec/tcpm/tcpm.c
··· 4515 4515 return ERROR_RECOVERY; 4516 4516 if (port->pwr_role == TYPEC_SOURCE) 4517 4517 return SRC_UNATTACHED; 4518 - if (port->state == SNK_WAIT_CAPABILITIES_TIMEOUT) 4518 + if (port->state == SNK_WAIT_CAPABILITIES || 4519 + port->state == SNK_WAIT_CAPABILITIES_TIMEOUT) 4519 4520 return SNK_READY; 4520 4521 return SNK_UNATTACHED; 4521 4522 } ··· 5044 5043 tcpm_set_state(port, SNK_SOFT_RESET, 5045 5044 PD_T_SINK_WAIT_CAP); 5046 5045 } else { 5047 - tcpm_set_state(port, SNK_WAIT_CAPABILITIES_TIMEOUT, 5048 - PD_T_SINK_WAIT_CAP); 5046 + if (!port->self_powered) 5047 + upcoming_state = SNK_WAIT_CAPABILITIES_TIMEOUT; 5048 + else 5049 + upcoming_state = hard_reset_state(port); 5050 + tcpm_set_state(port, upcoming_state, PD_T_SINK_WAIT_CAP); 5049 5051 } 5050 5052 break; 5051 5053 case SNK_WAIT_CAPABILITIES_TIMEOUT:
+1
tools/usb/usbip/src/usbip_detach.c
··· 68 68 } 69 69 70 70 if (!found) { 71 + ret = -1; 71 72 err("Invalid port %s > maxports %d", 72 73 port, vhci_driver->nports); 73 74 goto call_driver_close;