rt2x00: Fix quality/activity led handling
authorIvo van Doorn <ivdoorn@gmail.com>
Mon, 21 Apr 2008 17:01:09 +0000 (19:01 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 1 May 2008 21:38:39 +0000 (17:38 -0400)
There was an obvious typo in LED structure
initialization which caused the radio and quality/activity
leds to be incorrectly initialized which resulted in
the leds not being enabled.

Additionally add the rt2x00led_led_activity() handler
that will enable TX/RX activity leds when the radio
is being enabled.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00leds.c
drivers/net/wireless/rt2x00/rt2x00lib.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 18e599e2402090f6b526f43d2017e215cf40d9a4..560b9c73c0b9bcd41e1c0698818be95b59445084 100644 (file)
@@ -1308,7 +1308,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 
        if (value == LED_MODE_TXRX_ACTIVITY) {
                rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
-               rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY;
+               rt2x00dev->led_qual.type = LED_TYPE_ACTIVITY;
                rt2x00dev->led_qual.led_dev.brightness_set =
                    rt2400pci_brightness_set;
                rt2x00dev->led_qual.led_dev.blink_set =
index c54ea5afd51a2c3bff4bb2bd373f232886628d24..a5ed54b69262f8f6b167ebf87d6613b9c4319ec0 100644 (file)
@@ -1485,7 +1485,7 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 
        if (value == LED_MODE_TXRX_ACTIVITY) {
                rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
-               rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY;
+               rt2x00dev->led_qual.type = LED_TYPE_ACTIVITY;
                rt2x00dev->led_qual.led_dev.brightness_set =
                    rt2500pci_brightness_set;
                rt2x00dev->led_qual.led_dev.blink_set =
index 6bb07b339325ecdc36895f57735edad50a422fd0..fdbd0ef2be4bceef492431262796e6466a11e0b8 100644 (file)
@@ -1394,7 +1394,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 
        if (value == LED_MODE_TXRX_ACTIVITY) {
                rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
-               rt2x00dev->led_radio.type = LED_TYPE_ACTIVITY;
+               rt2x00dev->led_qual.type = LED_TYPE_ACTIVITY;
                rt2x00dev->led_qual.led_dev.brightness_set =
                    rt2500usb_brightness_set;
                rt2x00dev->led_qual.led_dev.blink_set =
index f8fe7a139a8a540ef0f517ff85efe8aad494c999..8d8657fb64dd4517de49b1d9adf74d5b8ec28dcb 100644 (file)
@@ -114,6 +114,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
                return status;
 
        rt2x00leds_led_radio(rt2x00dev, true);
+       rt2x00led_led_activity(rt2x00dev, true);
 
        __set_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags);
 
@@ -157,6 +158,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
         * Disable radio.
         */
        rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_OFF);
+       rt2x00led_led_activity(rt2x00dev, false);
        rt2x00leds_led_radio(rt2x00dev, false);
 }
 
index 40c1f5c1b80555ee5ee0868a0ebdb65926fa55f5..b362a1cf3f8dcac64d0de1e34b4cb956a73c0312 100644 (file)
@@ -72,6 +72,21 @@ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
        }
 }
 
+void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled)
+{
+       struct rt2x00_led *led = &rt2x00dev->led_qual;
+       unsigned int brightness;
+
+       if ((led->type != LED_TYPE_ACTIVITY) || !(led->flags & LED_REGISTERED))
+               return;
+
+       brightness = enabled ? LED_FULL : LED_OFF;
+       if (brightness != led->led_dev.brightness) {
+               led->led_dev.brightness_set(&led->led_dev, brightness);
+               led->led_dev.brightness = brightness;
+       }
+}
+
 void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled)
 {
        struct rt2x00_led *led = &rt2x00dev->led_assoc;
index 5be32fffc74c8229283e64971dc433f8cf88f167..41ee02cd28252fe98bfe825fd37e0ee5db4ba0af 100644 (file)
@@ -185,6 +185,7 @@ static inline void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev)
  */
 #ifdef CONFIG_RT2X00_LIB_LEDS
 void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi);
+void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled);
 void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled);
 void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled);
 void rt2x00leds_register(struct rt2x00_dev *rt2x00dev);
@@ -197,6 +198,11 @@ static inline void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev,
 {
 }
 
+static inline void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev,
+                                         bool enabled)
+{
+}
+
 static inline void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev,
                                        bool enabled)
 {
index 468a31c8c113ff9fd0ae75a7556547cfbcf57a84..ae12dcdd3c24f60df4d1bdc0bd97f011e43caa42 100644 (file)
@@ -2087,7 +2087,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 
        if (value == LED_MODE_SIGNAL_STRENGTH) {
                rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
-               rt2x00dev->led_radio.type = LED_TYPE_QUALITY;
+               rt2x00dev->led_qual.type = LED_TYPE_QUALITY;
                rt2x00dev->led_qual.led_dev.brightness_set =
                    rt61pci_brightness_set;
                rt2x00dev->led_qual.led_dev.blink_set =
index a9efe25f1ea71980a33fbf4631b4c57cb443a9a6..da19a3a91f4d3909fd21d732a5f833862b6bdb10 100644 (file)
@@ -1647,7 +1647,7 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 
        if (value == LED_MODE_SIGNAL_STRENGTH) {
                rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
-               rt2x00dev->led_radio.type = LED_TYPE_QUALITY;
+               rt2x00dev->led_qual.type = LED_TYPE_QUALITY;
                rt2x00dev->led_qual.led_dev.brightness_set =
                    rt73usb_brightness_set;
                rt2x00dev->led_qual.led_dev.blink_set =