Subject: [PATCH 11/12] pcmcia/net_pcmcia: all net_pcmcia modules depend on PCMCIA

Fix several build errors with PCMCIA=m && NET_PCMCIA=y:

LD .tmp_vmlinux1
drivers/built-in.o: In function `nmclan_release':
nmclan_cs.c:(.text+0x14026c): undefined reference to `pcmcia_disable_device'
...
drivers/built-in.o: In function `exit_xirc2ps_cs':
xirc2ps_cs.c:(.exit.text+0x1055): undefined reference to `pcmcia_unregister_driver'
make: *** [.tmp_vmlinux1] Error 1

Signed-off-by: Andreas Herrmann <[email protected]>
---
drivers/net/pcmcia/Kconfig | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pcmcia/Kconfig b/drivers/net/pcmcia/Kconfig
index 5d658bc..9545440 100644
--- a/drivers/net/pcmcia/Kconfig
+++ b/drivers/net/pcmcia/Kconfig
@@ -23,6 +23,7 @@ if NET_PCMCIA

config PCMCIA_3C589
tristate "3Com 3c589 PCMCIA support"
+ depends on PCMCIA
help
Say Y here if you intend to attach a 3Com 3c589 or compatible PCMCIA
(PC-card) Ethernet card to your computer.
@@ -32,6 +33,7 @@ config PCMCIA_3C589

config PCMCIA_3C574
tristate "3Com 3c574 PCMCIA support"
+ depends on PCMCIA
help
Say Y here if you intend to attach a 3Com 3c574 or compatible PCMCIA
(PC-card) Fast Ethernet card to your computer.
@@ -41,6 +43,7 @@ config PCMCIA_3C574

config PCMCIA_FMVJ18X
tristate "Fujitsu FMV-J18x PCMCIA support"
+ depends on PCMCIA
select CRC32
help
Say Y here if you intend to attach a Fujitsu FMV-J18x or compatible
@@ -51,6 +54,7 @@ config PCMCIA_FMVJ18X

config PCMCIA_PCNET
tristate "NE2000 compatible PCMCIA support"
+ depends on PCMCIA
select CRC32
help
Say Y here if you intend to attach an NE2000 compatible PCMCIA
@@ -61,6 +65,7 @@ config PCMCIA_PCNET

config PCMCIA_NMCLAN
tristate "New Media PCMCIA support"
+ depends on PCMCIA
help
Say Y here if you intend to attach a New Media Ethernet or LiveWire
PCMCIA (PC-card) Ethernet card to your computer.
@@ -70,6 +75,7 @@ config PCMCIA_NMCLAN

config PCMCIA_SMC91C92
tristate "SMC 91Cxx PCMCIA support"
+ depends on PCMCIA
select CRC32
select MII
help
@@ -81,6 +87,7 @@ config PCMCIA_SMC91C92

config PCMCIA_XIRC2PS
tristate "Xircom 16-bit PCMCIA support"
+ depends on PCMCIA
help
Say Y here if you intend to attach a Xircom 16-bit PCMCIA (PC-card)
Ethernet or Fast Ethernet card to your computer.
@@ -90,6 +97,7 @@ config PCMCIA_XIRC2PS

config PCMCIA_AXNET
tristate "Asix AX88190 PCMCIA support"
+ depends on PCMCIA
---help---
Say Y here if you intend to attach an Asix AX88190-based PCMCIA
(PC-card) Fast Ethernet card to your computer. These cards are
@@ -101,7 +109,7 @@ config PCMCIA_AXNET

config ARCNET_COM20020_CS
tristate "COM20020 ARCnet PCMCIA support"
- depends on ARCNET_COM20020
+ depends on ARCNET_COM20020 && PCMCIA
help
Say Y here if you intend to attach this type of ARCnet PCMCIA card
to your computer.
@@ -111,7 +119,7 @@ config ARCNET_COM20020_CS

config PCMCIA_IBMTR
tristate "IBM PCMCIA tokenring adapter support"
- depends on IBMTR!=y && TR && !64BIT
+ depends on IBMTR!=y && TR && !64BIT && PCMCIA
help
Say Y here if you intend to attach this type of Token Ring PCMCIA
card to your computer. You then also need to say Y to "Token Ring
--
1.5.0.7





2007-06-20 20:44:53

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 11/12] pcmcia/net_pcmcia: all net_pcmcia modules depend on PCMCIA

On Wed, 20 Jun 2007 00:52:03 +0200 Andreas Herrmann wrote:

> Fix several build errors with PCMCIA=m && NET_PCMCIA=y:
>
> LD .tmp_vmlinux1
> drivers/built-in.o: In function `nmclan_release':
> nmclan_cs.c:(.text+0x14026c): undefined reference to `pcmcia_disable_device'
> ...
> drivers/built-in.o: In function `exit_xirc2ps_cs':
> xirc2ps_cs.c:(.exit.text+0x1055): undefined reference to `pcmcia_unregister_driver'
> make: *** [.tmp_vmlinux1] Error 1

This is interesting. This is a result of the menuconfig changes,
which made NET_PCMCIA a boolean, and then some tristates depend
on NET_PCMCIA and the boolean -> tristate dependencies aren't
specific enough.

Your fix is one way to do it. I'd prefer to make
NET_PCMCIA a tristate instead, then let its value trickle down
to the subordinate config symbols.

This probably means that some of the other menuconfig changes
need to be audited for this "feature."


Here is my preferred patch.
~~~~~~~~~~

From: Randy Dunlap <[email protected]>

Make NET_PCMCIA a tristate symbol so that net/pcmcia drivers
are constrained to M when needed.

Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/net/pcmcia/Kconfig | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

--- linux-2.6.22-rc5.orig/drivers/net/pcmcia/Kconfig
+++ linux-2.6.22-rc5/drivers/net/pcmcia/Kconfig
@@ -3,14 +3,14 @@
#

menuconfig NET_PCMCIA
- bool "PCMCIA network device support"
+ tristate "PCMCIA network device support"
depends on PCMCIA
---help---
- Say Y if you would like to include support for any PCMCIA or CardBus
- network adapters, then say Y to the driver for your particular card
- below. PCMCIA- or PC-cards are credit-card size devices often used
- with laptops computers; CardBus is the newer and faster version of
- PCMCIA.
+ Say Y or M if you would like to include support for any PCMCIA or
+ CardBus network adapters, then say Y or M to the driver for your
+ particular card below. PCMCIA- or PC-cards are credit-card size
+ devices often used with laptops computers; CardBus is the newer
+ and faster version of PCMCIA.

To use your PC-cards, you will need supporting software from David
Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>

2007-06-20 21:25:55

by Satyam Sharma

[permalink] [raw]
Subject: Re: [PATCH 11/12] pcmcia/net_pcmcia: all net_pcmcia modules depend on PCMCIA

Hi Randy,

On 6/21/07, Randy Dunlap <[email protected]> wrote:
> On Wed, 20 Jun 2007 00:52:03 +0200 Andreas Herrmann wrote:
>
> > Fix several build errors with PCMCIA=m && NET_PCMCIA=y:
> >
> > LD .tmp_vmlinux1
> > drivers/built-in.o: In function `nmclan_release':
> > nmclan_cs.c:(.text+0x14026c): undefined reference to `pcmcia_disable_device'
> > ...
> > drivers/built-in.o: In function `exit_xirc2ps_cs':
> > xirc2ps_cs.c:(.exit.text+0x1055): undefined reference to `pcmcia_unregister_driver'
> > make: *** [.tmp_vmlinux1] Error 1
>
> This is interesting. This is a result of the menuconfig changes,
> which made NET_PCMCIA a boolean, and then some tristates depend
> on NET_PCMCIA and the boolean -> tristate dependencies aren't
> specific enough.
>
> Your fix is one way to do it. I'd prefer to make
> NET_PCMCIA a tristate instead, then let its value trickle down
> to the subordinate config symbols.

This is interesting indeed. But would it make much sense to
mark a menuconfig item as tristate? I suspect the problem here
was simply that these PCMCIA drivers did not explicitly depend
on CONFIG_PCMCIA (which they should be, considering they
pull in code from that particular subsystem), which Andreas'
patch resolves ...

[ Also, when we make NET_PCMCIA tristate here, I suspect it
would still be possible to select these drivers as built-in (even
though PCMCIA can be modular) which would still give the
above errors? I didn't test, so please correct me if I'm wrong. ]

> This probably means that some of the other menuconfig changes
> need to be audited for this "feature."

Right. [ I didn't check git history, but it is also possible that
these drivers not depend on PCMCIA like they should have
before Jan did the menuconfig conversions too. ] But IMHO,
the general lesson from this case is that if some driver depends
on some other symbol, then we still need to honour that
dependency explicitly instead of simply putting the driver inside
a "#if <menuconfig_symbol>" and only making the
<menuconfig_item> itself depend on the said dependency;
otherwise the boolean / tristate problems you mentioned will bite,
so an audit would clearly be in order.

Satyam

2007-06-20 22:39:40

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 11/12] pcmcia/net_pcmcia: all net_pcmcia modules depend on PCMCIA

Satyam Sharma wrote:
> Hi Randy,
>
> On 6/21/07, Randy Dunlap <[email protected]> wrote:
>> On Wed, 20 Jun 2007 00:52:03 +0200 Andreas Herrmann wrote:
>>
>> > Fix several build errors with PCMCIA=m && NET_PCMCIA=y:
>> >
>> > LD .tmp_vmlinux1
>> > drivers/built-in.o: In function `nmclan_release':
>> > nmclan_cs.c:(.text+0x14026c): undefined reference to
>> `pcmcia_disable_device'
>> > ...
>> > drivers/built-in.o: In function `exit_xirc2ps_cs':
>> > xirc2ps_cs.c:(.exit.text+0x1055): undefined reference to
>> `pcmcia_unregister_driver'
>> > make: *** [.tmp_vmlinux1] Error 1
>>
>> This is interesting. This is a result of the menuconfig changes,
>> which made NET_PCMCIA a boolean, and then some tristates depend
>> on NET_PCMCIA and the boolean -> tristate dependencies aren't
>> specific enough.
>>
>> Your fix is one way to do it. I'd prefer to make
>> NET_PCMCIA a tristate instead, then let its value trickle down
>> to the subordinate config symbols.
>
> This is interesting indeed. But would it make much sense to
> mark a menuconfig item as tristate? I suspect the problem here
> was simply that these PCMCIA drivers did not explicitly depend
> on CONFIG_PCMCIA (which they should be, considering they
> pull in code from that particular subsystem), which Andreas'
> patch resolves ...
>
> [ Also, when we make NET_PCMCIA tristate here, I suspect it
> would still be possible to select these drivers as built-in (even
> though PCMCIA can be modular) which would still give the
> above errors? I didn't test, so please correct me if I'm wrong. ]

I did test it. If PCMCIA=m, with my patch, the NET_PCMCIA drivers
cannot be configured as built-in.

>> This probably means that some of the other menuconfig changes
>> need to be audited for this "feature."
>
> Right. [ I didn't check git history, but it is also possible that
> these drivers not depend on PCMCIA like they should have
> before Jan did the menuconfig conversions too. ] But IMHO,
> the general lesson from this case is that if some driver depends
> on some other symbol, then we still need to honour that
> dependency explicitly instead of simply putting the driver inside
> a "#if <menuconfig_symbol>" and only making the
> <menuconfig_item> itself depend on the said dependency;
> otherwise the boolean / tristate problems you mentioned will bite,
> so an audit would clearly be in order.
>
> Satyam


--
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

Subject: Re: [PATCH 11/12] pcmcia/net_pcmcia: all net_pcmcia modules depend on PCMCIA

On Wed, Jun 20, 2007 at 01:44:35PM -0700, Randy Dunlap wrote:
> On Wed, 20 Jun 2007 00:52:03 +0200 Andreas Herrmann wrote:
>
> > Fix several build errors with PCMCIA=m && NET_PCMCIA=y:
> >
> > LD .tmp_vmlinux1
> > drivers/built-in.o: In function `nmclan_release':
> > nmclan_cs.c:(.text+0x14026c): undefined reference to `pcmcia_disable_device'
> > ...
> > drivers/built-in.o: In function `exit_xirc2ps_cs':
> > xirc2ps_cs.c:(.exit.text+0x1055): undefined reference to `pcmcia_unregister_driver'
> > make: *** [.tmp_vmlinux1] Error 1
>
> This is interesting. This is a result of the menuconfig changes,
> which made NET_PCMCIA a boolean, and then some tristates depend
> on NET_PCMCIA and the boolean -> tristate dependencies aren't
> specific enough.
>
> Your fix is one way to do it. I'd prefer to make
> NET_PCMCIA a tristate instead, then let its value trickle down
> to the subordinate config symbols.
>
> This probably means that some of the other menuconfig changes
> need to be audited for this "feature."
>
>
> Here is my preferred patch.
> ~~~~~~~~~~
>
> From: Randy Dunlap <[email protected]>
>
> Make NET_PCMCIA a tristate symbol so that net/pcmcia drivers
> are constrained to M when needed.
>
> Signed-off-by: Randy Dunlap <[email protected]>
> ---
> drivers/net/pcmcia/Kconfig | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> --- linux-2.6.22-rc5.orig/drivers/net/pcmcia/Kconfig
> +++ linux-2.6.22-rc5/drivers/net/pcmcia/Kconfig
> @@ -3,14 +3,14 @@
> #
>
> menuconfig NET_PCMCIA
> - bool "PCMCIA network device support"
> + tristate "PCMCIA network device support"
> depends on PCMCIA


Yes this solves the problem.
... and is the preferred variant.


Regards,

Andreas


--
Operating | AMD Saxony Limited Liability Company & Co. KG,
System | Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Research | Register Court Dresden: HRA 4896, General Partner authorized
Center | to represent: AMD Saxony LLC (Wilmington, Delaware, US)
(OSRC) | General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy