2019-10-11 03:08:11

by zhong jiang

[permalink] [raw]
Subject: [PATCH] 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'

Signed-off-by: zhong jiang <[email protected]>
---
drivers/staging/wfx/Kconfig | 3 ++-
drivers/staging/wfx/Makefile | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
index 9b8a1c7..4d045513 100644
--- a/drivers/staging/wfx/Kconfig
+++ b/drivers/staging/wfx/Kconfig
@@ -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.
diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
index 0d9c1ed..fc30b49 100644
--- a/drivers/staging/wfx/Makefile
+++ b/drivers/staging/wfx/Makefile
@@ -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
--
1.7.12.4


2019-10-11 04:30:27

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
> 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'
>
> Signed-off-by: zhong jiang <[email protected]>
> ---
> drivers/staging/wfx/Kconfig | 3 ++-
> drivers/staging/wfx/Makefile | 5 +++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
> index 9b8a1c7..4d045513 100644
> --- a/drivers/staging/wfx/Kconfig
> +++ b/drivers/staging/wfx/Kconfig
> @@ -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

2019-10-11 06:21:24

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On 2019/10/11 12:26, Greg KH wrote:
> On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
>> 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'
>>
>> Signed-off-by: zhong jiang <[email protected]>
>> ---
>> drivers/staging/wfx/Kconfig | 3 ++-
>> drivers/staging/wfx/Makefile | 5 +++--
>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
>> index 9b8a1c7..4d045513 100644
>> --- a/drivers/staging/wfx/Kconfig
>> +++ b/drivers/staging/wfx/Kconfig
>> @@ -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?
Yep, That is better. Will repost in v2. Thanks,

Sincerely,
zhong jiang
> thanks,
>
> greg k-h
>
> .
>


2019-10-11 08:44:18

by Jérôme Pouiller

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

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.
>
>
> On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
> > 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'
> >
> > Signed-off-by: zhong jiang <[email protected]>
> > ---
> > drivers/staging/wfx/Kconfig | 3 ++-
> > drivers/staging/wfx/Makefile | 5 +++--
> > 2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
> > index 9b8a1c7..4d045513 100644
> > --- a/drivers/staging/wfx/Kconfig
> > +++ b/drivers/staging/wfx/Kconfig
> > @@ -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)

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)


--
J?r?me Pouiller

2019-10-11 09:06:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On Fri, Oct 11, 2019 at 08:40:08AM +0000, Jerome Pouiller wrote:
> 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.
> >
> >
> > On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
> > > 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'
> > >
> > > Signed-off-by: zhong jiang <[email protected]>
> > > ---
> > > drivers/staging/wfx/Kconfig | 3 ++-
> > > drivers/staging/wfx/Makefile | 5 +++--
> > > 2 files changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
> > > index 9b8a1c7..4d045513 100644
> > > --- a/drivers/staging/wfx/Kconfig
> > > +++ b/drivers/staging/wfx/Kconfig
> > > @@ -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)
>
> 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

2019-10-11 14:51:46

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On 2019/10/11 17:02, Greg KH wrote:
> On Fri, Oct 11, 2019 at 08:40:08AM +0000, Jerome Pouiller wrote:
>> 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.
>>>
>>> On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
>>>> 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'
>>>> Signed-off-by: zhong jiang <[email protected]>
>>>> ---
>>>> drivers/staging/wfx/Kconfig | 3 ++-
>>>> drivers/staging/wfx/Makefile | 5 +++--
>>>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
>>>> index 9b8a1c7..4d045513 100644
>>>> --- a/drivers/staging/wfx/Kconfig
>>>> +++ b/drivers/staging/wfx/Kconfig
>>>> @@ -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)
>> 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
> thanks,
>
> greg k-h
>
> .
>


2019-10-11 15:52:57

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On 2019/10/11 17:02, Greg KH wrote:
> On Fri, Oct 11, 2019 at 08:40:08AM +0000, Jerome Pouiller wrote:
>> 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.
>>>
>>> On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
>>>> 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'
>>>> Signed-off-by: zhong jiang <[email protected]>
>>>> ---
>>>> drivers/staging/wfx/Kconfig | 3 ++-
>>>> drivers/staging/wfx/Makefile | 5 +++--
>>>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
>>>> index 9b8a1c7..4d045513 100644
>>>> --- a/drivers/staging/wfx/Kconfig
>>>> +++ b/drivers/staging/wfx/Kconfig
>>>> @@ -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)
>> 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 ?

diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
index 0d9c1ed..77d68b7 100644
--- a/drivers/staging/wfx/Makefile
+++ b/drivers/staging/wfx/Makefile
@@ -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
diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
index d2508bc..26720a4 100644
--- a/drivers/staging/wfx/main.c
+++ b/drivers/staging/wfx/main.c
@@ -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
> thanks,
>
> greg k-h
>
> .
>


2019-10-11 15:58:20

by Jérôme Pouiller

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On Friday 11 October 2019 17:51:29 CEST zhong jiang wrote:
[...]
> How about the following patch ?
>
> diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
> index 0d9c1ed..77d68b7 100644
> --- a/drivers/staging/wfx/Makefile
> +++ b/drivers/staging/wfx/Makefile
> @@ -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
> diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
> index d2508bc..26720a4 100644
> --- a/drivers/staging/wfx/main.c
> +++ b/drivers/staging/wfx/main.c
> @@ -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);
> }
Hello zhong,

Can you also check the case where CONFIG_SPI is not set?

Thank you,

--
J?r?me Pouiller

2019-10-11 16:16:29

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On 2019/10/11 23:55, Jerome Pouiller wrote:
> On Friday 11 October 2019 17:51:29 CEST zhong jiang wrote:
> [...]
>> How about the following patch ?
>>
>> diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
>> index 0d9c1ed..77d68b7 100644
>> --- a/drivers/staging/wfx/Makefile
>> +++ b/drivers/staging/wfx/Makefile
>> @@ -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
>> diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
>> index d2508bc..26720a4 100644
>> --- a/drivers/staging/wfx/main.c
>> +++ b/drivers/staging/wfx/main.c
>> @@ -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);
>> }
> Hello zhong,
>
> Can you also check the case where CONFIG_SPI is not set?
I have tested the case and it works well when CONFIG_SPI is not set.

Thanks,
zhong jiang
> Thank you,
>


2019-10-11 16:17:40

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On Fri, Oct 11, 2019 at 11:51:16PM +0800, zhong jiang wrote:
> On 2019/10/11 17:02, Greg KH wrote:
> > On Fri, Oct 11, 2019 at 08:40:08AM +0000, Jerome Pouiller wrote:
> >> 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.
> >>>
> >>> On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
> >>>> 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'
> >>>> Signed-off-by: zhong jiang <[email protected]>
> >>>> ---
> >>>> drivers/staging/wfx/Kconfig | 3 ++-
> >>>> drivers/staging/wfx/Makefile | 5 +++--
> >>>> 2 files changed, 5 insertions(+), 3 deletions(-)
> >>>>
> >>>> diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
> >>>> index 9b8a1c7..4d045513 100644
> >>>> --- a/drivers/staging/wfx/Kconfig
> >>>> +++ b/drivers/staging/wfx/Kconfig
> >>>> @@ -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)
> >> 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 ?
>
> diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
> index 0d9c1ed..77d68b7 100644
> --- a/drivers/staging/wfx/Makefile
> +++ b/drivers/staging/wfx/Makefile
> @@ -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
> diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
> index d2508bc..26720a4 100644
> --- a/drivers/staging/wfx/main.c
> +++ b/drivers/staging/wfx/main.c
> @@ -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

2019-10-11 16:28:03

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH] staging: wfx: fix an undefined reference error when CONFIG_MMC=m

On 2019/10/12 0:16, Greg KH wrote:
> On Fri, Oct 11, 2019 at 11:51:16PM +0800, zhong jiang wrote:
>> On 2019/10/11 17:02, Greg KH wrote:
>>> On Fri, Oct 11, 2019 at 08:40:08AM +0000, Jerome Pouiller wrote:
>>>> 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.
>>>>> On Fri, Oct 11, 2019 at 11:02:19AM +0800, zhong jiang wrote:
>>>>>> 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'
>>>>>> Signed-off-by: zhong jiang <[email protected]>
>>>>>> ---
>>>>>> drivers/staging/wfx/Kconfig | 3 ++-
>>>>>> drivers/staging/wfx/Makefile | 5 +++--
>>>>>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig
>>>>>> index 9b8a1c7..4d045513 100644
>>>>>> --- a/drivers/staging/wfx/Kconfig
>>>>>> +++ b/drivers/staging/wfx/Kconfig
>>>>>> @@ -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)
>>>> 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 ?
>>
>> diff --git a/drivers/staging/wfx/Makefile b/drivers/staging/wfx/Makefile
>> index 0d9c1ed..77d68b7 100644
>> --- a/drivers/staging/wfx/Makefile
>> +++ b/drivers/staging/wfx/Makefile
>> @@ -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
>> diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c
>> index d2508bc..26720a4 100644
>> --- a/drivers/staging/wfx/main.c
>> +++ b/drivers/staging/wfx/main.c
>> @@ -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.
You're right. I should not use #ifdef here.

Thanks,
zhong jiang
> thanks,
>
> greg k-h
>
> .
>