Skip to content

Commit a406566

Browse files
andy-shevTzung-Bi Shih
authored andcommitted
platform/chrome: cros_typec_switch: Use 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@linux.intel.com> Link: https://lore.kernel.org/r/20260120131413.1697891-3-andriy.shevchenko@linux.intel.com Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
1 parent e1adf48 commit a406566

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

drivers/platform/chrome/cros_typec_switch.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,8 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
211211
struct cros_typec_port *port;
212212
struct device *dev = sdata->dev;
213213
struct fwnode_handle *fwnode;
214-
struct acpi_device *adev;
215-
unsigned long long index;
216214
int nports, ret;
215+
u64 index;
217216

218217
nports = device_get_child_node_count(dev);
219218
if (nports == 0) {
@@ -228,17 +227,9 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata)
228227
goto err_switch;
229228
}
230229

231-
adev = to_acpi_device_node(fwnode);
232-
if (!adev) {
233-
dev_err(dev, "Couldn't get ACPI device handle for %pfwP\n", fwnode);
234-
ret = -ENODEV;
235-
goto err_switch;
236-
}
237-
238-
ret = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &index);
239-
if (ACPI_FAILURE(ret)) {
230+
ret = acpi_get_local_u64_address(ACPI_HANDLE_FWNODE(fwnode), &index);
231+
if (ret) {
240232
dev_err(dev, "_ADR wasn't evaluated for %pfwP\n", fwnode);
241-
ret = -ENODATA;
242233
goto err_switch;
243234
}
244235

0 commit comments

Comments
 (0)