From owner-svn-src-all@FreeBSD.ORG Thu Apr 2 02:43:49 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F1F330F; Thu, 2 Apr 2015 02:43:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A5BC1DA; Thu, 2 Apr 2015 02:43:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t322hnVd068497; Thu, 2 Apr 2015 02:43:49 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t322hnpg068496; Thu, 2 Apr 2015 02:43:49 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201504020243.t322hnpg068496@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 2 Apr 2015 02:43:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280978 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2015 02:43:49 -0000 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