aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-01-28 15:47:25 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-01-28 15:47:25 -0500
commit1f43cfb9474d1c4f22598b6e3213ec035be6dd56 (patch)
tree71b769e38856b591ec68d9bb593766bdc679c0c9
parent86e032213424958b45564d0cc96b3316641a49d3 (diff)
of: merge machine_is_compatible()
Merge common code between PowerPC and Microblaze Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Tested-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/microblaze/kernel/prom.c18
-rw-r--r--arch/powerpc/kernel/prom.c19
-rw-r--r--drivers/of/base.c21
3 files changed, 21 insertions, 37 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 5505bcffd7dd..16a001c71e2e 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -318,24 +318,6 @@ void __init early_init_devtree(void *params)
318 pr_debug(" <- early_init_devtree()\n"); 318 pr_debug(" <- early_init_devtree()\n");
319} 319}
320 320
321/**
322 * Indicates whether the root node has a given value in its
323 * compatible property.
324 */
325int machine_is_compatible(const char *compat)
326{
327 struct device_node *root;
328 int rc = 0;
329
330 root = of_find_node_by_path("/");
331 if (root) {
332 rc = of_device_is_compatible(root, compat);
333 of_node_put(root);
334 }
335 return rc;
336}
337EXPORT_SYMBOL(machine_is_compatible);
338
339/******* 321/*******
340 * 322 *
341 * New implementation of the OF "find" APIs, return a refcounted 323 * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 877fad9b3745..caeea9a5fcc2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -754,25 +754,6 @@ void __init early_init_devtree(void *params)
754 DBG(" <- early_init_devtree()\n"); 754 DBG(" <- early_init_devtree()\n");
755} 755}
756 756
757
758/**
759 * Indicates whether the root node has a given value in its
760 * compatible property.
761 */
762int machine_is_compatible(const char *compat)
763{
764 struct device_node *root;
765 int rc = 0;
766
767 root = of_find_node_by_path("/");
768 if (root) {
769 rc = of_device_is_compatible(root, compat);
770 of_node_put(root);
771 }
772 return rc;
773}
774EXPORT_SYMBOL(machine_is_compatible);
775
776/******* 757/*******
777 * 758 *
778 * New implementation of the OF "find" APIs, return a refcounted 759 * New implementation of the OF "find" APIs, return a refcounted
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,
144EXPORT_SYMBOL(of_device_is_compatible); 144EXPORT_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 */
153int 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}
165EXPORT_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