public inbox for linux-kernel@vger.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: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABpa4MA9unucCoKtSdzJyOLjHNVy+Cwgz5AnAxPkKw6vuox1Nw@mail.gmail.com>
     [not found] ` <20251007231709.6c16802e.michal.pecio@gmail.com>
     [not found]   ` <CABpa4MCUnLUR_0Vzgd=rTr0+Hot=nxHirKrX6xtJWowDoLhWJw@mail.gmail.com>
     [not found]     ` <CABpa4MCg7yixe7O8Pp+YwvpxeC=1JPhMhAap12RjtV6pcxFYgQ@mail.gmail.com>
     [not found]       ` <20251008082055.5646dadc.michal.pecio@gmail.com>
     [not found]         ` <CABpa4MCm8hQXvtSYqUA+Dh3rCLVM5rTC1p+FsgmFemv+Vyz=RA@mail.gmail.com>
     [not found]           ` <20251008130532.49922d58.michal.pecio@gmail.com>
     [not found]             ` <CABpa4MAsvK68CyQ7bVdie1j2m2O2YAEuFJHq8D-65uFT3FzKzQ@mail.gmail.com>
     [not found]               ` <20251008223406.13f16f19.michal.pecio@gmail.com>
     [not found]                 ` <CABpa4MBGW=OJi+j34TbL2g=zyTg7-rxqpHYfAW-1DXTPk=g5Fw@mail.gmail.com>
     [not found]                   ` <CABpa4MBDvgJcgJf3_E7k1dBXs7v1tW-79dmc_sQDVM1bES5YDQ@mail.gmail.com>
     [not found]                     ` <20251009131444.2c221922.michal.pecio@gmail.com>
     [not found]                       ` <CABpa4MC-pij0Fczh-mH3zc+Ey2ALX70OfxX=cG4om7R6WMdRBg@mail.gmail.com>
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
     [not found]                       ` <90c03eeb-3913-4968-88c0-0de09023a2b5@linux.intel.com>
     [not found]                         ` <20251009152703.72e780b4.michal.pecio@gmail.com>
     [not found]                           ` <b8c2423f-aa9d-442a-ae2f-3c4d78949b38@linux.intel.com>
     [not found]                             ` <20251013092250.699bf60f.michal.pecio@gmail.com>
     [not found]                               ` <21741b98-4844-4218-8bd9-10b8bf5cd869@linux.intel.com>
2025-11-14 14:06                                 ` Michal Pecio [this message]

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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox