All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Atharva Tiwari" <atharvatiwarilinuxdev@gmail.com>
Cc: "open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH v2] usb: acpi: Get correct location data for Apple macs
Date: Mon, 23 Nov 2026 06:33:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-228767@kernel.org> (raw)
In-Reply-To: <20261123062519.11531-1-atharvatiwarilinuxdev@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] usb: acpi: unnecessary static is_apple_location in
  usb_acpi_register()
--

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

usb: acpi: Get correct location data for Apple macs

This commit overrides the ACPI _PLD port location on x86 Apple Macs whose
internal XHC1 controller exposes an SSP method, using SSP for USB 2.0 ports
and _ADR for USB 3.x ports.

> diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
> index 489dbdc96f94a..403c2ff44e86a 100644
> --- a/drivers/usb/core/usb-acpi.c
> +++ b/drivers/usb/core/usb-acpi.c

[ ... ]

> @@ -199,6 +200,69 @@ static int usb_acpi_add_usb4_devlink(struct usb_device *udev)
>   */
>  #define USB_ACPI_LOCATION_VALID (1 << 31)
>  
> +/*
> + * Set at registration time on x86 Apple Macs whose internal XHC1 controller
> + * has ports exposing an SSP object. Apple reports the port location through
> + * SSP (USB 2.0) and _ADR (USB 3.x) instead of _PLD.
> + */
> +static bool is_apple_location;

[ ... ]

> @@ -289,6 +353,10 @@ usb_acpi_find_companion_for_port(struct usb_port *port_dev)
>  
>  	usb_acpi_get_connect_type(port_dev, adev->handle);
>  
> +	/* Apple's location overrides the _PLD derived one */
> +	if (is_apple_location)
> +		usb_acpi_apple_get_location(port_dev, adev);
> +
>  	return adev;
>  }
>  
> @@ -377,6 +445,12 @@ static struct acpi_bus_type usb_acpi_bus = {
>  
>  int usb_acpi_register(void)
>  {
> +	acpi_handle xhc1;
> +
> +	if (x86_apple_machine &&
> +	    ACPI_SUCCESS(acpi_get_handle(NULL, "\\_SB.PCI0.XHC1", &xhc1)))
> +		usb_acpi_apple_detect_ssp(xhc1);
> +
>  	return register_acpi_bus_type(&usb_acpi_bus);
>  }

[Severity: Low]
As reported by Greg Kroah-Hartman on v1 [1], can the static
is_apple_location variable and the registration-time lookup in
usb_acpi_register() be dropped by performing the check directly at the call
site?

usb_acpi_apple_get_location() already resolves the host controller ACPI
device via hc = ACPI_COMPANION(hdev->bus->sysdev) and checks that its bus
ID is XHC1.  Because all child port objects and SSP methods under
hc->handle exist in the ACPI namespace before any USB 2.0 or USB 3.0 port
is enumerated, checking x86_apple_machine and scanning hc->handle in
usb_acpi_apple_get_location() does not depend on port enumeration order and
avoids hardcoding \_SB.PCI0.XHC1 in usb_acpi_register().

[1] https://lore.kernel.org/r/2026112338-pummel-hyperlink-2957@gregkh

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

  reply	other threads:[~2026-11-23  6:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  6:25 [PATCH v2] usb: acpi: Get correct location data for Apple macs Atharva Tiwari
2026-11-23  6:33 ` sashiko-bot [this message]
2026-11-23  6:45 ` Greg Kroah-Hartman
2026-11-23  7:01   ` Atharva Tiwari
2026-11-30  9:50 ` Atharva Tiwari
2026-11-30 11:56   ` Greg KH

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-228767@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 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.