Date: Thu, 2 Apr 2015 02:43:49 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280978 - head/sys/dev/gpio Message-ID: <201504020243.t322hnpg068496@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504020243.t322hnpg068496>