svn commit: r327391 - head/sys/dev/ofw
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sat Dec 30 20:28:31 UTC 2017
Author: nwhitehorn
Date: Sat Dec 30 20:28:29 2017
New Revision: 327391
URL: https://svnweb.freebsd.org/changeset/base/327391
Log:
Avoid use of the fdt_get_property_*() API, which is intrinsically
incompatible with FDT versions < 16. This also simplifies the code a bit.
MFC after: 1 month
Modified:
head/sys/dev/ofw/ofw_fdt.c
Modified: head/sys/dev/ofw/ofw_fdt.c
==============================================================================
--- head/sys/dev/ofw/ofw_fdt.c Sat Dec 30 20:27:13 2017 (r327390)
+++ head/sys/dev/ofw/ofw_fdt.c Sat Dec 30 20:28:29 2017 (r327391)
@@ -248,7 +248,7 @@ ofw_fdt_instance_to_package(ofw_t ofw, ihandle_t insta
static ssize_t
ofw_fdt_getproplen(ofw_t ofw, phandle_t package, const char *propname)
{
- const struct fdt_property *prop;
+ const void *prop;
int offset, len;
offset = fdt_phandle_offset(package);
@@ -256,7 +256,7 @@ ofw_fdt_getproplen(ofw_t ofw, phandle_t package, const
return (-1);
len = -1;
- prop = fdt_get_property(fdtp, offset, propname, &len);
+ prop = fdt_getprop(fdtp, offset, propname, &len);
if (prop == NULL && strcmp(propname, "name") == 0) {
/* Emulate the 'name' property */
@@ -333,7 +333,7 @@ static int
ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const char *previous, char *buf,
size_t size)
{
- const struct fdt_property *prop;
+ const void *prop;
const char *name;
int offset;
@@ -348,7 +348,7 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const c
if (previous != NULL) {
while (offset >= 0) {
- prop = fdt_get_property_by_offset(fdtp, offset, NULL);
+ prop = fdt_getprop_by_offset(fdtp, offset, &name, NULL);
if (prop == NULL)
return (-1); /* Internal error */
@@ -357,17 +357,16 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const c
return (0); /* No more properties */
/* Check if the last one was the one we wanted */
- name = fdt_string(fdtp, fdt32_to_cpu(prop->nameoff));
if (strcmp(name, previous) == 0)
break;
}
}
- prop = fdt_get_property_by_offset(fdtp, offset, &offset);
+ prop = fdt_getprop_by_offset(fdtp, offset, &name, &offset);
if (prop == NULL)
return (-1); /* Internal error */
- strncpy(buf, fdt_string(fdtp, fdt32_to_cpu(prop->nameoff)), size);
+ strncpy(buf, name, size);
return (1);
}
More information about the svn-src-all
mailing list