Handle multiple "gpio-leds"-compatible nodes
There are cases when gpioled nodes in DTS come from different sources (e.g. standard Beaglebone Black LEDs in main DTS + shield LEDs in overlay DTS) so instead of handling only first compatible node go through all child nodes
This commit is contained in:
parent
b810920913
commit
076562d0a9
@ -106,15 +106,16 @@ gpioled_identify(driver_t *driver, device_t bus)
|
|||||||
root = OF_finddevice("/");
|
root = OF_finddevice("/");
|
||||||
if (root == 0)
|
if (root == 0)
|
||||||
return;
|
return;
|
||||||
leds = fdt_find_compatible(root, "gpio-leds", 1);
|
for (leds = OF_child(root); leds != 0; leds = OF_peer(leds)) {
|
||||||
if (leds == 0)
|
if (!fdt_is_compatible_strict(leds, "gpio-leds"))
|
||||||
return;
|
|
||||||
/* Traverse the 'gpio-leds' node and add its children. */
|
|
||||||
for (child = OF_child(leds); child != 0; child = OF_peer(child)) {
|
|
||||||
if (!OF_hasprop(child, "gpios"))
|
|
||||||
continue;
|
|
||||||
if (ofw_gpiobus_add_fdt_child(bus, driver->name, child) == NULL)
|
|
||||||
continue;
|
continue;
|
||||||
|
/* Traverse the 'gpio-leds' node and add its children. */
|
||||||
|
for (child = OF_child(leds); child != 0; child = OF_peer(child)) {
|
||||||
|
if (!OF_hasprop(child, "gpios"))
|
||||||
|
continue;
|
||||||
|
if (ofw_gpiobus_add_fdt_child(bus, driver->name, child) == NULL)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user