svn commit: r276514 - head/sys/dev/ofw
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Thu Jan 1 22:20:20 UTC 2015
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);
More information about the svn-src-all
mailing list