INIT_LIST_HEAD(&sc->leds);
-@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
+@@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc)
- ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
- !sc->sc_ah->config.led_active_high);
+ ath_fill_led_pin(sc);
+
++ if (pdata && pdata->leds && pdata->num_leds)
++ for (i = 0; i < pdata->num_leds; i++) {
++ if (pdata->leds[i].gpio == sc->sc_ah->led_pin)
++ sc->sc_ah->led_pin = -1;
++
++ ath_create_platform_led(sc, &pdata->leds[i]);
++ }
+
-+ if (!pdata)
++ if (sc->sc_ah->led_pin < 0)
+ return;
+
-+ for (i = 0; i < pdata->num_leds; i++)
-+ ath_create_platform_led(sc, &pdata->leds[i]);
- }
- #endif
+ snprintf(led_name, sizeof(led_name), "ath9k-%s",
+ wiphy_name(sc->hw->wiphy));
Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
---
- drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
- include/linux/ath9k_platform.h | 1 +
- 2 files changed, 8 insertions(+), 3 deletions(-)
+ drivers/net/wireless/ath/ath9k/gpio.c | 7 +++++--
+ include/linux/ath9k_platform.h | 1 +
+ 2 files changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
-
- ath_fill_led_pin(sc);
+@@ -166,8 +166,11 @@ void ath_init_leds(struct ath_softc *sc)
+ if (sc->sc_ah->led_pin < 0)
+ return;
- snprintf(led_name, sizeof(led_name), "ath9k-%s",
- wiphy_name(sc->hw->wiphy));
+ ath9k_register_gpio_chip(sc);
+
- if (pdata && pdata->led_name)
- strncpy(led_name, pdata->led_name, sizeof(led_name));
- else
-@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
- for (i = 0; i < pdata->num_leds; i++)
- ath_create_platform_led(sc, &pdata->leds[i]);
+ if (pdata && pdata->leds && pdata->num_leds)
+ for (i = 0; i < pdata->num_leds; i++) {
+ if (pdata->leds[i].gpio == sc->sc_ah->led_pin)
+@@ -183,6 +319,7 @@ void ath_init_leds(struct ath_softc *sc)
+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
+ !sc->sc_ah->config.led_active_high);
}
+
#endif
ath9k_register_gpio_chip(sc);
+ ath9k_init_buttons(sc);
- if (pdata && pdata->led_name)
- strncpy(led_name, pdata->led_name, sizeof(led_name));
-@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
- ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
- !sc->sc_ah->config.led_active_high);
-
-- if (!pdata)
-+ if (!pdata || !pdata->leds || !pdata->num_leds)
- return;
-
- for (i = 0; i < pdata->num_leds; i++)
+ if (pdata && pdata->leds && pdata->num_leds)
+ for (i = 0; i < pdata->num_leds; i++) {
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -50,6 +50,10 @@ struct ath9k_platform_data {