]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: acpi: fix device link removal
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Wed, 11 Jun 2025 11:14:15 +0000 (14:14 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 14:05:11 +0000 (16:05 +0200)
commit 3b18405763c1ebb1efc15feef5563c9cdb2cc3a7 upstream.

The device link to the USB4 host interface has to be removed
manually since it's no longer auto removed.

Fixes: 623dae3e7084 ("usb: acpi: fix boot hang due to early incorrect 'tunneled' USB3 device links")
Cc: stable <stable@kernel.org>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/r/20250611111415.2707865-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hub.c
drivers/usb/core/usb-acpi.c
include/linux/usb.h

index da3d0e525b64e93e02f32957b84da30d3144fbe5..da6da5ec42372f8444fa0e150ca78aca54cd1650 100644 (file)
@@ -2336,6 +2336,9 @@ void usb_disconnect(struct usb_device **pdev)
        usb_remove_ep_devs(&udev->ep0);
        usb_unlock_device(udev);
 
+       if (udev->usb4_link)
+               device_link_del(udev->usb4_link);
+
        /* Unregister the device.  The device driver is responsible
         * for de-configuring the device and invoking the remove-device
         * notifier chain (used by usbfs and possibly others).
index 494e21a11cd2651faf4de542168d19675fdf64fa..3bc68534dbcd3779a4e9f1bfd71f1d5453514090 100644 (file)
@@ -157,7 +157,7 @@ EXPORT_SYMBOL_GPL(usb_acpi_set_power_state);
  */
 static int usb_acpi_add_usb4_devlink(struct usb_device *udev)
 {
-       const struct device_link *link;
+       struct device_link *link;
        struct usb_port *port_dev;
        struct usb_hub *hub;
 
@@ -188,6 +188,8 @@ static int usb_acpi_add_usb4_devlink(struct usb_device *udev)
        dev_dbg(&port_dev->dev, "Created device link from %s to %s\n",
                dev_name(&port_dev->child->dev), dev_name(nhi_fwnode->dev));
 
+       udev->usb4_link = link;
+
        return 0;
 }
 
index 672d8fc2abdb02149c6a2bcbf4eb090075cf839f..e76e3515a1da0de944565fdcd41b666a14ebba80 100644 (file)
@@ -612,6 +612,7 @@ struct usb3_lpm_parameters {
  *     FIXME -- complete doc
  * @authenticated: Crypto authentication passed
  * @tunnel_mode: Connection native or tunneled over USB4
+ * @usb4_link: device link to the USB4 host interface
  * @lpm_capable: device supports LPM
  * @lpm_devinit_allow: Allow USB3 device initiated LPM, exit latency is in range
  * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
@@ -722,6 +723,7 @@ struct usb_device {
        unsigned reset_resume:1;
        unsigned port_is_suspended:1;
        enum usb_link_tunnel_mode tunnel_mode;
+       struct device_link *usb4_link;
 
        int slot_id;
        struct usb2_lpm_parameters l1_params;