[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210115134239.126152-1-marex@denx.de>
Date: Fri, 15 Jan 2021 14:42:39 +0100
From: Marek Vasut <marex@...x.de>
To: netdev@...r.kernel.org
Cc: Marek Vasut <marex@...x.de>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Lukas Wunner <lukas@...ner.de>
Subject: [PATCH net-next] net: ks8851: Fix mixed module/builtin build
When either the SPI or PAR variant is compiled as module AND the other
variant is compiled as built-in, the following build error occurs:
arm-linux-gnueabi-ld: drivers/net/ethernet/micrel/ks8851_common.o: in function `ks8851_probe_common':
ks8851_common.c:(.text+0x1564): undefined reference to `__this_module'
Fix this by including the ks8851_common.c in both ks8851_spi.c and
ks8851_par.c. The DEBUG macro is defined in ks8851_common.c, so it
does not have to be defined again.
Signed-off-by: Marek Vasut <marex@...x.de>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Heiner Kallweit <hkallweit1@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Lukas Wunner <lukas@...ner.de>
---
NOTE: Maybe there is a better way?
---
drivers/net/ethernet/micrel/Makefile | 4 ++--
drivers/net/ethernet/micrel/ks8851_par.c | 2 +-
drivers/net/ethernet/micrel/ks8851_spi.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/micrel/Makefile b/drivers/net/ethernet/micrel/Makefile
index 5cc00d22c708..1aedfe0ecaf1 100644
--- a/drivers/net/ethernet/micrel/Makefile
+++ b/drivers/net/ethernet/micrel/Makefile
@@ -5,7 +5,7 @@
obj-$(CONFIG_KS8842) += ks8842.o
obj-$(CONFIG_KS8851) += ks8851.o
-ks8851-objs = ks8851_common.o ks8851_spi.o
+ks8851-objs = ks8851_spi.o
obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o
-ks8851_mll-objs = ks8851_common.o ks8851_par.o
+ks8851_mll-objs = ks8851_par.o
obj-$(CONFIG_KSZ884X_PCI) += ksz884x.o
diff --git a/drivers/net/ethernet/micrel/ks8851_par.c b/drivers/net/ethernet/micrel/ks8851_par.c
index 3bab0cb2b1a5..e9131cc8a57b 100644
--- a/drivers/net/ethernet/micrel/ks8851_par.c
+++ b/drivers/net/ethernet/micrel/ks8851_par.c
@@ -8,7 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-#define DEBUG
+#include "ks8851_common.c"
#include <linux/interrupt.h>
#include <linux/module.h>
diff --git a/drivers/net/ethernet/micrel/ks8851_spi.c b/drivers/net/ethernet/micrel/ks8851_spi.c
index 4ec7f1615977..53779d66f747 100644
--- a/drivers/net/ethernet/micrel/ks8851_spi.c
+++ b/drivers/net/ethernet/micrel/ks8851_spi.c
@@ -8,7 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-#define DEBUG
+#include "ks8851_common.c"
#include <linux/interrupt.h>
#include <linux/module.h>
--
2.29.2
Powered by blists - more mailing lists