From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Benson Leung <bleung@chromium.org>,
Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
Jameson Thies <jthies@google.com>,
Andrei Kuchynski <akuchynski@chromium.org>,
Tzung-Bi Shih <tzungbi@kernel.org>
Subject: [PATCH v1 2/2] platform/chrome: cros_typec_switch: simplify code with acpi_get_local_u64_address()
Date: Tue, 20 Jan 2026 14:12:31 +0100 [thread overview]
Message-ID: <20260120131413.1697891-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260120131413.1697891-1-andriy.shevchenko@linux.intel.com>
Now we have a helper so there's no need to open-code.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.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
next prev parent reply other threads:[~2026-01-20 13:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 13:12 [PATCH v1 0/2] platform/chrome: cros_typec_switch: Fix fwnode and _ADR handling Andy Shevchenko
2026-01-20 13:12 ` [PATCH v1 1/2] platform/chrome: cros_typec_switch: Don't touch struct fwnode_handle::dev Andy Shevchenko
2026-01-20 13:12 ` Andy Shevchenko [this message]
2026-01-21 4:41 ` [PATCH v1 0/2] platform/chrome: cros_typec_switch: Fix fwnode and _ADR handling Tzung-Bi Shih
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=20260120131413.1697891-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=abhishekpandit@chromium.org \
--cc=akuchynski@chromium.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=jthies@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tzungbi@kernel.org \
/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