svn commit: r280978 - head/sys/dev/gpio
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Thu Apr 2 02:43:49 UTC 2015
Author: gonzo
Date: Thu Apr 2 02:43:48 2015
New Revision: 280978
URL: https://svnweb.freebsd.org/changeset/base/280978
Log:
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
Modified:
head/sys/dev/gpio/gpioled.c
Modified: head/sys/dev/gpio/gpioled.c
==============================================================================
--- head/sys/dev/gpio/gpioled.c Thu Apr 2 02:14:58 2015 (r280977)
+++ head/sys/dev/gpio/gpioled.c Thu Apr 2 02:43:48 2015 (r280978)
@@ -106,15 +106,16 @@ gpioled_identify(driver_t *driver, devic
root = OF_finddevice("/");
if (root == 0)
return;
- leds = fdt_find_compatible(root, "gpio-leds", 1);
- if (leds == 0)
- 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)
+ for (leds = OF_child(root); leds != 0; leds = OF_peer(leds)) {
+ if (!fdt_is_compatible_strict(leds, "gpio-leds"))
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
More information about the svn-src-head
mailing list