platform.c (9d066a252786e1a18484a6283f82614d42a9f4ac) | platform.c (44a7185c2ae6383c88ff5b1ef2e2969f35d7b8b7) |
---|---|
1/* 2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. 3 * <benh@kernel.crashing.org> 4 * and Arnd Bergmann, IBM Corp. 5 * Merged from powerpc/kernel/of_platform.c and 6 * sparc{,64}/kernel/of_device.c by Stephen Rothwell 7 * 8 * This program is free software; you can redistribute it and/or --- 349 unchanged lines hidden (view full) --- 358 359 /* Make sure it has a compatible property */ 360 if (strict && (!of_get_property(bus, "compatible", NULL))) { 361 pr_debug("%s() - skipping %s, no compatible prop\n", 362 __func__, bus->full_name); 363 return 0; 364 } 365 | 1/* 2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. 3 * <benh@kernel.crashing.org> 4 * and Arnd Bergmann, IBM Corp. 5 * Merged from powerpc/kernel/of_platform.c and 6 * sparc{,64}/kernel/of_device.c by Stephen Rothwell 7 * 8 * This program is free software; you can redistribute it and/or --- 349 unchanged lines hidden (view full) --- 358 359 /* Make sure it has a compatible property */ 360 if (strict && (!of_get_property(bus, "compatible", NULL))) { 361 pr_debug("%s() - skipping %s, no compatible prop\n", 362 __func__, bus->full_name); 363 return 0; 364 } 365 |
366 if (of_node_check_flag(bus, OF_POPULATED_BUS)) { 367 pr_debug("%s() - skipping %s, already populated\n", 368 __func__, bus->full_name); 369 return 0; 370 } 371 |
|
366 auxdata = of_dev_lookup(lookup, bus); 367 if (auxdata) { 368 bus_id = auxdata->name; 369 platform_data = auxdata->platform_data; 370 } 371 372 if (of_device_is_compatible(bus, "arm,primecell")) { 373 /* --- 35 unchanged lines hidden (view full) --- 409{ 410 struct device_node *child; 411 int rc = 0; 412 413 root = root ? of_node_get(root) : of_find_node_by_path("/"); 414 if (!root) 415 return -EINVAL; 416 | 372 auxdata = of_dev_lookup(lookup, bus); 373 if (auxdata) { 374 bus_id = auxdata->name; 375 platform_data = auxdata->platform_data; 376 } 377 378 if (of_device_is_compatible(bus, "arm,primecell")) { 379 /* --- 35 unchanged lines hidden (view full) --- 415{ 416 struct device_node *child; 417 int rc = 0; 418 419 root = root ? of_node_get(root) : of_find_node_by_path("/"); 420 if (!root) 421 return -EINVAL; 422 |
417 pr_debug("of_platform_bus_probe()\n"); | 423 pr_debug("%s()\n", __func__); |
418 pr_debug(" starting at: %s\n", root->full_name); 419 420 /* Do a self check of bus type, if there's a match, create children */ 421 if (of_match_node(matches, root)) { 422 rc = of_platform_bus_create(root, matches, NULL, parent, false); 423 } else for_each_child_of_node(root, child) { 424 if (!of_match_node(matches, child)) 425 continue; --- 35 unchanged lines hidden (view full) --- 461{ 462 struct device_node *child; 463 int rc = 0; 464 465 root = root ? of_node_get(root) : of_find_node_by_path("/"); 466 if (!root) 467 return -EINVAL; 468 | 424 pr_debug(" starting at: %s\n", root->full_name); 425 426 /* Do a self check of bus type, if there's a match, create children */ 427 if (of_match_node(matches, root)) { 428 rc = of_platform_bus_create(root, matches, NULL, parent, false); 429 } else for_each_child_of_node(root, child) { 430 if (!of_match_node(matches, child)) 431 continue; --- 35 unchanged lines hidden (view full) --- 467{ 468 struct device_node *child; 469 int rc = 0; 470 471 root = root ? of_node_get(root) : of_find_node_by_path("/"); 472 if (!root) 473 return -EINVAL; 474 |
475 pr_debug("%s()\n", __func__); 476 pr_debug(" starting at: %s\n", root->full_name); 477 |
|
469 for_each_child_of_node(root, child) { 470 rc = of_platform_bus_create(child, matches, lookup, parent, true); 471 if (rc) { 472 of_node_put(child); 473 break; 474 } 475 } 476 of_node_set_flag(root, OF_POPULATED_BUS); --- 7 unchanged lines hidden (view full) --- 484 const struct of_dev_auxdata *lookup, 485 struct device *parent) 486{ 487 return of_platform_populate(root, of_default_bus_match_table, lookup, 488 parent); 489} 490EXPORT_SYMBOL_GPL(of_platform_default_populate); 491 | 478 for_each_child_of_node(root, child) { 479 rc = of_platform_bus_create(child, matches, lookup, parent, true); 480 if (rc) { 481 of_node_put(child); 482 break; 483 } 484 } 485 of_node_set_flag(root, OF_POPULATED_BUS); --- 7 unchanged lines hidden (view full) --- 493 const struct of_dev_auxdata *lookup, 494 struct device *parent) 495{ 496 return of_platform_populate(root, of_default_bus_match_table, lookup, 497 parent); 498} 499EXPORT_SYMBOL_GPL(of_platform_default_populate); 500 |
501static int __init of_platform_default_populate_init(void) 502{ 503 if (of_have_populated_dt()) 504 of_platform_default_populate(NULL, NULL, NULL); 505 506 return 0; 507} 508arch_initcall_sync(of_platform_default_populate_init); 509 |
|
492static int of_platform_device_destroy(struct device *dev, void *data) 493{ 494 /* Do not touch devices not populated from the device tree */ 495 if (!dev->of_node || !of_node_check_flag(dev->of_node, OF_POPULATED)) 496 return 0; 497 498 /* Recurse for any nodes that were treated as busses */ 499 if (of_node_check_flag(dev->of_node, OF_POPULATED_BUS)) --- 101 unchanged lines hidden --- | 510static int of_platform_device_destroy(struct device *dev, void *data) 511{ 512 /* Do not touch devices not populated from the device tree */ 513 if (!dev->of_node || !of_node_check_flag(dev->of_node, OF_POPULATED)) 514 return 0; 515 516 /* Recurse for any nodes that were treated as busses */ 517 if (of_node_check_flag(dev->of_node, OF_POPULATED_BUS)) --- 101 unchanged lines hidden --- |