提交 1eed4c07 编写于 作者: G Grant Likely

dt: eliminate OF_NO_DEEP_PROBE and test for NULL match table

There are no users of OF_NO_DEEP_PROBE, and of_match_node() now
gracefully handles being passed a NULL pointer, so the checks at the
top of of_platform_bus_probe can be dropped.

While at it, consolidate the root node pointer check to be easier to
read and tidy up related comments.
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
上级 a52f07ec
...@@ -212,7 +212,7 @@ EXPORT_SYMBOL(of_platform_device_create); ...@@ -212,7 +212,7 @@ EXPORT_SYMBOL(of_platform_device_create);
/** /**
* of_platform_bus_create() - Create a device for a node and its children. * of_platform_bus_create() - Create a device for a node and its children.
* @bus: device node of the bus to instantiate * @bus: device node of the bus to instantiate
* @matches: match table, NULL to use the default, OF_NO_DEEP_PROBE to * @matches: match table for bus nodes
* disallow recursive creation of child buses * disallow recursive creation of child buses
* @parent: parent for new device, or NULL for top level. * @parent: parent for new device, or NULL for top level.
* *
...@@ -245,7 +245,7 @@ static int of_platform_bus_create(struct device_node *bus, ...@@ -245,7 +245,7 @@ static int of_platform_bus_create(struct device_node *bus,
/** /**
* of_platform_bus_probe() - Probe the device-tree for platform buses * of_platform_bus_probe() - Probe the device-tree for platform buses
* @root: parent of the first level to probe or NULL for the root of the tree * @root: parent of the first level to probe or NULL for the root of the tree
* @matches: match table, NULL to use the default * @matches: match table for bus nodes
* @parent: parent to hook devices from, NULL for toplevel * @parent: parent to hook devices from, NULL for toplevel
* *
* Note that children of the provided root are not instantiated as devices * Note that children of the provided root are not instantiated as devices
...@@ -258,21 +258,14 @@ int of_platform_bus_probe(struct device_node *root, ...@@ -258,21 +258,14 @@ int of_platform_bus_probe(struct device_node *root,
struct device_node *child; struct device_node *child;
int rc = 0; int rc = 0;
if (WARN_ON(!matches || matches == OF_NO_DEEP_PROBE)) root = root ? of_node_get(root) : of_find_node_by_path("/");
return -EINVAL; if (!root)
if (root == NULL)
root = of_find_node_by_path("/");
else
of_node_get(root);
if (root == NULL)
return -EINVAL; return -EINVAL;
pr_debug("of_platform_bus_probe()\n"); pr_debug("of_platform_bus_probe()\n");
pr_debug(" starting at: %s\n", root->full_name); pr_debug(" starting at: %s\n", root->full_name);
/* Do a self check of bus type, if there's a match, create /* Do a self check of bus type, if there's a match, create children */
* children
*/
if (of_match_node(matches, root)) { if (of_match_node(matches, root)) {
rc = of_platform_bus_create(root, matches, parent); rc = of_platform_bus_create(root, matches, parent);
} else for_each_child_of_node(root, child) { } else for_each_child_of_node(root, child) {
......
...@@ -52,9 +52,6 @@ extern struct platform_device *of_platform_device_create(struct device_node *np, ...@@ -52,9 +52,6 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
const char *bus_id, const char *bus_id,
struct device *parent); struct device *parent);
/* pseudo "matches" value to not do deep probe */
#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
extern int of_platform_bus_probe(struct device_node *root, extern int of_platform_bus_probe(struct device_node *root,
const struct of_device_id *matches, const struct of_device_id *matches,
struct device *parent); struct device *parent);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册