ath9k: fix build error with LEDS_CLASS=m
authorArnd Bergmann <arnd@arndb.de>
Mon, 25 Jan 2021 11:36:42 +0000 (12:36 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 28 Jan 2021 07:29:34 +0000 (09:29 +0200)
When CONFIG_ATH9K is built-in but LED support is in a loadable
module, both ath9k drivers fails to link:

x86_64-linux-ld: drivers/net/wireless/ath/ath9k/gpio.o: in function `ath_deinit_leds':
gpio.c:(.text+0x36): undefined reference to `led_classdev_unregister'
x86_64-linux-ld: drivers/net/wireless/ath/ath9k/gpio.o: in function `ath_init_leds':
gpio.c:(.text+0x179): undefined reference to `led_classdev_register_ext'

The problem is that the 'imply' keyword does not enforce any dependency
but is only a weak hint to Kconfig to enable another symbol from a
defconfig file.

Change imply to a 'depends on LEDS_CLASS' that prevents the incorrect
configuration but still allows building the driver without LED support.

The 'select MAC80211_LEDS' is now ensures that the LED support is
actually used if it is present, and the added Kconfig dependency
on MAC80211_LEDS ensures that it cannot be enabled manually when it
has no effect.

Fixes: 197f466e93f5 ("ath9k_htc: Do not select MAC80211_LEDS by default")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210125113654.2408057-1-arnd@kernel.org
drivers/net/wireless/ath/ath9k/Kconfig
net/mac80211/Kconfig

index a84bb9b6573f8d559ddf6cba5444c7fb295dfb41..e150d82eddb6c72859872abc7b3d7e73b7484e94 100644 (file)
@@ -21,11 +21,9 @@ config ATH9K_BTCOEX_SUPPORT
 config ATH9K
        tristate "Atheros 802.11n wireless cards support"
        depends on MAC80211 && HAS_DMA
+       select MAC80211_LEDS if LEDS_CLASS=y || LEDS_CLASS=MAC80211
        select ATH9K_HW
        select ATH9K_COMMON
-       imply NEW_LEDS
-       imply LEDS_CLASS
-       imply MAC80211_LEDS
        help
          This module adds support for wireless adapters based on
          Atheros IEEE 802.11n AR5008, AR9001 and AR9002 family
@@ -176,11 +174,9 @@ config ATH9K_PCI_NO_EEPROM
 config ATH9K_HTC
        tristate "Atheros HTC based wireless cards support"
        depends on USB && MAC80211
+       select MAC80211_LEDS if LEDS_CLASS=y || LEDS_CLASS=MAC80211
        select ATH9K_HW
        select ATH9K_COMMON
-       imply NEW_LEDS
-       imply LEDS_CLASS
-       imply MAC80211_LEDS
        help
          Support for Atheros HTC based cards.
          Chipsets supported: AR9271
index cd9a9bd242babbc1bb8e3fdbbe88fc0c9b5b5c85..51ec8256b7fa9e45455e10c0f16448c12e87b4dd 100644 (file)
@@ -69,7 +69,7 @@ config MAC80211_MESH
 config MAC80211_LEDS
        bool "Enable LED triggers"
        depends on MAC80211
-       depends on LEDS_CLASS
+       depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211
        select LEDS_TRIGGERS
        help
          This option enables a few LED triggers for different