Simplify string table access functions

The range sanity checking on the fdt_string_cmp() function causes problems
for the sequential write code (or at least for using RO functions on an
incomplete SW tree).  Plus they didn't really fit with the philosphy for
the RO code of working as widely as possible on weirdly constructed trees.
This commit is contained in:
David Gibson 2006-11-29 16:34:30 +11:00
parent 156649d4f6
commit 3aa4cfd66b
3 changed files with 8 additions and 24 deletions

View file

@ -59,6 +59,11 @@ static int offset_streq(const struct fdt_header *fdt, int offset,
return 1;
}
char *fdt_string(const struct fdt_header *fdt, int stroffset)
{
return (char *)fdt + fdt32_to_cpu(fdt->off_dt_strings) + stroffset;
}
int fdt_property_offset(const struct fdt_header *fdt, int nodeoffset,
const char *name)
{
@ -103,7 +108,7 @@ int fdt_property_offset(const struct fdt_header *fdt, int nodeoffset,
if (! prop)
return OFFSET_ERROR(FDT_ERR_BADSTRUCTURE);
namestroff = fdt32_to_cpu(prop->nameoff);
if (fdt_string_cmp(fdt, namestroff, name) == 0)
if (streq(fdt_string(fdt, namestroff), name))
/* Found it! */
return offset;
break;