Re: [PATCH v2] usb: acpi: Get correct location data for Apple macs
From: Atharva Tiwari
Date: Mon Nov 23 2026 - 02:01:20 EST
> Please slow down, there is no rush. One patch per 24 hours max.
K, i did not know this, sorry.
> Again, why is this needed and not just calculated at the one place you
actually use it?
So i use it here:
static struct acpi_device *
usb_acpi_find_companion_for_port(struct usb_port *port_dev)
{
struct acpi_device *adev;
adev = usb_acpi_get_companion_for_port(port_dev);
if (!adev)
return NULL;
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;
}
And its calculated it here:
static void usb_acpi_apple_detect_ssp(acpi_handle xhc1)
{
bool found = false;
acpi_walk_namespace(ACPI_TYPE_DEVICE, xhc1, ACPI_UINT32_MAX,
usb_acpi_apple_ssp_cb, NULL, &found, NULL);
is_apple_location = found;
}
so its used PER port, so if there are 7 HS and 6 SS ports
And you suggest that i calculated at the one place i use it, so
i would have to walk the acpi namespace 11 times in that scenario
instead i can just cache it in a global variable like is_apple_location
so i only have to walk the acpi namespace 1 time.