staging: wfx: fix an undefined reference error when CONFIG_MMC=m
PATCH 1/1 staging: wfx: fix an undefined reference error when CONFIG_MMC=m
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488: undefined reference to sdio_register_driver' drivers/staging/wfx/main.o: In function wfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496: undefined reference to sdio_unregister_driver' drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to sdio_register_driver' drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to `sdio_unregister_driver'
--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/wfx/Kconfig +2 -1
@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMC help This is a driver for Silicons Labs WFxxx series (WF200 and further) chipsets. This chip can be found on SPI or SDIO buses.
drivers/staging/wfx/Makefile +3 -2
@@ -17,8 +17,9 @@ wfx-y := \ key.o \ main.o \ sta.o \ - debug.o + debug.o \ + bus_sdio.o + wfx-$(CONFIG_SPI) += bus_spi.o -wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o obj-$(CONFIG_WFX) += wfx.o
Signature · 1 line
1.7.12.4
Greg KH
maintainerQuoted 20 lines · zhong jiang
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488: undefined reference tosdio_register_driver' drivers/staging/wfx/main.o: In functionwfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496: undefined reference tosdio_unregister_driver' drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference tosdio_register_driver' drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to `sdio_unregister_driver'Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0
drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMC
How about:
depends on (SPI && MMC)
instead?
thanks,
greg k-h
Quoted 28 lines · Greg KH
Quoted 20 lines · zhong jiang
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488: undefined reference tosdio_register_driver' drivers/staging/wfx/main.o: In functionwfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496: undefined reference tosdio_unregister_driver' drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference tosdio_register_driver' drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to `sdio_unregister_driver'Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMCHow about:
Quoted 3 lines
depends on (SPI && MMC)instead?
Yep, That is better. Will repost in v2. Thanks,
Sincerely,
zhong jiang
Quoted 6 lines
thanks,
greg k-h
.
Quoted 1 line · On Friday 11 October 2019 06:26:16 CEST Greg KH wrote:
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 7 lines · zhong jiang
Quoted 4 lines
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488:
undefined reference to `sdio_register_driver'
Quoted 2 lines
Quoted 2 lines
drivers/staging/wfx/main.o: In function `wfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496:
undefined reference to `sdio_unregister_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to
`sdio_register_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to
`sdio_unregister_driver'
Quoted 20 lines
Quoted 12 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMCHow about:
Quoted 1 line
depends on (SPI && MMC)
I dislike to force user to enable both buses while only one of them is sufficient. I would prefer to keep current dependencies and to add #ifdef around problematic functions.
(I though I had a test of compilation w/o MMC nor SPI, but I realize that it did not work)
Signature · 1 line
Jérôme Pouiller
Greg KH
maintainerQuoted 41 lines · Jerome Pouiller
Quoted 1 line · On Friday 11 October 2019 06:26:16 CEST Greg KH wrote:
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 7 lines · zhong jiang
Quoted 4 lines
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488:undefined reference to `sdio_register_driver'
Quoted 2 lines
Quoted 2 lines
drivers/staging/wfx/main.o: In function `wfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496:undefined reference to `sdio_unregister_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to
`sdio_register_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to
`sdio_unregister_driver'
Quoted 20 lines
Quoted 12 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMCHow about:
Quoted 1 line
depends on (SPI && MMC)
Quoted 3 lines
I dislike to force user to enable both buses while only one of them is sufficient. I would prefer to keep current dependencies and to add #ifdef around problematic functions.
Yes, that's the better thing to do here overall.
zhong, can you work on that?
thanks,
greg k-h
Quoted 38 lines · Greg KH
Quoted 37 lines · Jerome Pouiller
Quoted 1 line · On Friday 11 October 2019 06:26:16 CEST Greg KH wrote:
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 6 lines · zhong jiang
Quoted 4 lines
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488:undefined reference to `sdio_register_driver'
Quoted 2 lines
Quoted 2 lines
drivers/staging/wfx/main.o: In function `wfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496:undefined reference to `sdio_unregister_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to
`sdio_register_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to
`sdio_unregister_driver'
Quoted 19 lines
Quoted 11 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMCHow about:
depends on (SPI && MMC)
Quoted 6 lines
Quoted 3 lines
I dislike to force user to enable both buses while only one of them is sufficient. I would prefer to keep current dependencies and to add #ifdef around problematic functions.
Yes, that's the better thing to do here overall.
zhong, can you work on that?
I will repost as Jerome said. Thanks
Sincerely,
zhong jiang
Quoted 6 lines
thanks,
greg k-h
.
Quoted 38 lines · Greg KH
Quoted 37 lines · Jerome Pouiller
Quoted 1 line · On Friday 11 October 2019 06:26:16 CEST Greg KH wrote:
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 6 lines · zhong jiang
Quoted 4 lines
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488:undefined reference to `sdio_register_driver'
Quoted 2 lines
Quoted 2 lines
drivers/staging/wfx/main.o: In function `wfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496:undefined reference to `sdio_unregister_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to
`sdio_register_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to
`sdio_unregister_driver'
Quoted 19 lines
Quoted 11 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMCHow about:
depends on (SPI && MMC)
Quoted 6 lines
Quoted 3 lines
I dislike to force user to enable both buses while only one of them is sufficient. I would prefer to keep current dependencies and to add #ifdef around problematic functions.
Yes, that's the better thing to do here overall.
zhong, can you work on that?
How about the following patch ?
drivers/staging/wfx/Makefile +1 -1
@@ -19,6 +19,6 @@ wfx-y := \ sta.o \ debug.o wfx-$(CONFIG_SPI) += bus_spi.o -wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o +wfx-$(CONFIG_MMC) += bus_sdio.o obj-$(CONFIG_WFX) += wfx.o
drivers/staging/wfx/main.c +6 -3
@@ -484,16 +484,19 @@ static int __init wfx_core_init(void)if (IS_ENABLED (CONFIG_SPI )) ret =spi_register_driver (&wfx_spi_driver); -if (IS_ENABLED (CONFIG_MMC ) && !ret) +#ifdef CONFIG_MMC +if (!ret) ret =sdio_register_driver (&wfx_sdio_driver); +#endif return ret; }module_init (wfx_core_init); static void __exit wfx_core_exit(void) { -if (IS_ENABLED (CONFIG_MMC )) -sdio_unregister_driver (&wfx_sdio_driver); +#ifdef CONFIG_MMC +sdio_unregister_driver (&wfx_sdio_driver); +#endif if (IS_ENABLED (CONFIG_SPI ))spi_unregister_driver (&wfx_spi_driver); }
--
Thanks,
zhong jiang
Quoted 6 lines
thanks,
greg k-h
.
On Friday 11 October 2019 17:51:29 CEST zhong jiang wrote:
[...]
Quoted 31 lines
How about the following patch ?
drivers/staging/wfx/Makefile +1
-1@@ -19,6 +19,6 @@ wfx-y := \ sta.o \ debug.o wfx-$(CONFIG_SPI) += bus_spi.o -wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o +wfx-$(CONFIG_MMC) += bus_sdio.o obj-$(CONFIG_WFX) += wfx.odrivers/staging/wfx/main.c +3
-1@@ -484,16 +484,19 @@ static int __init wfx_core_init(void)if (IS_ENABLED (CONFIG_SPI )) ret =spi_register_driver (&wfx_spi_driver); -if (IS_ENABLED (CONFIG_MMC ) && !ret) +#ifdef CONFIG_MMC +if (!ret) ret =sdio_register_driver (&wfx_sdio_driver); +#endif return ret; }module_init (wfx_core_init);
drivers/staging/wfx/main.c static int __init wfx_core_init(void) · line 502
Quoted 10 lines
drivers/staging/wfx/main.c +3
-2static void __exit wfx_core_exit(void) { -if (IS_ENABLED (CONFIG_MMC )) -sdio_unregister_driver (&wfx_sdio_driver); +#ifdef CONFIG_MMC +sdio_unregister_driver (&wfx_sdio_driver); +#endif if (IS_ENABLED (CONFIG_SPI ))spi_unregister_driver (&wfx_spi_driver); }
Hello zhong,
Can you also check the case where CONFIG_SPI is not set?
Thank you,
Signature · 1 line
Jérôme Pouiller
Quoted 45 lines · Jerome Pouiller
On Friday 11 October 2019 17:51:29 CEST zhong jiang wrote:
[...]Quoted 31 lines
How about the following patch ?
drivers/staging/wfx/Makefile +1
-1@@ -19,6 +19,6 @@ wfx-y := \ sta.o \ debug.o wfx-$(CONFIG_SPI) += bus_spi.o -wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o +wfx-$(CONFIG_MMC) += bus_sdio.o obj-$(CONFIG_WFX) += wfx.odrivers/staging/wfx/main.c +3
-1@@ -484,16 +484,19 @@ static int __init wfx_core_init(void)if (IS_ENABLED (CONFIG_SPI )) ret =spi_register_driver (&wfx_spi_driver); -if (IS_ENABLED (CONFIG_MMC ) && !ret) +#ifdef CONFIG_MMC +if (!ret) ret =sdio_register_driver (&wfx_sdio_driver); +#endif return ret }module_init (wfx_core_init);drivers/staging/wfx/main.c static int __init wfx_core_init(void) · line 502
Quoted 10 lines
drivers/staging/wfx/main.c +3
-2static void __exit wfx_core_exit(void) { -if (IS_ENABLED (CONFIG_MMC )) -sdio_unregister_driver (&wfx_sdio_driver); +#ifdef CONFIG_MMC +sdio_unregister_driver (&wfx_sdio_driver); +#endif if (IS_ENABLED (CONFIG_SPI ))spi_unregister_driver (&wfx_spi_driver); }Hello zhong,
Quoted 1 line
Can you also check the case where
CONFIG_SPIis not set?
I have tested the case and it works well when CONFIG_SPI is not set.
Thanks,
zhong jiang
Quoted 2 lines
Thank you,
Greg KH
maintainerQuoted 64 lines · zhong jiang
Quoted 38 lines · Greg KH
Quoted 37 lines · Jerome Pouiller
Quoted 1 line · On Friday 11 October 2019 06:26:16 CEST Greg KH wrote:
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 6 lines · zhong jiang
Quoted 4 lines
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488:undefined reference to `sdio_register_driver'
Quoted 2 lines
Quoted 2 lines
drivers/staging/wfx/main.o: In function `wfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496:undefined reference to `sdio_unregister_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to
`sdio_register_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to
`sdio_unregister_driver'
Quoted 19 lines
Quoted 11 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMCHow about:
depends on (SPI && MMC)Quoted 6 lines
Quoted 3 lines
I dislike to force user to enable both buses while only one of them is sufficient. I would prefer to keep current dependencies and to add #ifdef around problematic functions.
Yes, that's the better thing to do here overall.
zhong, can you work on that?
How about the following patch ?
drivers/staging/wfx/Makefile +1
-1@@ -19,6 +19,6 @@ wfx-y := \ sta.o \ debug.o wfx-$(CONFIG_SPI) += bus_spi.o -wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o +wfx-$(CONFIG_MMC) += bus_sdio.o obj-$(CONFIG_WFX) += wfx.odrivers/staging/wfx/main.c +0
-0
drivers/staging/wfx/main.c static int __init wfx_core_init(void) · line 489
Quoted 7 lines
drivers/staging/wfx/main.c +2
-1@@ -484,16 +484,19 @@ static int __init wfx_core_init(void)if (IS_ENABLED (CONFIG_SPI )) ret =spi_register_driver (&wfx_spi_driver); -if (IS_ENABLED (CONFIG_MMC ) && !ret) +#ifdef CONFIG_MMC +if (!ret) ret =sdio_register_driver (&wfx_sdio_driver);
Put this in an inline function in the .h file so that you just call:
wfx_register_sdio_driver()
and it does what is needed to be done depending on if CONFIG_MMC is enabled or not (note, your check here isn't quite correct, I think you need to do IS_ENABLED())
Same for spi.
We really do not like #ifdefs in .c files.
thanks,
greg k-h
Quoted 77 lines · Greg KH
Quoted 63 lines · zhong jiang
Quoted 37 lines · Greg KH
Quoted 36 lines · Jerome Pouiller
Quoted 1 line · On Friday 11 October 2019 06:26:16 CEST Greg KH wrote:
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 5 lines · zhong jiang
Quoted 4 lines
I hit the following error when compile the kernel.
drivers/staging/wfx/main.o: In function `wfx_core_init':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:488:undefined reference to `sdio_register_driver'
Quoted 2 lines
Quoted 2 lines
drivers/staging/wfx/main.o: In function `wfx_core_exit':/home/z00352263/linux-next/linux-next/drivers/staging/wfx/main.c:496:undefined reference to `sdio_unregister_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x1a8): undefined reference to
`sdio_register_driver'
Quoted 1 line
Quoted 1 line
drivers/staging/wfx/main.o:(.debug_addr+0x6f0): undefined reference to
`sdio_unregister_driver'
Quoted 19 lines
Quoted 11 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/staging/wfx/Kconfig | 3 ++- drivers/staging/wfx/Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/staging/wfx/Kconfig +0
-0drivers/staging/wfx/Kconfig line 5
Quoted 6 lines
drivers/staging/wfx/Kconfig +2
-1@@ -1,7 +1,8 @@ config WFX tristate "Silicon Labs wireless chips WF200 and further" depends on MAC80211 - depends on (SPI || MMC) + depends on SPI + select MMCHow about:
depends on (SPI && MMC)Quoted 6 lines
Quoted 3 lines
I dislike to force user to enable both buses while only one of them is sufficient. I would prefer to keep current dependencies and to add #ifdef around problematic functions.
Yes, that's the better thing to do here overall.
zhong, can you work on that?
How about the following patch ?
drivers/staging/wfx/Makefile +1
-1@@ -19,6 +19,6 @@ wfx-y := \ sta.o \ debug.o wfx-$(CONFIG_SPI) += bus_spi.o -wfx-$(subst m,y,$(CONFIG_MMC)) += bus_sdio.o +wfx-$(CONFIG_MMC) += bus_sdio.o obj-$(CONFIG_WFX) += wfx.odrivers/staging/wfx/main.c +0
-0drivers/staging/wfx/main.c static int __init wfx_core_init(void) · line 489
Quoted 7 lines
drivers/staging/wfx/main.c +2
-1@@ -484,16 +484,19 @@ static int __init wfx_core_init(void)if (IS_ENABLED (CONFIG_SPI )) ret =spi_register_driver (&wfx_spi_driver); -if (IS_ENABLED (CONFIG_MMC ) && !ret) +#ifdef CONFIG_MMC +if (!ret) ret =sdio_register_driver (&wfx_sdio_driver);Put this in an inline function in the .h file so that you just call:
wfx_register_sdio_driver()
and it does what is needed to be done depending on ifCONFIG_MMCis enabled or not (note, your check here isn't quite correct, I think you need to doIS_ENABLED())
Quoted 3 lines
Same for spi.
We really do not like #ifdefs in .c files.
You're right. I should not use #ifdef here.
Thanks,
zhong jiang
Quoted 6 lines
thanks,
greg k-h
.