aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/of_device_32.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-06-08 09:48:21 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-24 11:57:51 -0400
commiteca3930163ba8884060ce9d9ff5ef0d9b7c7b00f (patch)
tree5774d6d53b5f7d8f069e82b3937cdff7b3d45bbe /arch/sparc/kernel/of_device_32.c
parent05212157e94ccf4cf458413bbba509cfa95ff92b (diff)
of: Merge of_platform_bus_type with platform_bus_type
of_platform_bus was being used in the same manner as the platform_bus. The only difference being that of_platform_bus devices are generated from data in the device tree, and platform_bus devices are usually statically allocated in platform code. Having them separate causes the problem of device drivers having to be registered twice if it was possible for the same device to appear on either bus. This patch removes of_platform_bus_type and registers all of_platform bus devices and drivers on the platform bus instead. A previous patch made the of_device structure an alias for the platform_device structure, and a shim is used to adapt of_platform_drivers to the platform bus. After all of of_platform_bus drivers are converted to be normal platform drivers, the shim code can be removed. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/of_device_32.c')
-rw-r--r--arch/sparc/kernel/of_device_32.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 331de91ad2bc..75fc9d5cd7e6 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -424,7 +424,7 @@ build_resources:
424 build_device_resources(op, parent); 424 build_device_resources(op, parent);
425 425
426 op->dev.parent = parent; 426 op->dev.parent = parent;
427 op->dev.bus = &of_platform_bus_type; 427 op->dev.bus = &platform_bus_type;
428 if (!parent) 428 if (!parent)
429 dev_set_name(&op->dev, "root"); 429 dev_set_name(&op->dev, "root");
430 else 430 else
@@ -452,30 +452,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
452 } 452 }
453} 453}
454 454
455static void __init scan_of_devices(void) 455static int __init scan_of_devices(void)
456{ 456{
457 struct device_node *root = of_find_node_by_path("/"); 457 struct device_node *root = of_find_node_by_path("/");
458 struct of_device *parent; 458 struct of_device *parent;
459 459
460 parent = scan_one_device(root, NULL); 460 parent = scan_one_device(root, NULL);
461 if (!parent) 461 if (!parent)
462 return; 462 return 0;
463 463
464 scan_tree(root->child, &parent->dev); 464 scan_tree(root->child, &parent->dev);
465 return 0;
465} 466}
466 467postcore_initcall(scan_of_devices);
467static int __init of_bus_driver_init(void)
468{
469 int err;
470
471 err = of_bus_type_init(&of_platform_bus_type, "of");
472 if (!err)
473 scan_of_devices();
474
475 return err;
476}
477
478postcore_initcall(of_bus_driver_init);
479 468
480static int __init of_debug(char *str) 469static int __init of_debug(char *str)
481{ 470{