mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-05-10 01:03:58 +00:00
drivers property: When no children in primary, try secondary
Software firmware nodes can provide a child node to its parent. Since software node can be secondary, we need a mechanism to access the children. The idea is to list children of the primary node first and when they are finished, continue with secondary node if available. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200520102959.34812-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c82c83c330
commit
114dbb4fa7
1 changed files with 11 additions and 2 deletions
|
@ -708,14 +708,23 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
|
||||||
struct fwnode_handle *child)
|
struct fwnode_handle *child)
|
||||||
{
|
{
|
||||||
struct acpi_device *adev = ACPI_COMPANION(dev);
|
struct acpi_device *adev = ACPI_COMPANION(dev);
|
||||||
struct fwnode_handle *fwnode = NULL;
|
struct fwnode_handle *fwnode = NULL, *next;
|
||||||
|
|
||||||
if (dev->of_node)
|
if (dev->of_node)
|
||||||
fwnode = &dev->of_node->fwnode;
|
fwnode = &dev->of_node->fwnode;
|
||||||
else if (adev)
|
else if (adev)
|
||||||
fwnode = acpi_fwnode_handle(adev);
|
fwnode = acpi_fwnode_handle(adev);
|
||||||
|
|
||||||
return fwnode_get_next_child_node(fwnode, child);
|
/* Try to find a child in primary fwnode */
|
||||||
|
next = fwnode_get_next_child_node(fwnode, child);
|
||||||
|
if (next)
|
||||||
|
return next;
|
||||||
|
|
||||||
|
/* When no more children in primary, continue with secondary */
|
||||||
|
if (!IS_ERR_OR_NULL(fwnode->secondary))
|
||||||
|
next = fwnode_get_next_child_node(fwnode->secondary, child);
|
||||||
|
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(device_get_next_child_node);
|
EXPORT_SYMBOL_GPL(device_get_next_child_node);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue