[coreboot-gerrit] Change in coreboot[master]: acpi: device: Walk up the tree to find identifier
Duncan Laurie (Code Review)
gerrit at coreboot.org
Tue May 8 23:16:47 CEST 2018
Duncan Laurie has uploaded this change for review. ( https://review.coreboot.org/26172
Change subject: acpi: device: Walk up the tree to find identifier
......................................................................
acpi: device: Walk up the tree to find identifier
Instead of just checking the immediate parent for an device name,
walk up the tree to check if any parent can identify the device.
This allows devices to be nested more than one level deep and
still have them identified in one place by the SOC.
Change-Id: I9938fc20a839db91ff25e91bba08baa7421e3cd4
Signed-off-by: Duncan Laurie <dlaurie at google.com>
---
M src/arch/x86/acpi_device.c
1 file changed, 13 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/26172/1
diff --git a/src/arch/x86/acpi_device.c b/src/arch/x86/acpi_device.c
index c8d313e..df2226d 100644
--- a/src/arch/x86/acpi_device.c
+++ b/src/arch/x86/acpi_device.c
@@ -55,6 +55,9 @@
/* Locate and return the ACPI name for this device */
const char *acpi_device_name(struct device *dev)
{
+ struct device *pdev = dev;
+ const char *name;
+
if (!dev)
return NULL;
@@ -62,9 +65,16 @@
if (dev->ops->acpi_name)
return dev->ops->acpi_name(dev);
- /* Check parent device in case it has a global handler */
- if (dev->bus && dev->bus->dev->ops->acpi_name)
- return dev->bus->dev->ops->acpi_name(dev);
+ /* Walk up the tree to find if any parent can identify this device */
+ while (pdev->bus) {
+ if (pdev->path.type == DEVICE_PATH_ROOT)
+ break;
+ if (pdev->bus->dev->ops && pdev->bus->dev->ops->acpi_name)
+ name = pdev->bus->dev->ops->acpi_name(dev);
+ if (name)
+ return name;
+ pdev = pdev->bus->dev;
+ }
return NULL;
}
--
To view, visit https://review.coreboot.org/26172
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9938fc20a839db91ff25e91bba08baa7421e3cd4
Gerrit-Change-Number: 26172
Gerrit-PatchSet: 1
Gerrit-Owner: Duncan Laurie <dlaurie at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180508/c5b1c59b/attachment-0001.html>
More information about the coreboot-gerrit
mailing list