All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Pecio <michal.pecio@gmail.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] usb: xhci-pci: Clean up xhci_pci_setup()
Date: Fri, 14 Nov 2025 15:06:08 +0100	[thread overview]
Message-ID: <20251114150608.7829fd51.michal.pecio@gmail.com> (raw)
In-Reply-To: <21741b98-4844-4218-8bd9-10b8bf5cd869@linux.intel.com>

This function will be called again when/if the shared HCD is added.
Little to do in this case, so handle it right at the beginning and
forget about it later. Don't bother passing xhci_pci_quirks for the
shared HCD, because quirks are detected in the first run.

Organize the rest so that xhci properties are assigned and visible
before any core initialization begins.

Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
---

I forgot about this patch, here it is rebased on the final fix
which went into mainline a few weeks ago.

 drivers/usb/host/xhci-pci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index d292adc65e5a..6e704d684bcb 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -568,7 +568,7 @@ static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { }
 static void xhci_find_lpm_incapable_ports(struct usb_hcd *hcd, struct usb_device *hdev) { }
 #endif /* CONFIG_ACPI */
 
-/* called during probe() after chip reset completes */
+/* called during probe() after chip reset completes and again on the shared HCD */
 static int xhci_pci_setup(struct usb_hcd *hcd)
 {
 	struct xhci_hcd		*xhci;
@@ -576,20 +576,20 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
 	int			retval;
 	u8			sbrn;
 
+	/* nothing PCI-specific for the shared HCD, just core setup and no quirks */
+	if (!usb_hcd_is_primary_hcd(hcd))
+		return xhci_gen_setup(hcd, NULL);
+
 	xhci = hcd_to_xhci(hcd);
 
 	/* imod_interval is the interrupt moderation value in nanoseconds. */
 	xhci->imod_interval = 40000;
+	xhci->allow_single_roothub = 1;
 
 	retval = xhci_gen_setup(hcd, xhci_pci_quirks);
 	if (retval)
 		return retval;
 
-	if (!usb_hcd_is_primary_hcd(hcd))
-		return 0;
-
-	xhci->allow_single_roothub = 1;
-
 	if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
 		xhci_pme_acpi_rtd3_enable(pdev);
 
-- 
2.48.1

  parent reply	other threads:[~2025-11-14 14:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07 20:47 [REGRESSION] USB-A devices not working on boot after recent USB merge Arisa Snowbell
2025-10-07 21:17 ` Michal Pecio
2025-10-07 22:30   ` Arisa Snowbell
2025-10-08  1:15     ` Arisa Snowbell
2025-10-08  1:41       ` Arisa Snowbell
2025-10-08  6:20       ` Michal Pecio
2025-10-08  9:02         ` Arisa Snowbell
2025-10-08 11:05           ` Michal Pecio
2025-10-08 12:16             ` Arisa Snowbell
2025-10-08 20:34               ` Michal Pecio
2025-10-08 21:29                 ` Arisa Snowbell
2025-10-08 22:25                   ` Arisa Snowbell
2025-10-09 11:14                     ` [REGRESSION] [REPRO] " Michal Pecio
2025-10-09 11:30                       ` Mathias Nyman
2025-10-09 13:27                         ` Michal Pecio
2025-10-10  8:15                           ` Mathias Nyman
2025-10-10  9:15                             ` Arisa Snowbell
2025-10-13  7:22                             ` [PATCH usb-next] usb: xhci-pci: Cleanup xhci_pci_setup() for shared HCD Michal Pecio
2025-10-13  7:55                               ` Mathias Nyman
2025-10-13  8:04                                 ` [PATCH v2 RFT] usb: xhci-pci: Fix USB2-only root hub registration Michal Pecio
2025-10-13 13:52                                   ` Arisa Snowbell
2025-10-13 14:33                                   ` Hanabishi
2025-10-13 16:03                                   ` Michal Kubecek
2025-11-14 14:06                                 ` Michal Pecio [this message]
2025-10-09 12:16                       ` [REGRESSION] [REPRO] USB-A devices not working on boot after recent USB merge Arisa Snowbell
2025-10-09 12:29                         ` [PATCH] usb: xhci-pci: Fix USB2-only root hub registration Michal Pecio
2025-10-09 12:49                           ` Arisa Snowbell
2025-10-09 13:08                             ` Mathias Nyman
2025-10-09 11:15                     ` [REGRESSION] USB-A devices not working on boot after recent USB merge Mathias Nyman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251114150608.7829fd51.michal.pecio@gmail.com \
    --to=michal.pecio@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.