[PATCH v2 2/5] usb: Use the cached ACPI _PLD entry

From: Heikki Krogerus
Date: Mon Dec 13 2021 - 05:34:33 EST


The _PLD is now stored, so there is no need to separately
evaluate it.

Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
---
drivers/usb/core/usb-acpi.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index 50b2fc7fcc0e3..3b21c15be548f 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -176,22 +176,19 @@ usb_acpi_get_companion_for_port(struct usb_port *port_dev)
static struct acpi_device *
usb_acpi_find_companion_for_port(struct usb_port *port_dev)
{
+ struct acpi_device_location *location;
struct acpi_device *adev;
- struct acpi_pld_info *pld;
- acpi_handle *handle;
- acpi_status status;

adev = usb_acpi_get_companion_for_port(port_dev);
if (!adev)
return NULL;

- handle = adev->handle;
- status = acpi_get_physical_device_location(handle, &pld);
- if (ACPI_SUCCESS(status) && pld) {
- port_dev->location = USB_ACPI_LOCATION_VALID
- | pld->group_token << 8 | pld->group_position;
- port_dev->connect_type = usb_acpi_get_connect_type(handle, pld);
- ACPI_FREE(pld);
+ location = acpi_device_get_location(adev);
+ if (location) {
+ port_dev->location = USB_ACPI_LOCATION_VALID |
+ location->pld->group_token << 8 |
+ location->pld->group_position;
+ port_dev->connect_type = usb_acpi_get_connect_type(adev->handle, location->pld);
}

return adev;
--
2.33.0