diff options
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 70b60845140e..82bb78680ff6 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -113,3 +113,24 @@ int of_device_is_compatible(const struct device_node *device, | |||
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | EXPORT_SYMBOL(of_device_is_compatible); | 115 | EXPORT_SYMBOL(of_device_is_compatible); |
116 | |||
117 | /** | ||
118 | * of_get_parent - Get a node's parent if any | ||
119 | * @node: Node to get parent | ||
120 | * | ||
121 | * Returns a node pointer with refcount incremented, use | ||
122 | * of_node_put() on it when done. | ||
123 | */ | ||
124 | struct device_node *of_get_parent(const struct device_node *node) | ||
125 | { | ||
126 | struct device_node *np; | ||
127 | |||
128 | if (!node) | ||
129 | return NULL; | ||
130 | |||
131 | read_lock(&devtree_lock); | ||
132 | np = of_node_get(node->parent); | ||
133 | read_unlock(&devtree_lock); | ||
134 | return np; | ||
135 | } | ||
136 | EXPORT_SYMBOL(of_get_parent); | ||