Subject: [origin tree build failure] [PATCH] Fix: (.text+0x22ec88): undefined reference to `ieee80211_unregister_hw'

From: Ingo Molnar <[email-masked]>
Date: Tue, 15 Sep 2009 13:49:58 +0200

>       wl1251: separate bus i/o code into io.c
>       wl1251: use wiphy_dev instead of wl->spi->dev
>       wl1251: introduce wl1251_if_operations struct
>       wl1251: make wl1251_set_partition bus agnostic
>       wl1251: move module probe methods into spi.c
>       wl1251: split spi interface into separate module
>       wl1251: add sdio support
>       wl1251: make irq handling interface specific
>       wl1251: correct definitions for 0th bit defines
>       wl1251: halt the embedded CPU before loading firmware

>       wl1251: change psm enabled/disabled info to debug

FYI, -tip testing found that something in this lot broke the build with 
certain configs (attached):

drivers/built-in.o: In function `wl1251_free_hw':
(.text+0x22ec88): undefined reference to `ieee80211_unregister_hw'
drivers/built-in.o: In function `wl1251_free_hw':
(.text+0x22ecf5): undefined reference to `ieee80211_free_hw'
drivers/built-in.o: In function `wl1251_op_bss_info_changed':
wl1251_main.c:(.text+0x22f161): undefined reference to `ieee80211_beacon_get'
drivers/built-in.o: In function `wl1251_op_config':
wl1251_main.c:(.text+0x22f2f8): undefined reference to `ieee80211_frequency_to_channel'
drivers/built-in.o: In function `wl1251_op_stop':
wl1251_main.c:(.text+0x22f554): undefined reference to `ieee80211_scan_completed'
drivers/built-in.o: In function `wl1251_op_tx':
wl1251_main.c:(.text+0x22f6a5): undefined reference to `ieee80211_queue_work'
wl1251_main.c:(.text+0x22f6b6): undefined reference to `ieee80211_stop_queues'
drivers/built-in.o: In function `wl1251_alloc_hw':
(.text+0x22f710): undefined reference to `ieee80211_alloc_hw'
drivers/built-in.o: In function `wl1251_alloc_hw':
(.text+0x22f9e4): undefined reference to `ieee80211_free_hw'
drivers/built-in.o: In function `wl1251_init_ieee80211':
(.text+0x2305df): undefined reference to `ieee80211_register_hw'
drivers/built-in.o: In function `wl1251_event_handle':
(.text+0x2306c4): undefined reference to `ieee80211_scan_completed'
drivers/built-in.o: In function `wl1251_tx_flush':
(.text+0x230810): undefined reference to `ieee80211_tx_status'
drivers/built-in.o: In function `wl1251_tx_flush':
(.text+0x230846): undefined reference to `ieee80211_tx_status'
drivers/built-in.o: In function `wl1251_tx_frame':
wl1251_tx.c:(.text+0x230a97): undefined reference to `ieee80211_hdrlen'
drivers/built-in.o: In function `wl1251_tx_complete':
(.text+0x230d30): undefined reference to `ieee80211_get_hdrlen_from_skb'
drivers/built-in.o: In function `wl1251_tx_complete':
(.text+0x230d58): undefined reference to `ieee80211_tx_status'
drivers/built-in.o: In function `wl1251_tx_complete':
(.text+0x230dc0): undefined reference to `ieee80211_wake_queues'
drivers/built-in.o: In function `wl1251_tx_work':
(.text+0x230f57): undefined reference to `ieee80211_stop_queues'
drivers/built-in.o: In function `wl1251_rx':
(.text+0x231187): undefined reference to `ieee80211_channel_to_frequency'
drivers/built-in.o: In function `wl1251_rx':
(.text+0x2311e4): undefined reference to `ieee80211_rx'

Turning CONFIG_WL1251 off makes it build.

A (very) quick first look suggests that not all prior dependencies were 
carried over to the new drivers in drivers/net/wireless/wl12xx/Kconfig:

-config WL12XX
-       tristate "TI wl1251/wl1271 support"
-       depends on MAC80211 && WLAN_80211 && SPI_MASTER && 
GENERIC_HARDIRQS && EXPERIMENTAL
+menuconfig WL12XX
+       boolean "TI wl12xx driver support"
+       depends on MAC80211 && WLAN_80211 && EXPERIMENTAL
+       ---help---
+         This will enable TI wl12xx driver support. The drivers make
+         use of the mac80211 stack.
+
+config WL1251
+       tristate "TI wl1251 support"
+       depends on WL12XX && GENERIC_HARDIRQS

the friction is between modular/build-in mode:

 CONFIG_WL1251=y
 CONFIG_MAC80211=m

Kconfig does not carry over the modular dependency from WL12XX to 
WL1251. An explicit rule via the patch below turns CONFIG_WL1251 into a 
modular entry as well:

 CONFIG_WL12XX=y
 CONFIG_WL1251=m

( Note: i have tested this patch with this particular config and it 
  solves the problem there but have not investigated any deeper. )

	Ingo

Signed-off-by: Ingo Molnar <[email-masked]>
---
 drivers/net/wireless/wl12xx/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/net/wireless/wl12xx/Kconfig
===================================================================
--- linux.orig/drivers/net/wireless/wl12xx/Kconfig
+++ linux/drivers/net/wireless/wl12xx/Kconfig
@@ -7,7 +7,7 @@ menuconfig WL12XX
 
 config WL1251
 	tristate "TI wl1251 support"
-	depends on WL12XX && GENERIC_HARDIRQS
+	depends on MAC80211 && WL12XX && GENERIC_HARDIRQS
 	select FW_LOADER
 	select CRC7
 	---help---