diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/of/base.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index d6dc5e74c27c..70b60845140e 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
| @@ -18,6 +18,12 @@ | |||
| 18 | */ | 18 | */ |
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/of.h> | 20 | #include <linux/of.h> |
| 21 | #include <linux/spinlock.h> | ||
| 22 | |||
| 23 | /* use when traversing tree through the allnext, child, sibling, | ||
| 24 | * or parent members of struct device_node. | ||
| 25 | */ | ||
| 26 | DEFINE_RWLOCK(devtree_lock); | ||
| 21 | 27 | ||
| 22 | int of_n_addr_cells(struct device_node *np) | 28 | int of_n_addr_cells(struct device_node *np) |
| 23 | { | 29 | { |
| @@ -51,6 +57,26 @@ int of_n_size_cells(struct device_node *np) | |||
| 51 | } | 57 | } |
| 52 | EXPORT_SYMBOL(of_n_size_cells); | 58 | EXPORT_SYMBOL(of_n_size_cells); |
| 53 | 59 | ||
| 60 | struct property *of_find_property(const struct device_node *np, | ||
| 61 | const char *name, | ||
| 62 | int *lenp) | ||
| 63 | { | ||
| 64 | struct property *pp; | ||
| 65 | |||
| 66 | read_lock(&devtree_lock); | ||
| 67 | for (pp = np->properties; pp != 0; pp = pp->next) { | ||
| 68 | if (of_prop_cmp(pp->name, name) == 0) { | ||
| 69 | if (lenp != 0) | ||
| 70 | *lenp = pp->length; | ||
| 71 | break; | ||
| 72 | } | ||
| 73 | } | ||
| 74 | read_unlock(&devtree_lock); | ||
| 75 | |||
| 76 | return pp; | ||
| 77 | } | ||
| 78 | EXPORT_SYMBOL(of_find_property); | ||
| 79 | |||
| 54 | /* | 80 | /* |
| 55 | * Find a property with a given name for a given node | 81 | * Find a property with a given name for a given node |
| 56 | * and return the value. | 82 | * and return the value. |
