Skip to content

Commit 197a5ae

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: x86: Refactor _UID handling to use acpi_dev_uid_to_integer()
ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as an integer. Use it instead of custom approach. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2a036e4 commit 197a5ae

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/acpi/x86/utils.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,22 +351,28 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
351351
struct acpi_device *adev = ACPI_COMPANION(controller_parent);
352352
const struct dmi_system_id *dmi_id;
353353
long quirks = 0;
354+
u64 uid;
355+
int ret;
354356

355357
*skip = false;
356358

357-
/* !dev_is_platform() to not match on PNP enumerated debug UARTs */
358-
if (!adev || !adev->pnp.unique_id || !dev_is_platform(controller_parent))
359+
ret = acpi_dev_uid_to_integer(adev, &uid);
360+
if (ret)
361+
return 0;
362+
363+
/* to not match on PNP enumerated debug UARTs */
364+
if (!dev_is_platform(controller_parent))
359365
return 0;
360366

361367
dmi_id = dmi_first_match(acpi_quirk_skip_dmi_ids);
362368
if (dmi_id)
363369
quirks = (unsigned long)dmi_id->driver_data;
364370

365371
if (quirks & ACPI_QUIRK_UART1_TTY_UART2_SKIP) {
366-
if (!strcmp(adev->pnp.unique_id, "1"))
372+
if (uid == 1)
367373
return -ENODEV; /* Create tty cdev instead of serdev */
368374

369-
if (!strcmp(adev->pnp.unique_id, "2"))
375+
if (uid == 2)
370376
*skip = true;
371377
}
372378

0 commit comments

Comments
 (0)