dma: edma: move device registration to platform code

The horrible split between the low-level part of the edma support
and the dmaengine front-end driver causes problems on multiplatform
kernels. This is an attempt to improve the situation slightly
by only registering the dmaengine devices that are actually
present.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[olof: add missing include of linux/dma-mapping.h]
Signed-off-by: Olof Johansson <olof@lixom.net>

Signed-off-by: Olof Johansson <olof@lixom.net>

authored by Arnd Bergmann and committed by Olof Johansson 5305e4d6 ab699bc7

Changed files
+10 -39
arch
arm
common
drivers
dma
+9
arch/arm/common/edma.c
··· 26 26 #include <linux/io.h> 27 27 #include <linux/slab.h> 28 28 #include <linux/edma.h> 29 + #include <linux/dma-mapping.h> 29 30 #include <linux/of_address.h> 30 31 #include <linux/of_device.h> 31 32 #include <linux/of_dma.h> ··· 1624 1623 struct device_node *node = pdev->dev.of_node; 1625 1624 struct device *dev = &pdev->dev; 1626 1625 int ret; 1626 + struct platform_device_info edma_dev_info = { 1627 + .name = "edma-dma-engine", 1628 + .dma_mask = DMA_BIT_MASK(32), 1629 + .parent = &pdev->dev, 1630 + }; 1627 1631 1628 1632 if (node) { 1629 1633 /* Check if this is a second instance registered */ ··· 1799 1793 edma_write_array(j, EDMA_QRAE, i, 0x0); 1800 1794 } 1801 1795 arch_num_cc++; 1796 + 1797 + edma_dev_info.id = j; 1798 + platform_device_register_full(&edma_dev_info); 1802 1799 } 1803 1800 1804 1801 return 0;
+1 -39
drivers/dma/edma.c
··· 1107 1107 } 1108 1108 EXPORT_SYMBOL(edma_filter_fn); 1109 1109 1110 - static struct platform_device *pdev0, *pdev1; 1111 - 1112 - static const struct platform_device_info edma_dev_info0 = { 1113 - .name = "edma-dma-engine", 1114 - .id = 0, 1115 - .dma_mask = DMA_BIT_MASK(32), 1116 - }; 1117 - 1118 - static const struct platform_device_info edma_dev_info1 = { 1119 - .name = "edma-dma-engine", 1120 - .id = 1, 1121 - .dma_mask = DMA_BIT_MASK(32), 1122 - }; 1123 - 1124 1110 static int edma_init(void) 1125 1111 { 1126 - int ret = platform_driver_register(&edma_driver); 1127 - 1128 - if (ret == 0) { 1129 - pdev0 = platform_device_register_full(&edma_dev_info0); 1130 - if (IS_ERR(pdev0)) { 1131 - platform_driver_unregister(&edma_driver); 1132 - ret = PTR_ERR(pdev0); 1133 - goto out; 1134 - } 1135 - } 1136 - 1137 - if (!of_have_populated_dt() && EDMA_CTLRS == 2) { 1138 - pdev1 = platform_device_register_full(&edma_dev_info1); 1139 - if (IS_ERR(pdev1)) { 1140 - platform_driver_unregister(&edma_driver); 1141 - platform_device_unregister(pdev0); 1142 - ret = PTR_ERR(pdev1); 1143 - } 1144 - } 1145 - 1146 - out: 1147 - return ret; 1112 + return platform_driver_register(&edma_driver); 1148 1113 } 1149 1114 subsys_initcall(edma_init); 1150 1115 1151 1116 static void __exit edma_exit(void) 1152 1117 { 1153 - platform_device_unregister(pdev0); 1154 - if (pdev1) 1155 - platform_device_unregister(pdev1); 1156 1118 platform_driver_unregister(&edma_driver); 1157 1119 } 1158 1120 module_exit(edma_exit);