diff options
Diffstat (limited to 'drivers/of')
-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 ec56739eb247..dba995b70b84 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -144,6 +144,27 @@ int of_device_is_compatible(const struct device_node *device, | |||
144 | EXPORT_SYMBOL(of_device_is_compatible); | 144 | EXPORT_SYMBOL(of_device_is_compatible); |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * machine_is_compatible - Test root of device tree for a given compatible value | ||
148 | * @compat: compatible string to look for in root node's compatible property. | ||
149 | * | ||
150 | * Returns true if the root node has the given value in its | ||
151 | * compatible property. | ||
152 | */ | ||
153 | int machine_is_compatible(const char *compat) | ||
154 | { | ||
155 | struct device_node *root; | ||
156 | int rc = 0; | ||
157 | |||
158 | root = of_find_node_by_path("/"); | ||
159 | if (root) { | ||
160 | rc = of_device_is_compatible(root, compat); | ||
161 | of_node_put(root); | ||
162 | } | ||
163 | return rc; | ||
164 | } | ||
165 | EXPORT_SYMBOL(machine_is_compatible); | ||
166 | |||
167 | /** | ||
147 | * of_device_is_available - check if a device is available for use | 168 | * of_device_is_available - check if a device is available for use |
148 | * | 169 | * |
149 | * @device: Node to check for availability | 170 | * @device: Node to check for availability |