Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Atharva Tiwari" <atharvatiwarilinuxdev@gmail.com>
Cc: "open list:USB XHCI DRIVER" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] usb: xhci-pci: Add Power handling for Card readers on Apple systems
Date: Mon, 16 Nov 2026 23:34:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-217899@kernel.org> (raw)
In-Reply-To: <20261116231926.5891-1-atharvatiwarilinuxdev@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] usb: xhci-pci: build failure when CONFIG_ACPI is disabled
- [Medium] usb: xhci-pci: xhci_pci_suspend() powers off card reader when
  suspend fails
--

commit 6b73237773664917a89fc903fc5b335cb19cc8a0
Author: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>

usb: xhci-pci: Add Power handling for Card readers on Apple systems

This commit adds power handling for card readers on x86 Apple systems by
evaluating the SPWR ACPI method during xhci-pci probe, suspend, and
resume.

> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index e278db940a583..0cbecbbbb21b2 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
[ ... ]
> @@ -517,6 +518,16 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>  	if (xhci->hci_version >= 0x120)
>  		xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
>  
> +	/* On Apple Machine with Card readers, we have to use SPWR(0/1) to turn
> +	 * off/on the card reader, And on boot the card reader is off, so we turn
> +	 * it on.
> +	 */
> +	if (x86_apple_machine && ACPI_HANDLE(&pdev->dev) &&
> +			acpi_has_method(ACPI_HANDLE(&pdev->dev), "SPWR")) {
> +		acpi_execute_simple_method(ACPI_HANDLE(&pdev->dev), "SPWR", 1);
> +		xhci->quirks |= XHCI_APPLE_CARD_READER_POWER;
> +	}

[Severity: High]
Does calling acpi_execute_simple_method() here and in xhci_pci_suspend()
and xhci_pci_resume() break the build when CONFIG_ACPI is disabled?

include/acpi/acpi_bus.h declares acpi_execute_simple_method() only inside
#ifdef CONFIG_ACPI and provides no stub for !CONFIG_ACPI, whereas
CONFIG_USB_XHCI_PCI does not depend on CONFIG_ACPI.

> @@ -853,6 +864,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
>  	/* synchronize irq when using MSI-X */
>  	xhci_msix_sync_irqs(xhci);
>  
> +	if (xhci->quirks & XHCI_APPLE_CARD_READER_POWER)
> +		acpi_execute_simple_method(ACPI_HANDLE(&pdev->dev), "SPWR", 0);
> +
>  	if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED))
>  		xhci_ssic_port_unused_quirk(hcd, false);

[Severity: Medium]
Should SPWR(0) be skipped when xhci_suspend() returns an error in ret?

If xhci_suspend() fails, suspend_common() aborts the suspend without
calling xhci_pci_resume(), leaving the card reader powered off while the
host controller remains active.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116231926.5891-1-atharvatiwarilinuxdev@gmail.com?part=1

      reply	other threads:[~2026-11-16 23:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 23:19 [PATCH] usb: xhci-pci: Add Power handling for Card readers on Apple systems Atharva Tiwari
2026-11-16 23:34 ` sashiko-bot [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=sashiko-outbox-217899@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=atharvatiwarilinuxdev@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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