<p>Duncan Laurie has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/26172">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">acpi: device: Walk up the tree to find identifier<br><br>Instead of just checking the immediate parent for an device name,<br>walk up the tree to check if any parent can identify the device.<br><br>This allows devices to be nested more than one level deep and<br>still have them identified in one place by the SOC.<br><br>Change-Id: I9938fc20a839db91ff25e91bba08baa7421e3cd4<br>Signed-off-by: Duncan Laurie <dlaurie@google.com><br>---<br>M src/arch/x86/acpi_device.c<br>1 file changed, 13 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/26172/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/arch/x86/acpi_device.c b/src/arch/x86/acpi_device.c</span><br><span>index c8d313e..df2226d 100644</span><br><span>--- a/src/arch/x86/acpi_device.c</span><br><span>+++ b/src/arch/x86/acpi_device.c</span><br><span>@@ -55,6 +55,9 @@</span><br><span> /* Locate and return the ACPI name for this device */</span><br><span> const char *acpi_device_name(struct device *dev)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct device *pdev = dev;</span><br><span style="color: hsl(120, 100%, 40%);">+    const char *name;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  if (!dev)</span><br><span>            return NULL;</span><br><span> </span><br><span>@@ -62,9 +65,16 @@</span><br><span>        if (dev->ops->acpi_name)</span><br><span>               return dev->ops->acpi_name(dev);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      /* Check parent device in case it has a global handler */</span><br><span style="color: hsl(0, 100%, 40%);">-       if (dev->bus && dev->bus->dev->ops->acpi_name)</span><br><span style="color: hsl(0, 100%, 40%);">-           return dev->bus->dev->ops->acpi_name(dev);</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Walk up the tree to find if any parent can identify this device */</span><br><span style="color: hsl(120, 100%, 40%);">+ while (pdev->bus) {</span><br><span style="color: hsl(120, 100%, 40%);">+                if (pdev->path.type == DEVICE_PATH_ROOT)</span><br><span style="color: hsl(120, 100%, 40%);">+                   break;</span><br><span style="color: hsl(120, 100%, 40%);">+                if (pdev->bus->dev->ops && pdev->bus->dev->ops->acpi_name)</span><br><span style="color: hsl(120, 100%, 40%);">+                       name = pdev->bus->dev->ops->acpi_name(dev);</span><br><span style="color: hsl(120, 100%, 40%);">+               if (name)</span><br><span style="color: hsl(120, 100%, 40%);">+                     return name;</span><br><span style="color: hsl(120, 100%, 40%);">+          pdev = pdev->bus->dev;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span> </span><br><span>        return NULL;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/26172">change 26172</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/26172"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I9938fc20a839db91ff25e91bba08baa7421e3cd4 </div>
<div style="display:none"> Gerrit-Change-Number: 26172 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Duncan Laurie <dlaurie@chromium.org> </div>