Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ks8851: fix link error

An object file cannot be built for both loadable module and built-in
use at the same time:

arm-linux-gnueabi-ld: drivers/net/ethernet/micrel/ks8851_common.o: in function `ks8851_probe_common':
ks8851_common.c:(.text+0xf80): undefined reference to `__this_module'

Change the ks8851_common code to be a standalone module instead,
and use Makefile logic to ensure this is built-in if at least one
of its two users is.

Fixes: 797047f875b5 ("net: ks8851: Implement Parallel bus operations")
Link: https://lore.kernel.org/netdev/20210125121937.3900988-1-arnd@kernel.org/
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
51bb08dd 3b1b6e82

+10 -4
+2 -4
drivers/net/ethernet/micrel/Makefile
··· 4 4 # 5 5 6 6 obj-$(CONFIG_KS8842) += ks8842.o 7 - obj-$(CONFIG_KS8851) += ks8851.o 8 - ks8851-objs = ks8851_common.o ks8851_spi.o 9 - obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o 10 - ks8851_mll-objs = ks8851_common.o ks8851_par.o 7 + obj-$(CONFIG_KS8851) += ks8851_common.o ks8851_spi.o 8 + obj-$(CONFIG_KS8851_MLL) += ks8851_common.o ks8851_par.o 11 9 obj-$(CONFIG_KSZ884X_PCI) += ksz884x.o
+8
drivers/net/ethernet/micrel/ks8851_common.c
··· 1057 1057 1058 1058 return 0; 1059 1059 } 1060 + EXPORT_SYMBOL_GPL(ks8851_suspend); 1060 1061 1061 1062 int ks8851_resume(struct device *dev) 1062 1063 { ··· 1071 1070 1072 1071 return 0; 1073 1072 } 1073 + EXPORT_SYMBOL_GPL(ks8851_resume); 1074 1074 #endif 1075 1075 1076 1076 static int ks8851_register_mdiobus(struct ks8851_net *ks, struct device *dev) ··· 1245 1243 err_reg_io: 1246 1244 return ret; 1247 1245 } 1246 + EXPORT_SYMBOL_GPL(ks8851_probe_common); 1248 1247 1249 1248 int ks8851_remove_common(struct device *dev) 1250 1249 { ··· 1264 1261 1265 1262 return 0; 1266 1263 } 1264 + EXPORT_SYMBOL_GPL(ks8851_remove_common); 1265 + 1266 + MODULE_DESCRIPTION("KS8851 Network driver"); 1267 + MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 1268 + MODULE_LICENSE("GPL");