Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Grant Likely <grant.likely@secretlab.ca>

+5 -15
+5 -12
drivers/of/platform.c
··· 212 212 /** 213 213 * of_platform_bus_create() - Create a device for a node and its children. 214 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 216 * disallow recursive creation of child buses 217 217 * @parent: parent for new device, or NULL for top level. 218 218 * ··· 245 245 /** 246 246 * of_platform_bus_probe() - Probe the device-tree for platform buses 247 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 249 * @parent: parent to hook devices from, NULL for toplevel 250 250 * 251 251 * Note that children of the provided root are not instantiated as devices ··· 258 258 struct device_node *child; 259 259 int rc = 0; 260 260 261 - if (WARN_ON(!matches || matches == OF_NO_DEEP_PROBE)) 262 - return -EINVAL; 263 - if (root == NULL) 264 - root = of_find_node_by_path("/"); 265 - else 266 - of_node_get(root); 267 - if (root == NULL) 261 + root = root ? of_node_get(root) : of_find_node_by_path("/"); 262 + if (!root) 268 263 return -EINVAL; 269 264 270 265 pr_debug("of_platform_bus_probe()\n"); 271 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 274 - * children 275 - */ 268 + /* Do a self check of bus type, if there's a match, create children */ 276 269 if (of_match_node(matches, root)) { 277 270 rc = of_platform_bus_create(root, matches, parent); 278 271 } else for_each_child_of_node(root, child) {
-3
include/linux/of_platform.h
··· 52 52 const char *bus_id, 53 53 struct device *parent); 54 54 55 - /* pseudo "matches" value to not do deep probe */ 56 - #define OF_NO_DEEP_PROBE ((struct of_device_id *)-1) 57 - 58 55 extern int of_platform_bus_probe(struct device_node *root, 59 56 const struct of_device_id *matches, 60 57 struct device *parent);