[PATCH] kernel: staging/mt7621-dma: fix build conflict

Ilya Lipnitskiy ilya.lipnitskiy at gmail.com
Sat Feb 6 15:20:00 EST 2021


While this change is not required for 5.4, it will help when we enable
kernel v5.10.

With Linux 5.10 this driver cannot be built because we have two modules
with the same name and it leads to an error:

  error: the following would cause module name conflict:
    drivers/dma/mediatek/mtk-hsdma.ko
    drivers/staging/mt7621-dma/mtk-hsdma.ko

The fix is to rename mtk-hsdma.c to hsdma-mt7621.c.  Also we can use the
KBUILD_MODNAME where appropriate instead of hard coding the name.

This patch has also been upstreamed.
Link: https://lore.kernel.org/driverdev-devel/YBky8lfQ1DmuKtRL@kroah.com/

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy at gmail.com>
---
 ...taging-mt7621-dma-fix-build-conflict.patch | 26 +++++++++++++++++++
 target/linux/ramips/modules.mk                |  4 +--
 2 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/generic/pending-5.4/113-staging-mt7621-dma-fix-build-conflict.patch

diff --git a/target/linux/generic/pending-5.4/113-staging-mt7621-dma-fix-build-conflict.patch b/target/linux/generic/pending-5.4/113-staging-mt7621-dma-fix-build-conflict.patch
new file mode 100644
index 0000000000..671d7e9901
--- /dev/null
+++ b/target/linux/generic/pending-5.4/113-staging-mt7621-dma-fix-build-conflict.patch
@@ -0,0 +1,26 @@
+diff --git a/drivers/staging/mt7621-dma/Makefile b/drivers/staging/mt7621-dma/Makefile
+index 66da1bf10c32..23256d1286f3 100644
+--- a/drivers/staging/mt7621-dma/Makefile
++++ b/drivers/staging/mt7621-dma/Makefile
+@@ -1,4 +1,4 @@
+ # SPDX-License-Identifier: GPL-2.0
+-obj-$(CONFIG_MTK_HSDMA) += mtk-hsdma.o
++obj-$(CONFIG_MTK_HSDMA) += hsdma-mt7621.o
+ 
+ ccflags-y += -I$(srctree)/drivers/dma
+diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c b/drivers/staging/mt7621-dma/hsdma-mt7621.c
+similarity index 99%
+rename from drivers/staging/mt7621-dma/mtk-hsdma.c
+rename to drivers/staging/mt7621-dma/hsdma-mt7621.c
+index bc4bb4374313..b0ed935de7ac 100644
+--- a/drivers/staging/mt7621-dma/mtk-hsdma.c
++++ b/drivers/staging/mt7621-dma/hsdma-mt7621.c
+@@ -749,7 +749,7 @@ static struct platform_driver mtk_hsdma_driver = {
+ 	.probe = mtk_hsdma_probe,
+ 	.remove = mtk_hsdma_remove,
+ 	.driver = {
+-		.name = "hsdma-mt7621",
++		.name = KBUILD_MODNAME,
+ 		.of_match_table = mtk_hsdma_of_match,
+ 	},
+ };
diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk
index ae5e6822de..e17306b690 100644
--- a/target/linux/ramips/modules.mk
+++ b/target/linux/ramips/modules.mk
@@ -104,8 +104,8 @@ define KernelPackage/hsdma-mtk
 	CONFIG_MTK_HSDMA
   FILES:= \
 	$(LINUX_DIR)/drivers/dma/virt-dma.ko \
-	$(LINUX_DIR)/drivers/staging/mt7621-dma/mtk-hsdma.ko
-  AUTOLOAD:=$(call AutoLoad,53,mtk-hsdma)
+	$(LINUX_DIR)/drivers/staging/mt7621-dma/hsdma-mt7621.ko
+  AUTOLOAD:=$(call AutoLoad,53,hsdma-mt7621)
 endef
 
 define KernelPackage/hsdma-mtk/description
-- 
2.30.0




More information about the openwrt-devel mailing list