mac80211: replace 800-nuke_led_code.patch with something smaller. most of the #ifdef spaghetti that the old patch introduced was completely unnecessary

SVN-Revision: 22866
lede-17.01
Felix Fietkau 2010-08-31 23:34:27 +00:00
parent 2f014eb8e8
commit 003ec7d795
2 changed files with 127 additions and 415 deletions

View File

@ -0,0 +1,127 @@
--- a/config.mk
+++ b/config.mk
@@ -115,7 +115,7 @@ CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstr
# CONFIG_MAC80211_RC_PID=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_MINSTREL_HT=y
-CONFIG_MAC80211_LEDS=y
+# CONFIG_MAC80211_LEDS=y
# enable mesh networking too
CONFIG_MAC80211_MESH=y
@@ -218,7 +218,7 @@ CONFIG_B43_PCI_AUTOSELECT=y
ifneq ($(CONFIG_PCMCIA),)
# CONFIG_B43_PCMCIA=y
endif
-CONFIG_B43_LEDS=y
+# CONFIG_B43_LEDS=y
CONFIG_B43_PHY_LP=y
# CONFIG_B43_NPHY is not set
# CONFIG_B43_FORCE_PIO=y
@@ -227,7 +227,7 @@ CONFIG_B43_PHY_LP=y
CONFIG_B43LEGACY=m
CONFIG_B43LEGACY_HWRNG=y
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
-CONFIG_B43LEGACY_LEDS=y
+# CONFIG_B43LEGACY_LEDS=y
# CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
CONFIG_B43LEGACY_PIO=y
@@ -499,7 +499,7 @@ endif
# p54
CONFIG_P54_COMMON=m
-CONFIG_P54_LEDS=y
+# CONFIG_P54_LEDS=y
# Atheros
CONFIG_ATH_COMMON=m
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -54,6 +54,7 @@ static void ath_led_blink_work(struct wo
sc->sc_flags |= SC_OP_LED_ON;
}
+#ifdef CONFIG_LEDS_CLASS
static void ath_led_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
@@ -90,10 +91,12 @@ static void ath_led_brightness(struct le
break;
}
}
+#endif
static int ath_register_led(struct ath_softc *sc, struct ath_led *led,
char *trigger)
{
+#ifdef CONFIG_LEDS_CLASS
int ret;
led->sc = sc;
@@ -108,14 +111,19 @@ static int ath_register_led(struct ath_s
else
led->registered = 1;
return ret;
+#else
+ return 0;
+#endif
}
static void ath_unregister_led(struct ath_led *led)
{
+#ifdef CONFIG_LEDS_CLASS
if (led->registered) {
led_classdev_unregister(&led->led_cdev);
led->registered = 0;
}
+#endif
}
void ath_deinit_leds(struct ath_softc *sc)
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -872,6 +872,7 @@ static void ath9k_led_brightness_work(st
}
}
+#ifdef CONFIG_LEDS_CLASS
static void ath9k_led_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
@@ -883,6 +884,7 @@ static void ath9k_led_brightness(struct
ieee80211_queue_delayed_work(priv->hw,
&led->brightness_work, 0);
}
+#endif
static void ath9k_led_stop_brightness(struct ath9k_htc_priv *priv)
{
@@ -895,6 +897,7 @@ static void ath9k_led_stop_brightness(st
static int ath9k_register_led(struct ath9k_htc_priv *priv, struct ath_led *led,
char *trigger)
{
+#ifdef CONFIG_LEDS_CLASS
int ret;
led->priv = priv;
@@ -912,14 +915,19 @@ static int ath9k_register_led(struct ath
INIT_DELAYED_WORK(&led->brightness_work, ath9k_led_brightness_work);
return ret;
+#else
+ return 0;
+#endif
}
static void ath9k_unregister_led(struct ath_led *led)
{
+#ifdef CONFIG_LEDS_CLASS
if (led->registered) {
led_classdev_unregister(&led->led_cdev);
led->registered = 0;
}
+#endif
}
void ath9k_deinit_leds(struct ath9k_htc_priv *priv)

View File

@ -1,415 +0,0 @@
---
config.mk | 14 +++++++-------
drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++++
drivers/net/wireless/ath/ath9k/gpio.c | 2 ++
drivers/net/wireless/ath/ath9k/init.c | 6 ++++++
drivers/net/wireless/ath/ath9k/main.c | 6 ++++++
drivers/net/wireless/ath/ath9k/pci.c | 4 ++++
include/linux/compat-2.6.25.h | 2 ++
net/mac80211/iface.c | 4 ++++
net/mac80211/main.c | 8 ++++++++
net/mac80211/mlme.c | 6 ++++++
net/mac80211/pm.c | 2 ++
net/mac80211/rx.c | 4 ++++
net/mac80211/status.c | 4 ++++
net/mac80211/tx.c | 4 ++++
net/mac80211/util.c | 6 ++++++
15 files changed, 69 insertions(+), 7 deletions(-)
--- a/config.mk
+++ b/config.mk
@@ -115,7 +115,7 @@ CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstr
# CONFIG_MAC80211_RC_PID=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_MINSTREL_HT=y
-CONFIG_MAC80211_LEDS=y
+# CONFIG_MAC80211_LEDS=y
# enable mesh networking too
CONFIG_MAC80211_MESH=y
@@ -218,7 +218,7 @@ CONFIG_B43_PCI_AUTOSELECT=y
ifneq ($(CONFIG_PCMCIA),)
# CONFIG_B43_PCMCIA=y
endif
-CONFIG_B43_LEDS=y
+# CONFIG_B43_LEDS=y
CONFIG_B43_PHY_LP=y
# CONFIG_B43_NPHY is not set
# CONFIG_B43_FORCE_PIO=y
@@ -227,7 +227,7 @@ CONFIG_B43_PHY_LP=y
CONFIG_B43LEGACY=m
CONFIG_B43LEGACY_HWRNG=y
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
-CONFIG_B43LEGACY_LEDS=y
+# CONFIG_B43LEGACY_LEDS=y
# CONFIG_B43LEGACY_DEBUG=y
CONFIG_B43LEGACY_DMA=y
CONFIG_B43LEGACY_PIO=y
@@ -499,7 +499,7 @@ endif
# p54
CONFIG_P54_COMMON=m
-CONFIG_P54_LEDS=y
+# CONFIG_P54_LEDS=y
# Atheros
CONFIG_ATH_COMMON=m
--- a/include/linux/compat-2.6.25.h
+++ b/include/linux/compat-2.6.25.h
@@ -148,10 +148,12 @@ static inline void __hwrng_unregister(st
hwrng_unregister(rng);
}
+#ifdef CONFIG_MAC80211_LEDS
static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
{
led_classdev_unregister(lcd);
}
+#endif
/**
* The following things are out of ./include/linux/kernel.h
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -20,6 +20,7 @@
/* LED functions */
/********************************/
+#ifdef CONFIG_MAC80211_LEDS
static void ath_led_blink_work(struct work_struct *work)
{
struct ath_softc *sc = container_of(work, struct ath_softc,
@@ -194,6 +195,7 @@ fail:
cancel_delayed_work_sync(&sc->ath_led_blink_work);
ath_deinit_leds(sc);
}
+#endif
/*******************/
/* Rfkill */
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -273,7 +273,9 @@ static int ath_pci_suspend(struct pci_de
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
+#ifdef CONFIG_MAC80211_LEDS
ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
+#endif
pci_save_state(pdev);
pci_disable_device(pdev);
@@ -305,10 +307,12 @@ static int ath_pci_resume(struct pci_dev
if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
+#ifdef CONFIG_MAC80211_LEDS
/* Enable LED */
ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin,
AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
+#endif
return 0;
}
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -457,6 +457,7 @@ void ath9k_btcoex_timer_pause(struct ath
/********************/
/* LED Control */
/********************/
+#ifdef CONFIG_MAC80211_LEDS
#define ATH_LED_PIN_DEF 1
#define ATH_LED_PIN_9287 8
@@ -481,6 +482,7 @@ struct ath_led {
void ath_init_leds(struct ath_softc *sc);
void ath_deinit_leds(struct ath_softc *sc);
+#endif
/********************/
/* Main driver core */
@@ -578,6 +580,7 @@ struct ath_softc {
enum wireless_mode cur_rate_mode;
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+#ifdef CONFIG_MAC80211_LEDS
struct ath_led radio_led;
struct ath_led assoc_led;
struct ath_led tx_led;
@@ -587,6 +590,7 @@ struct ath_softc {
int led_off_duration;
int led_on_cnt;
int led_off_cnt;
+#endif
int beacon_interval;
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -757,7 +757,9 @@ int ath9k_init_device(u16 devid, struct
INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
sc->wiphy_scheduler_int = msecs_to_jiffies(500);
+#ifdef CONFIG_MAC80211_LEDS
ath_init_leds(sc);
+#endif
ath_start_rfkill_poll(sc);
return 0;
@@ -810,7 +812,9 @@ void ath9k_deinit_device(struct ath_soft
ath9k_ps_wakeup(sc);
wiphy_rfkill_stop_polling(sc->hw->wiphy);
+#ifdef CONFIG_MAC80211_LEDS
ath_deinit_leds(sc);
+#endif
for (i = 0; i < sc->num_sec_wiphy; i++) {
struct ath_wiphy *aphy = sc->sec_wiphy[i];
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -869,9 +869,11 @@ void ath_radio_enable(struct ath_softc *
ath9k_hw_set_interrupts(ah, ah->imask);
/* Enable LED */
+#ifdef CONFIG_MAC80211_LEDS
ath9k_hw_cfg_output(ah, ah->led_pin,
AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
ath9k_hw_set_gpio(ah, ah->led_pin, 0);
+#endif
ieee80211_wake_queues(hw);
ath9k_ps_restore(sc);
@@ -890,10 +892,12 @@ void ath_radio_disable(struct ath_softc
* Keep the LED on when the radio is disabled
* during idle unassociated state.
*/
+#ifdef CONFIG_MAC80211_LEDS
if (!sc->ps_idle) {
ath9k_hw_set_gpio(ah, ah->led_pin, 1);
ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
}
+#endif
/* Disable interrupts */
ath9k_hw_set_interrupts(ah, 0);
@@ -1304,8 +1308,10 @@ static void ath9k_stop(struct ieee80211_
aphy->state = ATH_WIPHY_INACTIVE;
+#ifdef CONFIG_MAC80211_LEDS
if (led_blink)
cancel_delayed_work_sync(&sc->ath_led_blink_work);
+#endif
cancel_delayed_work_sync(&sc->tx_complete_work);
cancel_work_sync(&sc->paprd_work);
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -21,7 +21,9 @@
#include "sta_info.h"
#include "debugfs_netdev.h"
#include "mesh.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
#include "driver-ops.h"
#include "wme.h"
@@ -201,7 +203,9 @@ static int ieee80211_do_open(struct net_
napi_enable(&local->napi);
/* we're brought up, everything changes */
hw_reconf_flags = ~0;
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_radio(local, true);
+#endif
}
/*
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -29,7 +29,9 @@
#include "rate.h"
#include "mesh.h"
#include "wep.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
#include "cfg.h"
#include "debugfs.h"
@@ -778,7 +780,9 @@ int ieee80211_register_hw(struct ieee802
rtnl_unlock();
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_init(local);
+#endif
local->network_latency_notifier.notifier_call =
ieee80211_max_network_latency;
@@ -808,7 +812,9 @@ int ieee80211_register_hw(struct ieee802
rtnl_lock();
#endif
fail_pm_qos:
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_exit(local);
+#endif
ieee80211_remove_interfaces(local);
fail_rate:
rtnl_unlock();
@@ -872,7 +878,9 @@ void ieee80211_unregister_hw(struct ieee
destroy_workqueue(local->workqueue);
wiphy_unregister(local->hw.wiphy);
ieee80211_wep_free(local);
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_exit(local);
+#endif
kfree(local->int_scan_req);
}
EXPORT_SYMBOL(ieee80211_unregister_hw);
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -26,7 +26,9 @@
#include "ieee80211_i.h"
#include "driver-ops.h"
#include "rate.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
#define IEEE80211_MAX_PROBE_TRIES 5
@@ -879,7 +881,9 @@ static void ieee80211_set_associated(str
*/
sdata->u.mgd.wmm_last_param_set = -1;
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_assoc(local, 1);
+#endif
if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD)
bss_conf->dtim_period = bss->dtim_period;
@@ -965,7 +969,9 @@ static void ieee80211_set_disassoc(struc
changed |= ieee80211_reset_erp_info(sdata);
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_assoc(local, 0);
+#endif
changed |= BSS_CHANGED_ASSOC;
sdata->vif.bss_conf.assoc = false;
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -4,7 +4,9 @@
#include "ieee80211_i.h"
#include "mesh.h"
#include "driver-ops.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
int __ieee80211_suspend(struct ieee80211_hw *hw)
{
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -21,7 +21,9 @@
#include "ieee80211_i.h"
#include "driver-ops.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
#include "mesh.h"
#include "wep.h"
#include "wpa.h"
@@ -1377,8 +1379,10 @@ ieee80211_rx_h_defragment(struct ieee802
rx->sta->rx_packets++;
if (is_multicast_ether_addr(hdr->addr1))
rx->local->dot11MulticastReceivedFrameCount++;
+#ifdef CONFIG_MAC80211_LEDS
else
ieee80211_led_rx(rx->local);
+#endif
return RX_CONTINUE;
}
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -13,7 +13,9 @@
#include "ieee80211_i.h"
#include "rate.h"
#include "mesh.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
@@ -246,7 +248,9 @@ void ieee80211_tx_status(struct ieee8021
rcu_read_unlock();
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_tx(local, 0);
+#endif
/* SNMP counters
* Fragments are passed to low-level drivers as separate skbs, so these
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -26,7 +26,9 @@
#include "ieee80211_i.h"
#include "driver-ops.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
#include "mesh.h"
#include "wep.h"
#include "wpa.h"
@@ -1334,7 +1336,9 @@ static int __ieee80211_tx(struct ieee802
}
*skbp = skb = next;
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_tx(local, 1);
+#endif
fragm = true;
}
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -29,7 +29,9 @@
#include "rate.h"
#include "mesh.h"
#include "wme.h"
+#ifdef CONFIG_MAC80211_LEDS
#include "led.h"
+#endif
#include "wep.h"
/* privid for wiphys to determine whether they belong to us or not */
@@ -1110,7 +1112,9 @@ u32 ieee80211_sta_get_rates(struct ieee8
void ieee80211_stop_device(struct ieee80211_local *local)
{
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_radio(local, false);
+#endif
cancel_work_sync(&local->reconfig_filter);
@@ -1144,7 +1148,9 @@ int ieee80211_reconfig(struct ieee80211_
return res;
}
+#ifdef CONFIG_MAC80211_LEDS
ieee80211_led_radio(local, true);
+#endif
}
/* add interfaces */