[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260120131413.1697891-3-andriy.shevchenko@linux.intel.com>
Date: Tue, 20 Jan 2026 14:12:31 +0100
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
chrome-platform@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: Benson Leung <bleung@...omium.org>,
Abhishek Pandit-Subedi <abhishekpandit@...omium.org>,
Jameson Thies <jthies@...gle.com>,
Andrei Kuchynski <akuchynski@...omium.org>,
Tzung-Bi Shih <tzungbi@...nel.org>
Subject: [PATCH v1 2/2] platform/chrome: cros_typec_switch: simplify code with acpi_get_local_u64_address()
Now we have a helper so there's no need to open-code.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/platform/chrome/cros_typec_switch.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index d8a28d4e51a8..fe0eddd2cf45 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -211,9 +211,8 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
struct cros_typec_port *port;
struct device *dev = sdata->dev;
struct fwnode_handle *fwnode;
- struct acpi_device *adev;
- unsigned long long index;
int nports, ret;
+ u64 index;
nports = device_get_child_node_count(dev);
if (nports == 0) {
@@ -228,17 +227,9 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
goto err_switch;
}
- adev = to_acpi_device_node(fwnode);
- if (!adev) {
- dev_err(dev, "Couldn't get ACPI device handle for %pfwP\n", fwnode);
- ret = -ENODEV;
- goto err_switch;
- }
-
- ret = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &index);
- if (ACPI_FAILURE(ret)) {
+ ret = acpi_get_local_u64_address(ACPI_HANDLE_FWNODE(fwnode), &index);
+ if (ret) {
dev_err(dev, "_ADR wasn't evaluated for %pfwP\n", fwnode);
- ret = -ENODATA;
goto err_switch;
}
--
2.50.1
Powered by blists - more mailing lists