summaryrefslogtreecommitdiff
path: root/src/acpi/device.c
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2024-01-22 15:39:46 +0100
committerLean Sheng Tan <sheng.tan@9elements.com>2024-01-24 08:46:19 +0000
commitf95dbcee713d3a8a081644ee345ce0f6fedf39ac (patch)
tree246036838430e0f3724b18cd482cface0c6c853c /src/acpi/device.c
parentd8796e50f322ea81fb61ebfce60f3f4d82d0bf2c (diff)
device: Add inline method to identify PATH_ROOT
Add and use inline method to identify the root device. Change-Id: I394c8668245bcfea6414b8ca5f14ef8135897e59 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80169 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/acpi/device.c')
-rw-r--r--src/acpi/device.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/acpi/device.c b/src/acpi/device.c
index 92000a3d8b..823cdbeb5a 100644
--- a/src/acpi/device.c
+++ b/src/acpi/device.c
@@ -87,7 +87,7 @@ const char *acpi_device_name(const struct device *dev)
pdev = pdev->bus->dev;
if (!pdev)
break;
- if (pdev->path.type == DEVICE_PATH_ROOT)
+ if (is_root_device(pdev))
break;
if (pdev->ops && pdev->ops->acpi_name)
name = pdev->ops->acpi_name(dev);
@@ -147,16 +147,15 @@ static ssize_t acpi_device_path_fill(const struct device *dev, char *buf,
return cur;
/* Walk up the tree to the root device */
- if (dev->path.type != DEVICE_PATH_ROOT && dev->bus && dev->bus->dev)
+ if (!is_root_device(dev) && dev->bus && dev->bus->dev)
next = acpi_device_path_fill(dev->bus->dev, buf, buf_len, cur);
if (next < 0)
return next;
/* Fill in the path from the root device */
next += snprintf(buf + next, buf_len - next, "%s%s",
- (dev->path.type == DEVICE_PATH_ROOT
- || (strlen(name) == 0)) ?
- "" : ".", name);
+ (is_root_device(dev) || (strlen(name) == 0)) ?
+ "" : ".", name);
return next;
}