brmcfmac: fix compile when DEBUG is defined
PATCH v2 1/1 brmcfmac: fix compile when DEBUG is defined
The steps:
1. add "#define DEBUG" in drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c line 61.
2. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=../Out_Linux bcm2835_defconfig
3. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=../Out_Linux/ zImage modules dtbs -j8
Then, it will fail, the compile log described below:
Kernel: arch/arm/boot/zImage is ready
MODPOST Module.symvers
ERROR: modpost: "brcmf_debugfs_add_entry" [drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined!
ERROR: modpost: "brcmf_debugfs_get_devdir" [drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined!
ERROR: modpost: "__brcmf_dbg" [drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined! scripts/Makefile.modpost:111: recipe for target 'Module.symvers' failed
make[2]: *** [Module.symvers] Error 1
make[2]: *** Deleting file 'Module.symvers'
Makefile:1390: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/home/hby/gitee/linux_origin/Out_Linux'
Makefile:185: recipe for target '__sub-make' failed
make: *** [__sub-make] Error 2
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +2 -2
@@ -60,7 +60,7 @@ void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...); ##__VA_ARGS__); \ } while (0) -#if defined(DEBUG ) || defined(CONFIG_BRCM_TRACING ) +#if defined(CONFIG_BRCM_TRACING ) || defined(CONFIG_BRCMDBG )/* For debug/tracing purposes treat info messages as errors */ #define brcmf_info brcmf_err
@@ -114,7 +114,7 @@ extern int brcmf_msg_level;struct brcmf_bus ;struct brcmf_pub ; -#ifdef DEBUG +#if defined(CONFIG_BRCMDBG )struct dentry *brcmf_debugfs_get_devdir (struct brcmf_pub *drvr);void brcmf_debugfs_add_entry (struct brcmf_pub *drvr,const char *fn,int (*read_fn)(struct seq_file *seq,void *data));
Signature · 1 line
2.17.1
Quoted 21 lines · hby
The steps:
1. add "#define DEBUG" indrivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.cline 61.
2. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=../Out_Linuxbcm2835_defconfig
3. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=../Out_Linux/ zImage modules dtbs -j8Then, it will fail, the compile log described below:
Kernel:
arch/arm/boot/zImageis ready
MODPOST Module.symvers
ERROR: modpost: "brcmf_debugfs_add_entry" [drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined!
ERROR: modpost: "brcmf_debugfs_get_devdir" [drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined!
ERROR: modpost: "__brcmf_dbg" [drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined!scripts/Makefile.modpost:111: recipe for target 'Module.symvers' failed
make[2]: *** [Module.symvers] Error 1
make[2]: *** Deleting file 'Module.symvers'
Makefile:1390: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/home/hby/gitee/linux_origin/Out_Linux'
Makefile:185: recipe for target '__sub-make' failed
make: *** [__sub-make] Error 2
Quoted 1 line
Signed-off-by hby <[email protected]>
I checked and brcmd80211/Makefile has:
subdir-ccflags-$(CONFIG_BRCMDBG) += -DDEBUG
I don't understand why brcm80211 uses DEBUG flag like that, but I guess there's a reason. I think that either _all_ DEBUG uses should be removed from the driver, or you shouldn't add "#define DEBUG" on your own to any of the files. So this patch is not the best solution.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches