summaryrefslogtreecommitdiff
path: root/src/arch/x86/acpi_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/acpi_device.c')
-rw-r--r--src/arch/x86/acpi_device.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/arch/x86/acpi_device.c b/src/arch/x86/acpi_device.c
index c8d313e037..df2226d340 100644
--- a/src/arch/x86/acpi_device.c
+++ b/src/arch/x86/acpi_device.c
@@ -55,6 +55,9 @@ static void acpi_device_fill_len(void *ptr)
/* 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 @@ const char *acpi_device_name(struct device *dev)
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;
}