aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/platform.c')
-rw-r--r--drivers/of/platform.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index f489e36af892..63d3cb73bdb9 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -212,7 +212,7 @@ EXPORT_SYMBOL(of_platform_device_create);
212/** 212/**
213 * of_platform_bus_create() - Create a device for a node and its children. 213 * of_platform_bus_create() - Create a device for a node and its children.
214 * @bus: device node of the bus to instantiate 214 * @bus: device node of the bus to instantiate
215 * @matches: match table, NULL to use the default, OF_NO_DEEP_PROBE to 215 * @matches: match table for bus nodes
216 * disallow recursive creation of child buses 216 * disallow recursive creation of child buses
217 * @parent: parent for new device, or NULL for top level. 217 * @parent: parent for new device, or NULL for top level.
218 * 218 *
@@ -245,7 +245,7 @@ static int of_platform_bus_create(struct device_node *bus,
245/** 245/**
246 * of_platform_bus_probe() - Probe the device-tree for platform buses 246 * of_platform_bus_probe() - Probe the device-tree for platform buses
247 * @root: parent of the first level to probe or NULL for the root of the tree 247 * @root: parent of the first level to probe or NULL for the root of the tree
248 * @matches: match table, NULL to use the default 248 * @matches: match table for bus nodes
249 * @parent: parent to hook devices from, NULL for toplevel 249 * @parent: parent to hook devices from, NULL for toplevel
250 * 250 *
251 * Note that children of the provided root are not instantiated as devices 251 * 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 struct device_node *child; 258 struct device_node *child;
259 int rc = 0; 259 int rc = 0;
260 260
261 if (WARN_ON(!matches || matches == OF_NO_DEEP_PROBE)) 261 root = root ? of_node_get(root) : of_find_node_by_path("/");
262 return -EINVAL; 262 if (!root)
263 if (root == NULL)
264 root = of_find_node_by_path("/");
265 else
266 of_node_get(root);
267 if (root == NULL)
268 return -EINVAL; 263 return -EINVAL;
269 264
270 pr_debug("of_platform_bus_probe()\n"); 265 pr_debug("of_platform_bus_probe()\n");
271 pr_debug(" starting at: %s\n", root->full_name); 266 pr_debug(" starting at: %s\n", root->full_name);
272 267
273 /* Do a self check of bus type, if there's a match, create 268 /* Do a self check of bus type, if there's a match, create children */
274 * children
275 */
276 if (of_match_node(matches, root)) { 269 if (of_match_node(matches, root)) {
277 rc = of_platform_bus_create(root, matches, parent); 270 rc = of_platform_bus_create(root, matches, parent);
278 } else for_each_child_of_node(root, child) { 271 } else for_each_child_of_node(root, child) {