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 <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17445
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Rosen Penev 2024-12-31 14:09:44 -08:00 committed by Robert Marko
parent e78dc2eae4
commit baf73daaac
5 changed files with 17 additions and 84 deletions

View File

@ -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 <linux/ath9k_platform.h>
/********************************/
/* 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));

View File

@ -13,7 +13,7 @@ Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
--- 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);

View File

@ -32,9 +32,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#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 <linux/ath9k_platform.h>
+#ifdef CPTCFG_MAC80211_LEDS
+
@ -155,7 +155,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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 <nbd@nbd.name>
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 <nbd@nbd.name>
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 <nbd@nbd.name>
+
ath_fill_led_pin(sc);
if (pdata && pdata->leds && pdata->num_leds)
snprintf(led_name, sizeof(led_name), "ath9k-%s",

View File

@ -20,16 +20,17 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- 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 <linux/ath9k_platform.h>
+#include <linux/ath9k_platform.h>
+#include <linux/platform_device.h>
+#include <linux/gpio_keys.h>
#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 <nbd@nbd.name>
#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 <nbd@nbd.name>
#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 <nbd@nbd.name>
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));

View File

@ -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;