* [PATCH 1/6] drivers/dma: make edma.c explicitly non-modular
2015-12-09 23:21 [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Paul Gortmaker
@ 2015-12-09 23:21 ` Paul Gortmaker
2015-12-09 23:21 ` [PATCH 2/6] drivers/dma: make mmp_pdma.c " Paul Gortmaker
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Paul Gortmaker @ 2015-12-09 23:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Gortmaker, Vinod Koul, Dan Williams, dmaengine
The Kconfig currently controlling compilation of this code is:
drivers/dma/Kconfig:config TI_EDMA
drivers/dma/Kconfig: bool "TI EDMA support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.
Since module_init wasn't being used by this driver, we've not any
issues worrying about the init ordering changing with this commit.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/dma/edma.c | 37 ++++++-------------------------------
1 file changed, 6 insertions(+), 31 deletions(-)
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 0675e268d577..1031a970b523 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -3,6 +3,8 @@
*
* Copyright 2012 Texas Instruments
*
+ * Author: Matt Porter <matt.porter@linaro.org>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
@@ -20,7 +22,6 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/list.h>
-#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -2325,21 +2326,6 @@ err_reg1:
return ret;
}
-static int edma_remove(struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
- struct edma_cc *ecc = dev_get_drvdata(dev);
-
- if (dev->of_node)
- of_dma_controller_free(dev->of_node);
- dma_async_device_unregister(&ecc->dma_slave);
- if (ecc->dma_memcpy)
- dma_async_device_unregister(ecc->dma_memcpy);
- edma_free_slot(ecc, ecc->dummy_slot);
-
- return 0;
-}
-
#ifdef CONFIG_PM_SLEEP
static int edma_pm_suspend(struct device *dev)
{
@@ -2396,11 +2382,11 @@ static const struct dev_pm_ops edma_pm_ops = {
static struct platform_driver edma_driver = {
.probe = edma_probe,
- .remove = edma_remove,
.driver = {
- .name = "edma",
- .pm = &edma_pm_ops,
- .of_match_table = edma_of_ids,
+ .name = "edma",
+ .pm = &edma_pm_ops,
+ .of_match_table = edma_of_ids,
+ .suppress_bind_attrs = true,
},
};
@@ -2439,14 +2425,3 @@ static int edma_init(void)
return platform_driver_register(&edma_driver);
}
subsys_initcall(edma_init);
-
-static void __exit edma_exit(void)
-{
- platform_driver_unregister(&edma_driver);
- platform_driver_unregister(&edma_tptc_driver);
-}
-module_exit(edma_exit);
-
-MODULE_AUTHOR("Matt Porter <matt.porter@linaro.org>");
-MODULE_DESCRIPTION("TI EDMA DMA engine driver");
-MODULE_LICENSE("GPL v2");
--
2.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 2/6] drivers/dma: make mmp_pdma.c explicitly non-modular
2015-12-09 23:21 [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Paul Gortmaker
2015-12-09 23:21 ` [PATCH 1/6] drivers/dma: make edma.c explicitly non-modular Paul Gortmaker
@ 2015-12-09 23:21 ` Paul Gortmaker
2015-12-09 23:21 ` [PATCH 3/6] drivers/dma: make mmp_tdma.c " Paul Gortmaker
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Paul Gortmaker @ 2015-12-09 23:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Gortmaker, Vinod Koul, Dan Williams, dmaengine
The Kconfig currently controlling compilation of this code is:
drivers/dma/Kconfig:config MMP_PDMA
drivers/dma/Kconfig: bool "MMP PDMA support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.
Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/dma/mmp_pdma.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index e39457f13d4d..d41b74b6e852 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -1,5 +1,7 @@
/*
+ * MARVELL MMP Peripheral DMA Driver
* Copyright 2012 Marvell International Ltd.
+ * Author: Marvell International Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -7,7 +9,6 @@
*/
#include <linux/err.h>
-#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/interrupt.h>
@@ -929,14 +930,6 @@ static void dma_do_tasklet(unsigned long data)
}
}
-static int mmp_pdma_remove(struct platform_device *op)
-{
- struct mmp_pdma_device *pdev = platform_get_drvdata(op);
-
- dma_async_device_unregister(&pdev->device);
- return 0;
-}
-
static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev, int idx, int irq)
{
struct mmp_pdma_phy *phy = &pdev->phy[idx];
@@ -976,7 +969,6 @@ static const struct of_device_id mmp_pdma_dt_ids[] = {
{ .compatible = "marvell,pdma-1.0", },
{}
};
-MODULE_DEVICE_TABLE(of, mmp_pdma_dt_ids);
static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma)
@@ -1110,12 +1102,13 @@ static const struct platform_device_id mmp_pdma_id_table[] = {
static struct platform_driver mmp_pdma_driver = {
.driver = {
.name = "mmp-pdma",
+ .suppress_bind_attrs = true,
.of_match_table = mmp_pdma_dt_ids,
},
.id_table = mmp_pdma_id_table,
.probe = mmp_pdma_probe,
- .remove = mmp_pdma_remove,
};
+builtin_platform_driver(mmp_pdma_driver);
bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param)
{
@@ -1129,9 +1122,3 @@ bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param)
return true;
}
EXPORT_SYMBOL_GPL(mmp_pdma_filter_fn);
-
-module_platform_driver(mmp_pdma_driver);
-
-MODULE_DESCRIPTION("MARVELL MMP Peripheral DMA Driver");
-MODULE_AUTHOR("Marvell International Ltd.");
-MODULE_LICENSE("GPL v2");
--
2.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 3/6] drivers/dma: make mmp_tdma.c explicitly non-modular
2015-12-09 23:21 [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Paul Gortmaker
2015-12-09 23:21 ` [PATCH 1/6] drivers/dma: make edma.c explicitly non-modular Paul Gortmaker
2015-12-09 23:21 ` [PATCH 2/6] drivers/dma: make mmp_pdma.c " Paul Gortmaker
@ 2015-12-09 23:21 ` Paul Gortmaker
2015-12-09 23:22 ` [PATCH 4/6] drivers/dma: make pxa_dma.c " Paul Gortmaker
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Paul Gortmaker @ 2015-12-09 23:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Gortmaker, Vinod Koul, Dan Williams, dmaengine
The Kconfig currently controlling compilation of this code is:
drivers/dma/Kconfig:config MMP_TDMA
drivers/dma/Kconfig: bool "MMP Two-Channel DMA support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.
Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/dma/mmp_tdma.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index 3df0422607d5..e231a0e79562 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -1,6 +1,7 @@
/*
* Driver For Marvell Two-channel DMA Engine
*
+ * Authors: Leo Yan <leoy@marvell.com> Zhangfei Gao <zhangfei.gao@marvell.com>
* Copyright: Marvell International Ltd.
*
* The code contained herein is licensed under the GNU General Public
@@ -10,7 +11,6 @@
*/
#include <linux/err.h>
-#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/interrupt.h>
@@ -530,14 +530,6 @@ static void mmp_tdma_issue_pending(struct dma_chan *chan)
mmp_tdma_enable_chan(tdmac);
}
-static int mmp_tdma_remove(struct platform_device *pdev)
-{
- struct mmp_tdma_device *tdev = platform_get_drvdata(pdev);
-
- dma_async_device_unregister(&tdev->device);
- return 0;
-}
-
static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev,
int idx, int irq,
int type, struct gen_pool *pool)
@@ -617,7 +609,6 @@ static const struct of_device_id mmp_tdma_dt_ids[] = {
{ .compatible = "marvell,pxa910-squ", .data = (void *)PXA910_SQU},
{}
};
-MODULE_DEVICE_TABLE(of, mmp_tdma_dt_ids);
static int mmp_tdma_probe(struct platform_device *pdev)
{
@@ -728,17 +719,10 @@ static const struct platform_device_id mmp_tdma_id_table[] = {
static struct platform_driver mmp_tdma_driver = {
.driver = {
.name = "mmp-tdma",
+ .suppress_bind_attrs = true,
.of_match_table = mmp_tdma_dt_ids,
},
.id_table = mmp_tdma_id_table,
.probe = mmp_tdma_probe,
- .remove = mmp_tdma_remove,
};
-
-module_platform_driver(mmp_tdma_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("MMP Two-Channel DMA Driver");
-MODULE_ALIAS("platform:mmp-tdma");
-MODULE_AUTHOR("Leo Yan <leoy@marvell.com>");
-MODULE_AUTHOR("Zhangfei Gao <zhangfei.gao@marvell.com>");
+builtin_platform_driver(mmp_tdma_driver);
--
2.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 4/6] drivers/dma: make pxa_dma.c explicitly non-modular
2015-12-09 23:21 [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Paul Gortmaker
` (2 preceding siblings ...)
2015-12-09 23:21 ` [PATCH 3/6] drivers/dma: make mmp_tdma.c " Paul Gortmaker
@ 2015-12-09 23:22 ` Paul Gortmaker
2015-12-09 23:22 ` [PATCH 5/6] drivers/dma: make sh/shdma-*.c " Paul Gortmaker
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Paul Gortmaker @ 2015-12-09 23:22 UTC (permalink / raw)
To: linux-kernel
Cc: Paul Gortmaker, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
Dan Williams, Vinod Koul, linux-arm-kernel, dmaengine
The Kconfig currently controlling compilation of this code is:
drivers/dma/Kconfig:config PXA_DMA
drivers/dma/Kconfig: bool "PXA DMA support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.
Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: dmaengine@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/dma/pxa_dma.c | 38 +++-----------------------------------
1 file changed, 3 insertions(+), 35 deletions(-)
diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c
index f2a0310ae771..5d6ab9ff2222 100644
--- a/drivers/dma/pxa_dma.c
+++ b/drivers/dma/pxa_dma.c
@@ -1,4 +1,5 @@
/*
+ * Marvell PXA Peripheral DMA Driver
* Copyright 2015 Robert Jarzmik <robert.jarzmik@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -7,7 +8,6 @@
*/
#include <linux/err.h>
-#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/interrupt.h>
@@ -400,13 +400,8 @@ err_root:
pr_err("pxad: debugfs is not available\n");
}
-static void pxad_cleanup_debugfs(struct pxad_device *pdev)
-{
- debugfs_remove_recursive(pdev->dbgfs_root);
-}
#else
static inline void pxad_init_debugfs(struct pxad_device *pdev) {}
-static inline void pxad_cleanup_debugfs(struct pxad_device *pdev) {}
#endif
/*
@@ -1246,27 +1241,6 @@ static enum dma_status pxad_tx_status(struct dma_chan *dchan,
return ret;
}
-static void pxad_free_channels(struct dma_device *dmadev)
-{
- struct pxad_chan *c, *cn;
-
- list_for_each_entry_safe(c, cn, &dmadev->channels,
- vc.chan.device_node) {
- list_del(&c->vc.chan.device_node);
- tasklet_kill(&c->vc.task);
- }
-}
-
-static int pxad_remove(struct platform_device *op)
-{
- struct pxad_device *pdev = platform_get_drvdata(op);
-
- pxad_cleanup_debugfs(pdev);
- pxad_free_channels(&pdev->slave);
- dma_async_device_unregister(&pdev->slave);
- return 0;
-}
-
static int pxad_init_phys(struct platform_device *op,
struct pxad_device *pdev,
unsigned int nb_phy_chans)
@@ -1315,7 +1289,6 @@ static const struct of_device_id const pxad_dt_ids[] = {
{ .compatible = "marvell,pdma-1.0", },
{}
};
-MODULE_DEVICE_TABLE(of, pxad_dt_ids);
static struct dma_chan *pxad_dma_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma)
@@ -1448,12 +1421,13 @@ static const struct platform_device_id pxad_id_table[] = {
static struct platform_driver pxad_driver = {
.driver = {
.name = "pxa-dma",
+ .suppress_bind_attrs = true,
.of_match_table = pxad_dt_ids,
},
.id_table = pxad_id_table,
.probe = pxad_probe,
- .remove = pxad_remove,
};
+builtin_platform_driver(pxad_driver);
bool pxad_filter_fn(struct dma_chan *chan, void *param)
{
@@ -1478,9 +1452,3 @@ int pxad_toggle_reserved_channel(int legacy_channel)
return 0;
}
EXPORT_SYMBOL_GPL(pxad_toggle_reserved_channel);
-
-module_platform_driver(pxad_driver);
-
-MODULE_DESCRIPTION("Marvell PXA Peripheral DMA Driver");
-MODULE_AUTHOR("Robert Jarzmik <robert.jarzmik@free.fr>");
-MODULE_LICENSE("GPL v2");
--
2.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5/6] drivers/dma: make sh/shdma-*.c explicitly non-modular
2015-12-09 23:21 [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Paul Gortmaker
` (3 preceding siblings ...)
2015-12-09 23:22 ` [PATCH 4/6] drivers/dma: make pxa_dma.c " Paul Gortmaker
@ 2015-12-09 23:22 ` Paul Gortmaker
2015-12-10 9:46 ` Geert Uytterhoeven
2015-12-09 23:22 ` [PATCH 6/6] drivers/dma: make tegra20-apb-dma.c " Paul Gortmaker
2015-12-09 23:29 ` [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Arnd Bergmann
6 siblings, 1 reply; 12+ messages in thread
From: Paul Gortmaker @ 2015-12-09 23:22 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Gortmaker, Vinod Koul, Dan Williams, dmaengine
The Kconfig currently controlling compilation of these files is:
config SH_DMAE_BASE
bool "Renesas SuperH DMA Engine support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
In one file, we explicitly disallow a driver unbind, since that
doesn't have a sensible use case anyway, and there was not a
".remove" code assigned in the struct for it either.
Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.
Similarly builtin_platform_driver and module_platform_driver use
device_initcall, so the init ordering remains unchanged there too.
In one file, We replace module.h with moduleparam.h since the file does
have one module_param already.
We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/dma/sh/shdma-base.c | 14 ++------------
drivers/dma/sh/shdma-of.c | 11 +++--------
2 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 10fcabad80f3..69097a860fc8 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -18,7 +18,7 @@
#include <linux/dmaengine.h>
#include <linux/init.h>
#include <linux/interrupt.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -1051,14 +1051,4 @@ static int __init shdma_enter(void)
return -ENOMEM;
return 0;
}
-module_init(shdma_enter);
-
-static void __exit shdma_exit(void)
-{
- kfree(shdma_slave_used);
-}
-module_exit(shdma_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("SH-DMA driver base library");
-MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>");
+device_initcall(shdma_enter);
diff --git a/drivers/dma/sh/shdma-of.c b/drivers/dma/sh/shdma-of.c
index f999f9b0d314..888bd8761333 100644
--- a/drivers/dma/sh/shdma-of.c
+++ b/drivers/dma/sh/shdma-of.c
@@ -10,7 +10,7 @@
*/
#include <linux/dmaengine.h>
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_dma.h>
#include <linux/of_platform.h>
@@ -62,18 +62,13 @@ static const struct of_device_id shdma_of_match[] = {
{ .compatible = "renesas,shdma-mux", },
{ }
};
-MODULE_DEVICE_TABLE(of, sh_dmae_of_match);
static struct platform_driver shdma_of = {
.driver = {
.name = "shdma-of",
+ .suppress_bind_attrs = true,
.of_match_table = shdma_of_match,
},
.probe = shdma_of_probe,
};
-
-module_platform_driver(shdma_of);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("SH-DMA driver DT glue");
-MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>");
+builtin_platform_driver(shdma_of);
--
2.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 5/6] drivers/dma: make sh/shdma-*.c explicitly non-modular
2015-12-09 23:22 ` [PATCH 5/6] drivers/dma: make sh/shdma-*.c " Paul Gortmaker
@ 2015-12-10 9:46 ` Geert Uytterhoeven
0 siblings, 0 replies; 12+ messages in thread
From: Geert Uytterhoeven @ 2015-12-10 9:46 UTC (permalink / raw)
To: Paul Gortmaker
Cc: linux-kernel@vger.kernel.org, Vinod Koul, Dan Williams, dmaengine
CC linux-sh
On Thu, Dec 10, 2015 at 12:22 AM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> The Kconfig currently controlling compilation of these files is:
>
> config SH_DMAE_BASE
> bool "Renesas SuperH DMA Engine support"
>
> ...meaning that it currently is not being built as a module by anyone.
>
> Lets remove the modular code that is essentially orphaned, so that
> when reading the driver there is no doubt it is builtin-only.
>
> In one file, we explicitly disallow a driver unbind, since that
> doesn't have a sensible use case anyway, and there was not a
> ".remove" code assigned in the struct for it either.
>
> Since module_init translates to device_initcall in the non-modular
> case, the init ordering remains unchanged with this commit.
>
> Similarly builtin_platform_driver and module_platform_driver use
> device_initcall, so the init ordering remains unchanged there too.
>
> In one file, We replace module.h with moduleparam.h since the file does
> have one module_param already.
>
> We also delete the MODULE_LICENSE tag etc. since all that information
> is already contained at the top of the file in the comments.
>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: dmaengine@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
> drivers/dma/sh/shdma-base.c | 14 ++------------
> drivers/dma/sh/shdma-of.c | 11 +++--------
> 2 files changed, 5 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
> index 10fcabad80f3..69097a860fc8 100644
> --- a/drivers/dma/sh/shdma-base.c
> +++ b/drivers/dma/sh/shdma-base.c
> @@ -18,7 +18,7 @@
> #include <linux/dmaengine.h>
> #include <linux/init.h>
> #include <linux/interrupt.h>
> -#include <linux/module.h>
> +#include <linux/moduleparam.h>
> #include <linux/pm_runtime.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> @@ -1051,14 +1051,4 @@ static int __init shdma_enter(void)
> return -ENOMEM;
> return 0;
> }
> -module_init(shdma_enter);
> -
> -static void __exit shdma_exit(void)
> -{
> - kfree(shdma_slave_used);
> -}
> -module_exit(shdma_exit);
> -
> -MODULE_LICENSE("GPL v2");
> -MODULE_DESCRIPTION("SH-DMA driver base library");
> -MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>");
> +device_initcall(shdma_enter);
> diff --git a/drivers/dma/sh/shdma-of.c b/drivers/dma/sh/shdma-of.c
> index f999f9b0d314..888bd8761333 100644
> --- a/drivers/dma/sh/shdma-of.c
> +++ b/drivers/dma/sh/shdma-of.c
> @@ -10,7 +10,7 @@
> */
>
> #include <linux/dmaengine.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
> #include <linux/of.h>
> #include <linux/of_dma.h>
> #include <linux/of_platform.h>
> @@ -62,18 +62,13 @@ static const struct of_device_id shdma_of_match[] = {
> { .compatible = "renesas,shdma-mux", },
> { }
> };
> -MODULE_DEVICE_TABLE(of, sh_dmae_of_match);
>
> static struct platform_driver shdma_of = {
> .driver = {
> .name = "shdma-of",
> + .suppress_bind_attrs = true,
> .of_match_table = shdma_of_match,
> },
> .probe = shdma_of_probe,
> };
> -
> -module_platform_driver(shdma_of);
> -
> -MODULE_LICENSE("GPL v2");
> -MODULE_DESCRIPTION("SH-DMA driver DT glue");
> -MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@gmx.de>");
> +builtin_platform_driver(shdma_of);
> --
> 2.6.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/6] drivers/dma: make tegra20-apb-dma.c explicitly non-modular
2015-12-09 23:21 [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Paul Gortmaker
` (4 preceding siblings ...)
2015-12-09 23:22 ` [PATCH 5/6] drivers/dma: make sh/shdma-*.c " Paul Gortmaker
@ 2015-12-09 23:22 ` Paul Gortmaker
2015-12-09 23:29 ` [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Arnd Bergmann
6 siblings, 0 replies; 12+ messages in thread
From: Paul Gortmaker @ 2015-12-09 23:22 UTC (permalink / raw)
To: linux-kernel
Cc: Paul Gortmaker, Laxman Dewangan, Dan Williams, Vinod Koul,
Stephen Warren, Thierry Reding, Alexandre Courbot, dmaengine,
linux-tegra
The Kconfig currently controlling compilation of this code is:
drivers/dma/Kconfig:config TEGRA20_APB_DMA
drivers/dma/Kconfig: bool "NVIDIA Tegra20 APB DMA support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.
Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
We don't replace module.h with init.h since the file already has that.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: dmaengine@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/dma/tegra20-apb-dma.c | 35 ++++-------------------------------
1 file changed, 4 insertions(+), 31 deletions(-)
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 935da8192f59..eee783cee45b 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -3,6 +3,8 @@
*
* Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
*
+ * Author: Laxman Dewangan <ldewangan@nvidia.com>
+ *
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
@@ -26,7 +28,6 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mm.h>
-#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_dma.h>
@@ -1309,7 +1310,6 @@ static const struct of_device_id tegra_dma_of_match[] = {
}, {
},
};
-MODULE_DEVICE_TABLE(of, tegra_dma_of_match);
static int tegra_dma_probe(struct platform_device *pdev)
{
@@ -1488,27 +1488,6 @@ err_irq:
return ret;
}
-static int tegra_dma_remove(struct platform_device *pdev)
-{
- struct tegra_dma *tdma = platform_get_drvdata(pdev);
- int i;
- struct tegra_dma_channel *tdc;
-
- dma_async_device_unregister(&tdma->dma_dev);
-
- for (i = 0; i < tdma->chip_data->nr_channels; ++i) {
- tdc = &tdma->channels[i];
- free_irq(tdc->irq, tdc);
- tasklet_kill(&tdc->tasklet);
- }
-
- pm_runtime_disable(&pdev->dev);
- if (!pm_runtime_status_suspended(&pdev->dev))
- tegra_dma_runtime_suspend(&pdev->dev);
-
- return 0;
-}
-
static int tegra_dma_runtime_suspend(struct device *dev)
{
struct tegra_dma *tdma = dev_get_drvdata(dev);
@@ -1616,15 +1595,9 @@ static struct platform_driver tegra_dmac_driver = {
.driver = {
.name = "tegra-apbdma",
.pm = &tegra_dma_dev_pm_ops,
+ .suppress_bind_attrs = true,
.of_match_table = tegra_dma_of_match,
},
.probe = tegra_dma_probe,
- .remove = tegra_dma_remove,
};
-
-module_platform_driver(tegra_dmac_driver);
-
-MODULE_ALIAS("platform:tegra20-apbdma");
-MODULE_DESCRIPTION("NVIDIA Tegra APB DMA Controller driver");
-MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(tegra_dmac_driver);
--
2.6.1
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 0/6] drivers/dma: drop modular code from non modular drivers
2015-12-09 23:21 [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Paul Gortmaker
` (5 preceding siblings ...)
2015-12-09 23:22 ` [PATCH 6/6] drivers/dma: make tegra20-apb-dma.c " Paul Gortmaker
@ 2015-12-09 23:29 ` Arnd Bergmann
2015-12-10 0:17 ` Paul Gortmaker
6 siblings, 1 reply; 12+ messages in thread
From: Arnd Bergmann @ 2015-12-09 23:29 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Paul Gortmaker, linux-kernel, Alexandre Courbot, linux-tegra,
Stephen Warren, Vinod Koul, Haojian Zhuang, Laxman Dewangan,
Thierry Reding, dmaengine, Dan Williams, Robert Jarzmik,
Daniel Mack
On Wednesday 09 December 2015 18:21:56 Paul Gortmaker wrote:
> This series of commits is a slice of a larger project to ensure
> people don't have dead code for module removal in non-modular
> drivers. Overall there is roughly 5k lines of dead code in the
> kernel due to this.
>
> There is a quasi-separate theme, in that some of the drivers were
> allowing an unbind implicitly since it is enabled by default. But
> for core DMA infrastructure drivers, this doesn't seem useful -- so
> we also disable that here which allows us to delete any ".remove"
> functions from the drivers that would otherwise be called during the
> (impossible to trigger) module removal.
>
> Since ARM covers these files the best of all architectures, each
> file was build tested for allmodconfig on ARM, which at the same
> time confirms that the files are not built with "CC [M]" -- hence
> genuinely non-modular.
>
> My testing and the larger patch series in general has been done
> against the latest linux-next tree.
>
>
We are in the process of changing the DMA drivers to a new way of
passing the "filter" function around. We can soon build them
all as loadable modules again.
Arnd
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 0/6] drivers/dma: drop modular code from non modular drivers
2015-12-09 23:29 ` [PATCH 0/6] drivers/dma: drop modular code from non modular drivers Arnd Bergmann
@ 2015-12-10 0:17 ` Paul Gortmaker
2015-12-10 3:12 ` Vinod Koul
2015-12-10 9:01 ` Arnd Bergmann
0 siblings, 2 replies; 12+ messages in thread
From: Paul Gortmaker @ 2015-12-10 0:17 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, linux-kernel, Alexandre Courbot, linux-tegra,
Stephen Warren, Vinod Koul, Haojian Zhuang, Laxman Dewangan,
Thierry Reding, dmaengine, Dan Williams, Robert Jarzmik,
Daniel Mack
[Re: [PATCH 0/6] drivers/dma: drop modular code from non modular drivers] On 10/12/2015 (Thu 00:29) Arnd Bergmann wrote:
> On Wednesday 09 December 2015 18:21:56 Paul Gortmaker wrote:
> > This series of commits is a slice of a larger project to ensure
> > people don't have dead code for module removal in non-modular
> > drivers. Overall there is roughly 5k lines of dead code in the
> > kernel due to this.
> >
> > There is a quasi-separate theme, in that some of the drivers were
> > allowing an unbind implicitly since it is enabled by default. But
> > for core DMA infrastructure drivers, this doesn't seem useful -- so
> > we also disable that here which allows us to delete any ".remove"
> > functions from the drivers that would otherwise be called during the
> > (impossible to trigger) module removal.
> >
> > Since ARM covers these files the best of all architectures, each
> > file was build tested for allmodconfig on ARM, which at the same
> > time confirms that the files are not built with "CC [M]" -- hence
> > genuinely non-modular.
> >
> > My testing and the larger patch series in general has been done
> > against the latest linux-next tree.
> >
> >
>
> We are in the process of changing the DMA drivers to a new way of
> passing the "filter" function around. We can soon build them
> all as loadable modules again.
Hi Arnd,
Thanks for the feedback -- just to clarify, you are suggesting I hold
on the series until I see what emerges in the next merge window?
Paul.
--
>
> Arnd
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/6] drivers/dma: drop modular code from non modular drivers
2015-12-10 0:17 ` Paul Gortmaker
@ 2015-12-10 3:12 ` Vinod Koul
2015-12-10 9:01 ` Arnd Bergmann
1 sibling, 0 replies; 12+ messages in thread
From: Vinod Koul @ 2015-12-10 3:12 UTC (permalink / raw)
To: Paul Gortmaker
Cc: Arnd Bergmann, linux-arm-kernel, linux-kernel, Alexandre Courbot,
linux-tegra, Stephen Warren, Haojian Zhuang, Laxman Dewangan,
Thierry Reding, dmaengine, Dan Williams, Robert Jarzmik,
Daniel Mack
On Wed, Dec 09, 2015 at 07:17:42PM -0500, Paul Gortmaker wrote:
> [Re: [PATCH 0/6] drivers/dma: drop modular code from non modular drivers] On 10/12/2015 (Thu 00:29) Arnd Bergmann wrote:
>
> > On Wednesday 09 December 2015 18:21:56 Paul Gortmaker wrote:
> > > This series of commits is a slice of a larger project to ensure
> > > people don't have dead code for module removal in non-modular
> > > drivers. Overall there is roughly 5k lines of dead code in the
> > > kernel due to this.
> > >
> > > There is a quasi-separate theme, in that some of the drivers were
> > > allowing an unbind implicitly since it is enabled by default. But
> > > for core DMA infrastructure drivers, this doesn't seem useful -- so
> > > we also disable that here which allows us to delete any ".remove"
> > > functions from the drivers that would otherwise be called during the
> > > (impossible to trigger) module removal.
> > >
> > > Since ARM covers these files the best of all architectures, each
> > > file was build tested for allmodconfig on ARM, which at the same
> > > time confirms that the files are not built with "CC [M]" -- hence
> > > genuinely non-modular.
> > >
> > > My testing and the larger patch series in general has been done
> > > against the latest linux-next tree.
> > >
> > >
> >
> > We are in the process of changing the DMA drivers to a new way of
> > passing the "filter" function around. We can soon build them
> > all as loadable modules again.
>
> Hi Arnd,
>
> Thanks for the feedback -- just to clarify, you are suggesting I hold
> on the series until I see what emerges in the next merge window?
Yes, with this we should be able to have loadable modules for *most* so we
may not require this
Thanks
--
~Vinod
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/6] drivers/dma: drop modular code from non modular drivers
2015-12-10 0:17 ` Paul Gortmaker
2015-12-10 3:12 ` Vinod Koul
@ 2015-12-10 9:01 ` Arnd Bergmann
1 sibling, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2015-12-10 9:01 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Paul Gortmaker, Alexandre Courbot, Stephen Warren, Vinod Koul,
linux-kernel, Haojian Zhuang, dmaengine, Laxman Dewangan,
Thierry Reding, Daniel Mack, linux-tegra, Dan Williams,
Robert Jarzmik
On Wednesday 09 December 2015 19:17:42 Paul Gortmaker wrote:
> [Re: [PATCH 0/6] drivers/dma: drop modular code from non modular drivers] On 10/12/2015 (Thu 00:29) Arnd Bergmann wrote:
>
> > On Wednesday 09 December 2015 18:21:56 Paul Gortmaker wrote:
> > > This series of commits is a slice of a larger project to ensure
> > > people don't have dead code for module removal in non-modular
> > > drivers. Overall there is roughly 5k lines of dead code in the
> > > kernel due to this.
> > >
> > > There is a quasi-separate theme, in that some of the drivers were
> > > allowing an unbind implicitly since it is enabled by default. But
> > > for core DMA infrastructure drivers, this doesn't seem useful -- so
> > > we also disable that here which allows us to delete any ".remove"
> > > functions from the drivers that would otherwise be called during the
> > > (impossible to trigger) module removal.
> > >
> > > Since ARM covers these files the best of all architectures, each
> > > file was build tested for allmodconfig on ARM, which at the same
> > > time confirms that the files are not built with "CC [M]" -- hence
> > > genuinely non-modular.
> > >
> > > My testing and the larger patch series in general has been done
> > > against the latest linux-next tree.
> > >
> > >
> >
> > We are in the process of changing the DMA drivers to a new way of
> > passing the "filter" function around. We can soon build them
> > all as loadable modules again.
>
> Hi Arnd,
>
> Thanks for the feedback -- just to clarify, you are suggesting I hold
> on the series until I see what emerges in the next merge window?
>
>
It may take a few cycles, but I think we'll get there and should not
remove the unload logic from any of these drivers. When we're done,
there is no reason for a dmaengine driver to be built-in.
Arnd
^ permalink raw reply [flat|nested] 12+ messages in thread