Re: [PATCH] ath9k: Add separate entry for LED triggers to fix module builds

2021-01-27 Thread Kalle Valo
Krzysztof Kozlowski  wrote:

> After commit 72cdab808714 ("ath9k: Do not select MAC80211_LEDS by
> default") a configuration like:
>  - MAC80211_LEDS=y
>  - LEDS_CLASS=m
>  - NEW_LEDS=y
>  - ATH9K=y
> leads to a build failure:
> 
> /usr/bin/ld: drivers/net/wireless/ath/ath9k/gpio.o: in function 
> `ath_deinit_leds':
> drivers/net/wireless/ath/ath9k/gpio.c:69: undefined reference to 
> `led_classdev_unregister'
> /usr/bin/ld: drivers/net/wireless/ath/ath9k/gpio.o: in function 
> `led_classdev_register':
> include/linux/leds.h:190: undefined reference to 
> `led_classdev_register_ext'
> 
> To be able to use LED triggers, the LEDS_CLASS can only be a module
> if ath9k driver is a module as well.
> 
> Reported-by: kernel test robot 
> Fixes: 72cdab808714 ("ath9k: Do not select MAC80211_LEDS by default")
> Signed-off-by: Krzysztof Kozlowski 

I took Arnd's patch instead:

https://patchwork.kernel.org/project/linux-wireless/patch/20210125113654.2408057-1-a...@kernel.org/

But I think we really need the cleanup Arnd proposes during the discussion so
that we have consistent LED handling in wireless drivers. Patches very welcome.

Patch set to Superseded.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20201227143034.1134829-1-k...@kernel.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[PATCH] ath9k: Add separate entry for LED triggers to fix module builds

2020-12-27 Thread Krzysztof Kozlowski
After commit 72cdab808714 ("ath9k: Do not select MAC80211_LEDS by
default") a configuration like:
 - MAC80211_LEDS=y
 - LEDS_CLASS=m
 - NEW_LEDS=y
 - ATH9K=y
leads to a build failure:

/usr/bin/ld: drivers/net/wireless/ath/ath9k/gpio.o: in function 
`ath_deinit_leds':
drivers/net/wireless/ath/ath9k/gpio.c:69: undefined reference to 
`led_classdev_unregister'
/usr/bin/ld: drivers/net/wireless/ath/ath9k/gpio.o: in function 
`led_classdev_register':
include/linux/leds.h:190: undefined reference to `led_classdev_register_ext'

To be able to use LED triggers, the LEDS_CLASS can only be a module
if ath9k driver is a module as well.

Reported-by: kernel test robot 
Fixes: 72cdab808714 ("ath9k: Do not select MAC80211_LEDS by default")
Signed-off-by: Krzysztof Kozlowski 
---
 drivers/net/wireless/ath/ath9k/Kconfig| 18 --
 drivers/net/wireless/ath/ath9k/ath9k.h|  4 ++--
 drivers/net/wireless/ath/ath9k/gpio.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc.h  |  6 +++---
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  4 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |  2 +-
 drivers/net/wireless/ath/ath9k/init.c |  4 ++--
 8 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/Kconfig 
b/drivers/net/wireless/ath/ath9k/Kconfig
index a84bb9b6573f..6193dd4d85f0 100644
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -23,9 +23,6 @@ config ATH9K
depends on MAC80211 && HAS_DMA
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
@@ -38,6 +35,18 @@ config ATH9K
 
  If you choose to build a module, it'll be called ath9k.
 
+config ATH9K_LEDS
+   bool "Atheros ath9k LED triggers"
+   default y
+   depends on ATH9K || ATH9K_HTC
+   depends on NEW_LEDS
+   select LEDS_CLASS
+   select MAC80211_LEDS
+   help
+ This option enables a few LED triggers for different
+ packet receive/transmit events on Atheros family
+ of wireless cards (PCI and HTC).
+
 config ATH9K_PCI
bool "Atheros ath9k PCI/PCIe bus support"
default y
@@ -178,9 +187,6 @@ config ATH9K_HTC
depends on USB && 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
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 13b4f5f50f8a..045118dc2a84 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -839,7 +839,7 @@ static inline int ath9k_dump_btcoex(struct ath_softc *sc, 
u8 *buf, u32 size)
 #define ATH_LED_PIN_9485   6
 #define ATH_LED_PIN_9462   4
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 void ath_init_leds(struct ath_softc *sc);
 void ath_deinit_leds(struct ath_softc *sc);
 #else
@@ -1030,7 +1030,7 @@ struct ath_softc {
struct ath_chanctx *cur_chan;
spinlock_t chan_lock;
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
bool led_registered;
char led_name[32];
struct led_classdev led_cdev;
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c 
b/drivers/net/wireless/ath/ath9k/gpio.c
index b457e52dd365..aeaa7752049d 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -20,7 +20,7 @@
 /*  LED functions  */
 //
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 
 static void ath_fill_led_pin(struct ath_softc *sc)
 {
diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 0a1634238e67..d3a25c8bfcb5 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -44,7 +44,7 @@
 
 extern struct ieee80211_ops ath9k_htc_ops;
 extern int htc_modparam_nohwcrypt;
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 extern int ath9k_htc_led_blink;
 #endif
 
@@ -510,7 +510,7 @@ struct ath9k_htc_priv {
bool ps_enabled;
bool ps_idle;
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
enum led_brightness brightness;
bool led_registered;
char led_name[32];
@@ -604,7 +604,7 @@ void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw);
 
 struct base_eep_header *ath9k_htc_get_eeprom_base(struct ath9k_htc_priv *priv);
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 void ath9k_configure_leds(struct ath9k_htc_priv *priv);
 void ath9k_init_leds(struct ath9k_htc_priv *priv);
 void