From owner-svn-src-all@FreeBSD.ORG Thu Jan 1 22:20:20 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 CFE72D91; Thu, 1 Jan 2015 22:20:20 +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 BB7C0645D2; Thu, 1 Jan 2015 22:20:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t01MKKlB088393; Thu, 1 Jan 2015 22:20:20 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t01MKK7t088392; Thu, 1 Jan 2015 22:20:20 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201501012220.t01MKK7t088392@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 1 Jan 2015 22:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276514 - head/sys/dev/ofw 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, 01 Jan 2015 22:20:20 -0000 Author: nwhitehorn Date: Thu Jan 1 22:20:19 2015 New Revision: 276514 URL: https://svnweb.freebsd.org/changeset/base/276514 Log: The path entry for a device tree node and its name property are usually, but not always, identical. In particular, the path entry may contain a unit address that the name does not. If the FDT node does have an explicit name property, treat that as an override of the FDT path rather than ignoring it. MFC after: 2 weeks Modified: head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Thu Jan 1 22:18:27 2015 (r276513) +++ head/sys/dev/ofw/ofw_fdt.c Thu Jan 1 22:20:19 2015 (r276514) @@ -222,15 +222,15 @@ ofw_fdt_getproplen(ofw_t ofw, phandle_t if (offset < 0) return (-1); - if (strcmp(propname, "name") == 0) { + len = -1; + prop = fdt_get_property(fdtp, offset, propname, &len); + + if (prop == NULL && strcmp(propname, "name") == 0) { /* Emulate the 'name' property */ fdt_get_name(fdtp, offset, &len); return (len + 1); } - len = -1; - prop = fdt_get_property(fdtp, offset, propname, &len); - return (len); } @@ -247,7 +247,9 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t pac if (offset < 0) return (-1); - if (strcmp(propname, "name") == 0) { + prop = fdt_getprop(fdtp, offset, propname, &len); + + if (prop == NULL && strcmp(propname, "name") == 0) { /* Emulate the 'name' property */ name = fdt_get_name(fdtp, offset, &len); strncpy(buf, name, buflen); @@ -256,7 +258,6 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t pac return (len + 1); } - prop = fdt_getprop(fdtp, offset, propname, &len); if (prop == NULL) return (-1);