diff mbox series

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

Message ID 20201227143034.1134829-1-krzk@kernel.org (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show
Series ath9k: Add separate entry for LED triggers to fix module builds | expand

Commit Message

Krzysztof Kozlowski Dec. 27, 2020, 2:30 p.m. UTC
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 <lkp@intel.com>
Fixes: 72cdab808714 ("ath9k: Do not select MAC80211_LEDS by default")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 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(-)

Comments

Kalle Valo Jan. 28, 2021, 7:33 a.m. UTC | #1
Krzysztof Kozlowski <krzk@kernel.org> 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 <lkp@intel.com>
> Fixes: 72cdab808714 ("ath9k: Do not select MAC80211_LEDS by default")
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

I took Arnd's patch instead:

https://patchwork.kernel.org/project/linux-wireless/patch/20210125113654.2408057-1-arnd@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.
diff mbox series

Patch

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 ath9k_deinit_leds(struct ath9k_htc_priv *priv);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
index ecb848b60725..ffb8b656d257 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
@@ -222,7 +222,7 @@  void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product)
 /* LED */
 /*******/
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 void ath9k_led_work(struct work_struct *work)
 {
 	struct ath9k_htc_priv *priv = container_of(work,
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index db0c6fa9c9dc..0195983ce79a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -42,7 +42,7 @@  int htc_use_dev_fw = 0;
 module_param_named(use_dev_fw, htc_use_dev_fw, int, 0444);
 MODULE_PARM_DESC(use_dev_fw, "Use development FW version");
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 int ath9k_htc_led_blink = 1;
 module_param_named(blink, ath9k_htc_led_blink, int, 0444);
 MODULE_PARM_DESC(blink, "Enable LED blink on activity");
@@ -867,7 +867,7 @@  static int ath9k_init_device(struct ath9k_htc_priv *priv,
 		goto err_rx;
 
 	ath9k_hw_disable(priv->ah);
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 	/* must be initialized before ieee80211_register_hw */
 	priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw,
 		IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_htc_tpt_blink,
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 2b7832b1c800..aedf325a0320 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1007,7 +1007,7 @@  static void ath9k_htc_stop(struct ieee80211_hw *hw)
 	cancel_work_sync(&priv->fatal_work);
 	cancel_work_sync(&priv->ps_work);
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 	cancel_work_sync(&priv->led_work);
 #endif
 	ath9k_htc_stop_ani(priv);
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 42a208787f5a..82923d436d80 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -82,7 +82,7 @@  MODULE_PARM_DESC(use_msi, "Use MSI instead of INTx if possible");
 
 bool is_ath9k_unloaded;
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 static const struct ieee80211_tpt_blink ath9k_tpt_blink[] = {
 	{ .throughput = 0 * 1024, .blink_time = 334 },
 	{ .throughput = 1 * 1024, .blink_time = 260 },
@@ -1035,7 +1035,7 @@  int ath9k_init_device(u16 devid, struct ath_softc *sc,
 
 	ath9k_init_txpower_limits(sc);
 
-#ifdef CONFIG_MAC80211_LEDS
+#ifdef CONFIG_ATH9K_LEDS
 	/* must be initialized before ieee80211_register_hw */
 	sc->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(sc->hw,
 		IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_tpt_blink,