add updated mac80211 - this no longer relies on patching includes in the kernel trees...
[openwrt/svn-archive/archive.git] / package / mac80211 / src / mac80211 / ieee80211_led.c
index 719d75b207073f1224322f7e14b3083b9346c323..4cf89af9d1009ffc528622d2e0f64a550c4614d4 100644 (file)
@@ -33,33 +33,58 @@ void ieee80211_led_tx(struct ieee80211_local *local, int q)
                led_trigger_event(local->tx_led, LED_FULL);
 }
 
+void ieee80211_led_assoc(struct ieee80211_local *local, bool associated)
+{
+       if (unlikely(!local->assoc_led))
+               return;
+       if (associated)
+               led_trigger_event(local->assoc_led, LED_FULL);
+       else
+               led_trigger_event(local->assoc_led, LED_OFF);
+}
+
 void ieee80211_led_init(struct ieee80211_local *local)
 {
        local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
-       if (!local->rx_led)
-               return;
-       snprintf(local->rx_led_name, sizeof(local->rx_led_name),
-                "%srx", wiphy_name(local->hw.wiphy));
-       local->rx_led->name = local->rx_led_name;
-       if (led_trigger_register(local->rx_led)) {
-               kfree(local->rx_led);
-               local->rx_led = NULL;
+       if (local->rx_led) {
+               snprintf(local->rx_led_name, sizeof(local->rx_led_name),
+                        "%srx", wiphy_name(local->hw.wiphy));
+               local->rx_led->name = local->rx_led_name;
+               if (led_trigger_register(local->rx_led)) {
+                       kfree(local->rx_led);
+                       local->rx_led = NULL;
+               }
        }
 
        local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
-       if (!local->tx_led)
-               return;
-       snprintf(local->tx_led_name, sizeof(local->tx_led_name),
-                "%stx", wiphy_name(local->hw.wiphy));
-       local->tx_led->name = local->tx_led_name;
-       if (led_trigger_register(local->tx_led)) {
-               kfree(local->tx_led);
-               local->tx_led = NULL;
+       if (local->tx_led) {
+               snprintf(local->tx_led_name, sizeof(local->tx_led_name),
+                        "%stx", wiphy_name(local->hw.wiphy));
+               local->tx_led->name = local->tx_led_name;
+               if (led_trigger_register(local->tx_led)) {
+                       kfree(local->tx_led);
+                       local->tx_led = NULL;
+               }
+       }
+
+       local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
+       if (local->assoc_led) {
+               snprintf(local->assoc_led_name, sizeof(local->assoc_led_name),
+                        "%sassoc", wiphy_name(local->hw.wiphy));
+               local->assoc_led->name = local->assoc_led_name;
+               if (led_trigger_register(local->assoc_led)) {
+                       kfree(local->assoc_led);
+                       local->assoc_led = NULL;
+               }
        }
 }
 
 void ieee80211_led_exit(struct ieee80211_local *local)
 {
+       if (local->assoc_led) {
+               led_trigger_unregister(local->assoc_led);
+               kfree(local->assoc_led);
+       }
        if (local->tx_led) {
                led_trigger_unregister(local->tx_led);
                kfree(local->tx_led);
@@ -70,6 +95,16 @@ void ieee80211_led_exit(struct ieee80211_local *local)
        }
 }
 
+char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+
+       if (local->assoc_led)
+               return local->assoc_led_name;
+       return NULL;
+}
+EXPORT_SYMBOL(__ieee80211_get_assoc_led_name);
+
 char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
 {
        struct ieee80211_local *local = hw_to_local(hw);