#include "common.h"
#include "debug.h"
-@@ -973,6 +974,14 @@ struct ath_led {
+@@ -1001,6 +1002,14 @@ struct ath_led {
struct led_classdev cdev;
};
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
-@@ -1027,6 +1036,9 @@ struct ath_softc {
+@@ -1058,6 +1067,9 @@ struct ath_softc {
#ifdef CPTCFG_MAC80211_LEDS
const char *led_default_trigger;
struct list_head leds;
+ if (!gc)
+ return;
+
++ gc->sc = sc;
+ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
+ wiphy_name(sc->hw->wiphy));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
+
+ gc->gchip.owner = NULL;
+ sc->gpiochip = gc;
-+ gc->sc = sc;
+}
+
+/* remove GPIO chip */
+ 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