diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-06-08 09:48:21 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-07-24 11:57:51 -0400 |
commit | eca3930163ba8884060ce9d9ff5ef0d9b7c7b00f (patch) | |
tree | 5774d6d53b5f7d8f069e82b3937cdff7b3d45bbe /arch | |
parent | 05212157e94ccf4cf458413bbba509cfa95ff92b (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')
-rw-r--r-- | arch/microblaze/kernel/of_platform.c | 11 | ||||
-rw-r--r-- | arch/microblaze/kernel/setup.c | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/dma-swiotlb.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/of_platform.c | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/beat_iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/iommu.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_dev.c | 7 | ||||
-rw-r--r-- | arch/sparc/kernel/of_device_32.c | 21 | ||||
-rw-r--r-- | arch/sparc/kernel/of_device_64.c | 21 | ||||
-rw-r--r-- | arch/sparc/kernel/of_device_common.c | 3 |
11 files changed, 13 insertions, 87 deletions
diff --git a/arch/microblaze/kernel/of_platform.c b/arch/microblaze/kernel/of_platform.c index da79edf45420..fb2866104331 100644 --- a/arch/microblaze/kernel/of_platform.c +++ b/arch/microblaze/kernel/of_platform.c | |||
@@ -26,17 +26,6 @@ | |||
26 | #include <linux/topology.h> | 26 | #include <linux/topology.h> |
27 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
28 | 28 | ||
29 | struct bus_type of_platform_bus_type = { | ||
30 | .uevent = of_device_uevent, | ||
31 | }; | ||
32 | EXPORT_SYMBOL(of_platform_bus_type); | ||
33 | |||
34 | static int __init of_bus_driver_init(void) | ||
35 | { | ||
36 | return of_bus_type_init(&of_platform_bus_type, "of_platform"); | ||
37 | } | ||
38 | postcore_initcall(of_bus_driver_init); | ||
39 | |||
40 | /* | 29 | /* |
41 | * The list of OF IDs below is used for matching bus types in the | 30 | * The list of OF IDs below is used for matching bus types in the |
42 | * system whose devices are to be exposed as of_platform_devices. | 31 | * system whose devices are to be exposed as of_platform_devices. |
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 17c98dbcec88..f5f768842354 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c | |||
@@ -213,15 +213,9 @@ static struct notifier_block dflt_plat_bus_notifier = { | |||
213 | .priority = INT_MAX, | 213 | .priority = INT_MAX, |
214 | }; | 214 | }; |
215 | 215 | ||
216 | static struct notifier_block dflt_of_bus_notifier = { | ||
217 | .notifier_call = dflt_bus_notify, | ||
218 | .priority = INT_MAX, | ||
219 | }; | ||
220 | |||
221 | static int __init setup_bus_notifier(void) | 216 | static int __init setup_bus_notifier(void) |
222 | { | 217 | { |
223 | bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier); | 218 | bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier); |
224 | bus_register_notifier(&of_platform_bus_type, &dflt_of_bus_notifier); | ||
225 | 219 | ||
226 | return 0; | 220 | return 0; |
227 | } | 221 | } |
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index 02f724f36753..4295e0b94b2d 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c | |||
@@ -82,17 +82,9 @@ static struct notifier_block ppc_swiotlb_plat_bus_notifier = { | |||
82 | .priority = 0, | 82 | .priority = 0, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct notifier_block ppc_swiotlb_of_bus_notifier = { | ||
86 | .notifier_call = ppc_swiotlb_bus_notify, | ||
87 | .priority = 0, | ||
88 | }; | ||
89 | |||
90 | int __init swiotlb_setup_bus_notifier(void) | 85 | int __init swiotlb_setup_bus_notifier(void) |
91 | { | 86 | { |
92 | bus_register_notifier(&platform_bus_type, | 87 | bus_register_notifier(&platform_bus_type, |
93 | &ppc_swiotlb_plat_bus_notifier); | 88 | &ppc_swiotlb_plat_bus_notifier); |
94 | bus_register_notifier(&of_platform_bus_type, | ||
95 | &ppc_swiotlb_of_bus_notifier); | ||
96 | |||
97 | return 0; | 89 | return 0; |
98 | } | 90 | } |
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index 4e0a2f7c1dd3..d3497cd81e8a 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c | |||
@@ -52,18 +52,6 @@ const struct of_device_id of_default_bus_ids[] = { | |||
52 | {}, | 52 | {}, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | struct bus_type of_platform_bus_type = { | ||
56 | .uevent = of_device_uevent, | ||
57 | }; | ||
58 | EXPORT_SYMBOL(of_platform_bus_type); | ||
59 | |||
60 | static int __init of_bus_driver_init(void) | ||
61 | { | ||
62 | return of_bus_type_init(&of_platform_bus_type, "of_platform"); | ||
63 | } | ||
64 | |||
65 | postcore_initcall(of_bus_driver_init); | ||
66 | |||
67 | static int of_dev_node_match(struct device *dev, void *data) | 55 | static int of_dev_node_match(struct device *dev, void *data) |
68 | { | 56 | { |
69 | return to_of_device(dev)->dev.of_node == data; | 57 | return to_of_device(dev)->dev.of_node == data; |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index b7e6c7e193ae..d1a5304b3ddd 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -701,16 +701,9 @@ static struct notifier_block ppc_dflt_plat_bus_notifier = { | |||
701 | .priority = INT_MAX, | 701 | .priority = INT_MAX, |
702 | }; | 702 | }; |
703 | 703 | ||
704 | static struct notifier_block ppc_dflt_of_bus_notifier = { | ||
705 | .notifier_call = ppc_dflt_bus_notify, | ||
706 | .priority = INT_MAX, | ||
707 | }; | ||
708 | |||
709 | static int __init setup_bus_notifier(void) | 704 | static int __init setup_bus_notifier(void) |
710 | { | 705 | { |
711 | bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier); | 706 | bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier); |
712 | bus_register_notifier(&of_platform_bus_type, &ppc_dflt_of_bus_notifier); | ||
713 | |||
714 | return 0; | 707 | return 0; |
715 | } | 708 | } |
716 | 709 | ||
diff --git a/arch/powerpc/platforms/cell/beat_iommu.c b/arch/powerpc/platforms/cell/beat_iommu.c index 39d361c5c6d2..beec405eb6f8 100644 --- a/arch/powerpc/platforms/cell/beat_iommu.c +++ b/arch/powerpc/platforms/cell/beat_iommu.c | |||
@@ -108,7 +108,7 @@ static int __init celleb_init_iommu(void) | |||
108 | celleb_init_direct_mapping(); | 108 | celleb_init_direct_mapping(); |
109 | set_pci_dma_ops(&dma_direct_ops); | 109 | set_pci_dma_ops(&dma_direct_ops); |
110 | ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup; | 110 | ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup; |
111 | bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); | 111 | bus_register_notifier(&platform_bus_type, &celleb_of_bus_notifier); |
112 | 112 | ||
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 3712900471ba..58b13ce3847e 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -1204,7 +1204,7 @@ static int __init cell_iommu_init(void) | |||
1204 | /* Register callbacks on OF platform device addition/removal | 1204 | /* Register callbacks on OF platform device addition/removal |
1205 | * to handle linking them to the right DMA operations | 1205 | * to handle linking them to the right DMA operations |
1206 | */ | 1206 | */ |
1207 | bus_register_notifier(&of_platform_bus_type, &cell_of_bus_notifier); | 1207 | bus_register_notifier(&platform_bus_type, &cell_of_bus_notifier); |
1208 | 1208 | ||
1209 | return 0; | 1209 | return 0; |
1210 | } | 1210 | } |
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index 31acd3b1718b..1398bc454999 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c | |||
@@ -20,12 +20,7 @@ | |||
20 | 20 | ||
21 | #include <asm/prom.h> | 21 | #include <asm/prom.h> |
22 | 22 | ||
23 | /* | 23 | /* These functions provide the necessary setup for the mv64x60 drivers. */ |
24 | * These functions provide the necessary setup for the mv64x60 drivers. | ||
25 | * These drivers are unusual in that they work on both the MIPS and PowerPC | ||
26 | * architectures. Because of that, the drivers do not support the normal | ||
27 | * PowerPC of_platform_bus_type. They support platform_bus_type instead. | ||
28 | */ | ||
29 | 24 | ||
30 | static struct of_device_id __initdata of_mv64x60_devices[] = { | 25 | static struct of_device_id __initdata of_mv64x60_devices[] = { |
31 | { .compatible = "marvell,mv64306-devctrl", }, | 26 | { .compatible = "marvell,mv64306-devctrl", }, |
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 | ||
455 | static void __init scan_of_devices(void) | 455 | static 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 | 467 | postcore_initcall(scan_of_devices); | |
467 | static 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 | |||
478 | postcore_initcall(of_bus_driver_init); | ||
479 | 468 | ||
480 | static int __init of_debug(char *str) | 469 | static int __init of_debug(char *str) |
481 | { | 470 | { |
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 5e8cbb942d3d..9743d1d9fa03 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 | ||
698 | static void __init scan_of_devices(void) | 698 | static 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 | 710 | postcore_initcall(scan_of_devices); | |
710 | static 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 | |||
721 | postcore_initcall(of_bus_driver_init); | ||
722 | 711 | ||
723 | static int __init of_debug(char *str) | 712 | static int __init of_debug(char *str) |
724 | { | 713 | { |
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c index 016c947d4cae..01f380c7995c 100644 --- a/arch/sparc/kernel/of_device_common.c +++ b/arch/sparc/kernel/of_device_common.c | |||
@@ -64,9 +64,6 @@ void of_propagate_archdata(struct of_device *bus) | |||
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | struct bus_type of_platform_bus_type; | ||
68 | EXPORT_SYMBOL(of_platform_bus_type); | ||
69 | |||
70 | static void get_cells(struct device_node *dp, int *addrc, int *sizec) | 67 | static void get_cells(struct device_node *dp, int *addrc, int *sizec) |
71 | { | 68 | { |
72 | if (addrc) | 69 | if (addrc) |