From patchwork Tue Dec 7 14:37:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 12661979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B76FC433EF for ; Tue, 7 Dec 2021 14:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237994AbhLGOle (ORCPT ); Tue, 7 Dec 2021 09:41:34 -0500 Received: from mga03.intel.com ([134.134.136.65]:48408 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237989AbhLGOlc (ORCPT ); Tue, 7 Dec 2021 09:41:32 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10190"; a="237528438" X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="237528438" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 06:38:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="657725100" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 07 Dec 2021 06:37:59 -0800 From: Heikki Krogerus To: "Rafael J. Wysocki" , Greg Kroah-Hartman Cc: Andy Shevchenko , Sakari Ailus , Prashant Malani , linux-acpi@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] usb: Use the cached ACPI _PLD entry Date: Tue, 7 Dec 2021 17:37:54 +0300 Message-Id: <20211207143757.21895-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211207143757.21895-1-heikki.krogerus@linux.intel.com> References: <20211207143757.21895-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The _PLD is now stored, so there is no need to separately evaluate it. Signed-off-by: Heikki Krogerus --- 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;