diff options
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/address.c | 1 | ||||
-rw-r--r-- | drivers/of/base.c | 41 | ||||
-rw-r--r-- | drivers/of/of_mdio.c | 2 |
3 files changed, 44 insertions, 0 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c index 66d96f1..7e262a6 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -1,4 +1,5 @@ +#include <linux/device.h> #include <linux/io.h> #include <linux/ioport.h> #include <linux/module.h> diff --git a/drivers/of/base.c b/drivers/of/base.c index 5806449..d9bfd49 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) return id; } EXPORT_SYMBOL_GPL(of_alias_get_id); + +const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, + u32 *pu) +{ + const void *curv = cur; + + if (!prop) + return NULL; + + if (!cur) { + curv = prop->value; + goto out_val; + } + + curv += sizeof(*cur); + if (curv >= prop->value + prop->length) + return NULL; + +out_val: + *pu = be32_to_cpup(curv); + return curv; +} +EXPORT_SYMBOL_GPL(of_prop_next_u32); + +const char *of_prop_next_string(struct property *prop, const char *cur) +{ + const void *curv = cur; + + if (!prop) + return NULL; + + if (!cur) + return prop->value; + + curv += strlen(cur) + 1; + if (curv >= prop->value + prop->length) + return NULL; + + return curv; +} +EXPORT_SYMBOL_GPL(of_prop_next_string); diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 483c0adc..2574abd 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -45,6 +45,8 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) for (i=0; i<PHY_MAX_ADDR; i++) mdio->irq[i] = PHY_POLL; + mdio->dev.of_node = np; + /* Register the MDIO bus */ rc = mdiobus_register(mdio); if (rc) |