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>
This commit is contained in:
parent
ab699bc792
commit
5305e4d674
|
@ -26,6 +26,7 @@
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/edma.h>
|
#include <linux/edma.h>
|
||||||
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/of_dma.h>
|
#include <linux/of_dma.h>
|
||||||
|
@ -1623,6 +1624,11 @@ static int edma_probe(struct platform_device *pdev)
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
struct platform_device_info edma_dev_info = {
|
||||||
|
.name = "edma-dma-engine",
|
||||||
|
.dma_mask = DMA_BIT_MASK(32),
|
||||||
|
.parent = &pdev->dev,
|
||||||
|
};
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
/* Check if this is a second instance registered */
|
/* Check if this is a second instance registered */
|
||||||
|
@ -1793,6 +1799,9 @@ static int edma_probe(struct platform_device *pdev)
|
||||||
edma_write_array(j, EDMA_QRAE, i, 0x0);
|
edma_write_array(j, EDMA_QRAE, i, 0x0);
|
||||||
}
|
}
|
||||||
arch_num_cc++;
|
arch_num_cc++;
|
||||||
|
|
||||||
|
edma_dev_info.id = j;
|
||||||
|
platform_device_register_full(&edma_dev_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1107,52 +1107,14 @@ bool edma_filter_fn(struct dma_chan *chan, void *param)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(edma_filter_fn);
|
EXPORT_SYMBOL(edma_filter_fn);
|
||||||
|
|
||||||
static struct platform_device *pdev0, *pdev1;
|
|
||||||
|
|
||||||
static const struct platform_device_info edma_dev_info0 = {
|
|
||||||
.name = "edma-dma-engine",
|
|
||||||
.id = 0,
|
|
||||||
.dma_mask = DMA_BIT_MASK(32),
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct platform_device_info edma_dev_info1 = {
|
|
||||||
.name = "edma-dma-engine",
|
|
||||||
.id = 1,
|
|
||||||
.dma_mask = DMA_BIT_MASK(32),
|
|
||||||
};
|
|
||||||
|
|
||||||
static int edma_init(void)
|
static int edma_init(void)
|
||||||
{
|
{
|
||||||
int ret = platform_driver_register(&edma_driver);
|
return platform_driver_register(&edma_driver);
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
pdev0 = platform_device_register_full(&edma_dev_info0);
|
|
||||||
if (IS_ERR(pdev0)) {
|
|
||||||
platform_driver_unregister(&edma_driver);
|
|
||||||
ret = PTR_ERR(pdev0);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!of_have_populated_dt() && EDMA_CTLRS == 2) {
|
|
||||||
pdev1 = platform_device_register_full(&edma_dev_info1);
|
|
||||||
if (IS_ERR(pdev1)) {
|
|
||||||
platform_driver_unregister(&edma_driver);
|
|
||||||
platform_device_unregister(pdev0);
|
|
||||||
ret = PTR_ERR(pdev1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
subsys_initcall(edma_init);
|
subsys_initcall(edma_init);
|
||||||
|
|
||||||
static void __exit edma_exit(void)
|
static void __exit edma_exit(void)
|
||||||
{
|
{
|
||||||
platform_device_unregister(pdev0);
|
|
||||||
if (pdev1)
|
|
||||||
platform_device_unregister(pdev1);
|
|
||||||
platform_driver_unregister(&edma_driver);
|
platform_driver_unregister(&edma_driver);
|
||||||
}
|
}
|
||||||
module_exit(edma_exit);
|
module_exit(edma_exit);
|
||||||
|
|
Loading…
Reference in a new issue