Skip to content

Commit

Permalink
of: merge machine_is_compatible()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Grant Likely committed Jan 28, 2010
1 parent 86e0322 commit 1f43cfb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 37 deletions.
18 changes: 0 additions & 18 deletions arch/microblaze/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,6 @@ void __init early_init_devtree(void *params)
pr_debug(" <- early_init_devtree()\n");
}

/**
* Indicates whether the root node has a given value in its
* compatible property.
*/
int machine_is_compatible(const char *compat)
{
struct device_node *root;
int rc = 0;

root = of_find_node_by_path("/");
if (root) {
rc = of_device_is_compatible(root, compat);
of_node_put(root);
}
return rc;
}
EXPORT_SYMBOL(machine_is_compatible);

/*******
*
* New implementation of the OF "find" APIs, return a refcounted
Expand Down
19 changes: 0 additions & 19 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,25 +754,6 @@ void __init early_init_devtree(void *params)
DBG(" <- early_init_devtree()\n");
}


/**
* Indicates whether the root node has a given value in its
* compatible property.
*/
int machine_is_compatible(const char *compat)
{
struct device_node *root;
int rc = 0;

root = of_find_node_by_path("/");
if (root) {
rc = of_device_is_compatible(root, compat);
of_node_put(root);
}
return rc;
}
EXPORT_SYMBOL(machine_is_compatible);

/*******
*
* New implementation of the OF "find" APIs, return a refcounted
Expand Down
21 changes: 21 additions & 0 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,27 @@ int of_device_is_compatible(const struct device_node *device,
}
EXPORT_SYMBOL(of_device_is_compatible);

/**
* machine_is_compatible - Test root of device tree for a given compatible value
* @compat: compatible string to look for in root node's compatible property.
*
* Returns true if the root node has the given value in its
* compatible property.
*/
int machine_is_compatible(const char *compat)
{
struct device_node *root;
int rc = 0;

root = of_find_node_by_path("/");
if (root) {
rc = of_device_is_compatible(root, compat);
of_node_put(root);
}
return rc;
}
EXPORT_SYMBOL(machine_is_compatible);

/**
* of_device_is_available - check if a device is available for use
*
Expand Down

0 comments on commit 1f43cfb

Please sign in to comment.