aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/of_device_64.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_64.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_64.c')
-rw-r--r--arch/sparc/kernel/of_device_64.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 5e8cbb942d3..9743d1d9fa0 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -667,7 +667,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
667 op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]); 667 op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]);
668 668
669 op->dev.parent = parent; 669 op->dev.parent = parent;
670 op->dev.bus = &of_platform_bus_type; 670 op->dev.bus = &platform_bus_type;
671 if (!parent) 671 if (!parent)
672 dev_set_name(&op->dev, "root"); 672 dev_set_name(&op->dev, "root");
673 else 673 else
@@ -695,30 +695,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
695 } 695 }
696} 696}
697 697
698static void __init scan_of_devices(void) 698static int __init scan_of_devices(void)
699{ 699{
700 struct device_node *root = of_find_node_by_path("/"); 700 struct device_node *root = of_find_node_by_path("/");
701 struct of_device *parent; 701 struct of_device *parent;
702 702
703 parent = scan_one_device(root, NULL); 703 parent = scan_one_device(root, NULL);
704 if (!parent) 704 if (!parent)
705 return; 705 return 0;
706 706
707 scan_tree(root->child, &parent->dev); 707 scan_tree(root->child, &parent->dev);
708 return 0;
708} 709}
709 710postcore_initcall(scan_of_devices);
710static int __init of_bus_driver_init(void)
711{
712 int err;
713
714 err = of_bus_type_init(&of_platform_bus_type, "of");
715 if (!err)
716 scan_of_devices();
717
718 return err;
719}
720
721postcore_initcall(of_bus_driver_init);
722 711
723static int __init of_debug(char *str) 712static int __init of_debug(char *str)
724{ 713{