From: Rosen Penev Date: Tue, 31 Dec 2024 22:09:44 +0000 (-0800) Subject: mac80211: ath9k: remove platform leds X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baf73daaacdef46307454bc5d507c31d9033c01c;p=thirdparty%2Fopenwrt.git mac80211: ath9k: remove platform leds These only work with and are useful with mach files. Now that those are gone, this can go too. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/17445 Signed-off-by: Robert Marko --- diff --git a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch deleted file mode 100644 index 1055bd335c1..00000000000 --- a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/gpio.c -+++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -15,6 +15,7 @@ - */ - - #include "ath9k.h" -+#include - - /********************************/ - /* LED functions */ -@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc - return ret; - } - -+static int ath_create_platform_led(struct ath_softc *sc, -+ const struct gpio_led *gpio) -+{ -+ struct ath_led *led; -+ int ret; -+ -+ led = kzalloc(sizeof(*led), GFP_KERNEL); -+ if (!led) -+ return -ENOMEM; -+ -+ led->gpio = gpio; -+ ret = ath_add_led(sc, led); -+ if (ret < 0) -+ kfree(led); -+ -+ return ret; -+} -+ - void ath_deinit_leds(struct ath_softc *sc) - { - struct ath_led *led; -@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s - - void ath_init_leds(struct ath_softc *sc) - { -+ struct ath9k_platform_data *pdata = sc->dev->platform_data; - char led_name[32]; - const char *trigger; -+ int i; - - INIT_LIST_HEAD(&sc->leds); - -@@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc) - - 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 (sc->sc_ah->led_pin < 0) -+ return; -+ - snprintf(led_name, sizeof(led_name), "ath9k-%s", - wiphy_name(sc->hw->wiphy)); - diff --git a/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch index 5d84cf0c423..d633c051b0d 100644 --- a/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch +++ b/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch @@ -13,7 +13,7 @@ Signed-off-by: Michal Cieslakiewicz --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc +@@ -73,8 +73,11 @@ static int ath_add_led(struct ath_softc ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index 9696ea5c883..288948c8386 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -32,9 +32,9 @@ Signed-off-by: Felix Fietkau #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -17,12 +17,120 @@ +@@ -16,12 +16,120 @@ + #include "ath9k.h" - #include +#ifdef CPTCFG_MAC80211_LEDS + @@ -155,7 +155,7 @@ Signed-off-by: Felix Fietkau static void ath_fill_led_pin(struct ath_softc *sc) { struct ath_hw *ah = sc->sc_ah; -@@ -80,6 +188,12 @@ static int ath_add_led(struct ath_softc +@@ -79,6 +187,12 @@ static int ath_add_led(struct ath_softc else ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); @@ -168,7 +168,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -136,17 +250,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -117,16 +231,23 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); @@ -188,12 +188,11 @@ Signed-off-by: Felix Fietkau void ath_init_leds(struct ath_softc *sc) { - struct ath9k_platform_data *pdata = sc->dev->platform_data; + struct device_node *np = sc->dev->of_node; char led_name[32]; const char *trigger; - int i; -@@ -156,6 +277,15 @@ void ath_init_leds(struct ath_softc *sc) + +@@ -135,6 +256,15 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; @@ -208,4 +207,4 @@ Signed-off-by: Felix Fietkau + ath_fill_led_pin(sc); - if (pdata && pdata->leds && pdata->num_leds) + snprintf(led_name, sizeof(led_name), "ath9k-%s", diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 83f7a146e3c..5a8c057b318 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -20,16 +20,17 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -16,6 +16,8 @@ +@@ -15,6 +15,9 @@ + */ #include "ath9k.h" - #include ++#include +#include +#include #ifdef CPTCFG_MAC80211_LEDS -@@ -115,6 +117,67 @@ static void ath9k_unregister_gpio_chip(s +@@ -114,6 +117,67 @@ static void ath9k_unregister_gpio_chip(s kfree(gc); } @@ -97,7 +98,7 @@ Signed-off-by: Felix Fietkau #else /* CONFIG_GPIOLIB */ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) -@@ -125,6 +188,14 @@ static inline void ath9k_unregister_gpio +@@ -124,6 +188,14 @@ static inline void ath9k_unregister_gpio { } @@ -112,7 +113,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -248,6 +319,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -229,6 +301,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,11 +121,11 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -287,6 +359,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -266,6 +339,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); + ath9k_init_buttons(sc); - if (pdata && pdata->leds && pdata->num_leds) - for (i = 0; i < pdata->num_leds; i++) { + snprintf(led_name, sizeof(led_name), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h index e210108568a..c4389b7e6cb 100644 --- a/target/linux/generic/files/include/linux/ath9k_platform.h +++ b/target/linux/generic/files/include/linux/ath9k_platform.h @@ -47,9 +47,6 @@ struct ath9k_platform_data { bool use_eeprom; - int num_leds; - const struct gpio_led *leds; - unsigned num_btns; const struct gpio_keys_button *btns; unsigned btn_poll_interval;