imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Frank Li <Frank.Li@nxp.com>
To: Vinod Koul <vkoul@kernel.org>,
	dmaengine@vger.kernel.org (open list:DMA GENERIC OFFLOAD ENGINE
	SUBSYSTEM), linux-kernel@vger.kernel.org (open list),
	imx@lists.linux.dev (open list:FREESCALE eDMA DRIVER)
Subject: [PATCH 1/1] dmaengine: fsl-edma: merge mcf-edma into fsl-edma driver
Date: Thu,  9 May 2024 15:35:16 -0400	[thread overview]
Message-ID: <20240509193517.3571694-1-Frank.Li@nxp.com> (raw)

MCF eDMA are almost the same as FSL eDMA driver. Previously link to two
kernel modules, fsl-edma.ko and mcf-edma.ko. These are not problem because
mcf-edma is for m68k ARCH and FSL eDMA is for arm/arm64 ARCH. But often
build both at PPC ARCH. It also makes sense to build two drivers at the
same time. It causes many build warning because share a fsl-edma-common.o.
such as:

   powerpc64le-linux-ld: warning: orphan section `.stubs' from `drivers/dma/fsl-edma-common.o' being placed in section `.stubs'
   powerpc64le-linux-ld: warning: orphan section `.stubs' from `drivers/dma/fsl-edma-trace.o' being placed in section `.stubs'

Merge mcf-edma into fsl-edma driver. So use one driver (fsl-edma.ko) for
MCF and FSL eDMA.

mcf-edma.ko should be replaced by fsl-edma.ko in modules, minimizing user
space impact because MCF eDMA remains confined to legacy ColdFire mcf5441x
production and mcf5441x has been in production for at least a decade and
NXP has long ceased ColdFire development.

Update Kconfig to make MCF_EDMA as feature of FSL_EDMA and change Makefile
to link mcl-edma-main.o to fsl-edma.o.

Create a common module init/exit functions, which call original's
fsl-edma-init[exit]() and mcf-edma-init[exit]().

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405082029.Es9umH7n-lkp@intel.com/
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/Kconfig           |  8 ++++----
 drivers/dma/Makefile          |  5 ++---
 drivers/dma/fsl-edma-common.c | 28 ++++++++++++++++++++++++++++
 drivers/dma/fsl-edma-common.h |  5 +++++
 drivers/dma/fsl-edma-main.c   |  6 ++----
 drivers/dma/mcf-edma-main.c   |  6 ++----
 6 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 002a5ec806207..45110520f6e68 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -393,14 +393,14 @@ config LS2X_APB_DMA
 	  It does not support memory to memory data transfer.
 
 config MCF_EDMA
-	tristate "Freescale eDMA engine support, ColdFire mcf5441x SoCs"
+	bool "Freescale eDMA engine support, ColdFire mcf5441x SoCs"
 	depends on M5441x || COMPILE_TEST
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	help
-	  Support the Freescale ColdFire eDMA engine, 64-channel
-	  implementation that performs complex data transfers with
-	  minimal intervention from a host processor.
+	  Support the Freescale ColdFire eDMA engine in FSL_EDMA driver,
+	  64-channel implementation that performs complex data transfers
+	  with minimal intervention from a host processor.
 	  This module can be found on Freescale ColdFire mcf5441x SoCs.
 
 config MILBEAUT_HDMAC
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index 802ca916f05f5..0000922c7cbfe 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -33,11 +33,10 @@ obj-$(CONFIG_DW_EDMA) += dw-edma/
 obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o
 fsl-edma-trace-$(CONFIG_TRACING) := fsl-edma-trace.o
 CFLAGS_fsl-edma-trace.o := -I$(src)
+mcf-edma-main-$(CONFIG_MCF_EDMA) := mcf-edma-main.o
 obj-$(CONFIG_FSL_DMA) += fsldma.o
-fsl-edma-objs := fsl-edma-main.o fsl-edma-common.o ${fsl-edma-trace-y}
+fsl-edma-objs := fsl-edma-main.o fsl-edma-common.o ${fsl-edma-trace-y} ${mcf-edma-main-y}
 obj-$(CONFIG_FSL_EDMA) += fsl-edma.o
-mcf-edma-objs := mcf-edma-main.o fsl-edma-common.o ${fsl-edma-trace-y}
-obj-$(CONFIG_MCF_EDMA) += mcf-edma.o
 obj-$(CONFIG_FSL_QDMA) += fsl-qdma.o
 obj-$(CONFIG_FSL_RAID) += fsl_raid.o
 obj-$(CONFIG_HISI_DMA) += hisi_dma.o
diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 3af4307873157..ac04a2ce4fa1f 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -888,4 +888,32 @@ void fsl_edma_setup_regs(struct fsl_edma_engine *edma)
 	}
 }
 
+static int __init fsl_edma_common_init(void)
+{
+	int ret;
+
+	ret = fsl_edma_init();
+	if (ret)
+		return ret;
+
+#ifdef CONFIG_MCF_EDMA
+	ret = mcf_edma_init();
+	if (ret)
+		return ret;
+#endif
+	return 0;
+}
+
+subsys_initcall(fsl_edma_common_init);
+
+static void __exit fsl_edma_common_exit(void)
+{
+	fsl_edma_exit();
+
+#ifdef CONFIG_MCF_EDMA
+	mcf_edma_exit();
+#endif
+}
+module_exit(fsl_edma_common_exit);
+
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h
index ac66222c16040..dfbdcc922ceea 100644
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -488,4 +488,9 @@ void fsl_edma_free_chan_resources(struct dma_chan *chan);
 void fsl_edma_cleanup_vchan(struct dma_device *dmadev);
 void fsl_edma_setup_regs(struct fsl_edma_engine *edma);
 
+int __init fsl_edma_init(void);
+void __exit fsl_edma_exit(void);
+int __init mcf_edma_init(void);
+void __exit mcf_edma_exit(void);
+
 #endif /* _FSL_EDMA_COMMON_H_ */
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 391e4f13dfeb0..a1c3c4ed869c5 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -724,17 +724,15 @@ static struct platform_driver fsl_edma_driver = {
 	.remove_new	= fsl_edma_remove,
 };
 
-static int __init fsl_edma_init(void)
+int __init fsl_edma_init(void)
 {
 	return platform_driver_register(&fsl_edma_driver);
 }
-subsys_initcall(fsl_edma_init);
 
-static void __exit fsl_edma_exit(void)
+void __exit fsl_edma_exit(void)
 {
 	platform_driver_unregister(&fsl_edma_driver);
 }
-module_exit(fsl_edma_exit);
 
 MODULE_ALIAS("platform:fsl-edma");
 MODULE_DESCRIPTION("Freescale eDMA engine driver");
diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
index 78c606f6d0026..d97991a1e9518 100644
--- a/drivers/dma/mcf-edma-main.c
+++ b/drivers/dma/mcf-edma-main.c
@@ -284,17 +284,15 @@ bool mcf_edma_filter_fn(struct dma_chan *chan, void *param)
 }
 EXPORT_SYMBOL(mcf_edma_filter_fn);
 
-static int __init mcf_edma_init(void)
+int __init mcf_edma_init(void)
 {
 	return platform_driver_register(&mcf_edma_driver);
 }
-subsys_initcall(mcf_edma_init);
 
-static void __exit mcf_edma_exit(void)
+void __exit mcf_edma_exit(void)
 {
 	platform_driver_unregister(&mcf_edma_driver);
 }
-module_exit(mcf_edma_exit);
 
 MODULE_ALIAS("platform:mcf-edma");
 MODULE_DESCRIPTION("Freescale eDMA engine driver, ColdFire family");
-- 
2.34.1


             reply	other threads:[~2024-05-09 19:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 19:35 Frank Li [this message]
2024-05-13 18:12 ` [PATCH 1/1] dmaengine: fsl-edma: merge mcf-edma into fsl-edma driver Geert Uytterhoeven
2024-05-14  7:57   ` Angelo Dureghello
2024-05-14 16:16     ` Frank Li
2024-05-15  8:17       ` Angelo Dureghello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240509193517.3571694-1-Frank.Li@nxp.com \
    --to=frank.li@nxp.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).