linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Prashant Malani <pmalani@chromium.org>,
	linux-acpi@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/5] usb: Use the cached ACPI _PLD entry
Date: Mon, 13 Dec 2021 13:32:40 +0300	[thread overview]
Message-ID: <20211213103243.33657-3-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <20211213103243.33657-1-heikki.krogerus@linux.intel.com>

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

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 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


  parent reply	other threads:[~2021-12-13 10:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 10:32 [PATCH v2 0/5] acpi: Store _PLD information and convert users Heikki Krogerus
2021-12-13 10:32 ` [PATCH v2 1/5] acpi: Store the Physical Location of Device (_PLD) information Heikki Krogerus
2021-12-15 11:43   ` Rafael J. Wysocki
2021-12-15 13:08     ` Heikki Krogerus
2021-12-15 14:52       ` Rafael J. Wysocki
2021-12-13 10:32 ` Heikki Krogerus [this message]
2021-12-13 10:32 ` [PATCH v2 3/5] usb: Link the ports to the connectors they are attached to Heikki Krogerus
2021-12-13 10:32 ` [PATCH v2 4/5] usb: typec: port-mapper: Convert to the component framework Heikki Krogerus
2021-12-13 10:32 ` [PATCH v2 5/5] usb: Remove usb_for_each_port() Heikki Krogerus
2021-12-13 12:10 ` [PATCH v2 0/5] acpi: Store _PLD information and convert users Andy Shevchenko
2021-12-14 23:04 ` Prashant Malani
2021-12-15 10:56 ` Rafael J. Wysocki

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=20211213103243.33657-3-heikki.krogerus@linux.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pmalani@chromium.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@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;
as well as URLs for NNTP newsgroup(s).