diff options
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 580644986945..d9bfd49b1935 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -1260,3 +1260,44 @@ int of_alias_get_id(struct device_node *np, const char *stem) | |||
1260 | return id; | 1260 | return id; |
1261 | } | 1261 | } |
1262 | EXPORT_SYMBOL_GPL(of_alias_get_id); | 1262 | EXPORT_SYMBOL_GPL(of_alias_get_id); |
1263 | |||
1264 | const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, | ||
1265 | u32 *pu) | ||
1266 | { | ||
1267 | const void *curv = cur; | ||
1268 | |||
1269 | if (!prop) | ||
1270 | return NULL; | ||
1271 | |||
1272 | if (!cur) { | ||
1273 | curv = prop->value; | ||
1274 | goto out_val; | ||
1275 | } | ||
1276 | |||
1277 | curv += sizeof(*cur); | ||
1278 | if (curv >= prop->value + prop->length) | ||
1279 | return NULL; | ||
1280 | |||
1281 | out_val: | ||
1282 | *pu = be32_to_cpup(curv); | ||
1283 | return curv; | ||
1284 | } | ||
1285 | EXPORT_SYMBOL_GPL(of_prop_next_u32); | ||
1286 | |||
1287 | const char *of_prop_next_string(struct property *prop, const char *cur) | ||
1288 | { | ||
1289 | const void *curv = cur; | ||
1290 | |||
1291 | if (!prop) | ||
1292 | return NULL; | ||
1293 | |||
1294 | if (!cur) | ||
1295 | return prop->value; | ||
1296 | |||
1297 | curv += strlen(cur) + 1; | ||
1298 | if (curv >= prop->value + prop->length) | ||
1299 | return NULL; | ||
1300 | |||
1301 | return curv; | ||
1302 | } | ||
1303 | EXPORT_SYMBOL_GPL(of_prop_next_string); | ||