Date: Thu, 1 Jan 2015 22:20:20 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276514 - head/sys/dev/ofw Message-ID: <201501012220.t01MKK7t088392@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501012220.t01MKK7t088392>