]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rt2x00: Streamline rt2800 eeprom initialisations.
authorGertjan van Wingerde <gwingerde@gmail.com>
Sat, 30 Apr 2011 15:15:13 +0000 (17:15 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 2 May 2011 18:49:17 +0000 (14:49 -0400)
In rt2800lib.c the rt2800_init_eeprom function the same eeprom
words were read multiple times, due to inefficient ordering of the
eeprom checks.

Reorder the checks so that each EEPROM word only has to be read once.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c

index d79c8fd41138aef72ca9bcde4601cd0d044acd7b..71c16c618c4d145bb317f20729c5b9b94abae661 100644 (file)
@@ -3727,16 +3727,8 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
        }
 
        /*
-        * Read frequency offset and RF programming sequence.
+        * Determine external LNA informations.
         */
-       rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
-       rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
-
-       /*
-        * Read external LNA informations.
-        */
-       rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom);
-
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G))
                __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags);
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G))
@@ -3748,6 +3740,12 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
        if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO))
                __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
 
+       /*
+        * Read frequency offset and RF programming sequence.
+        */
+       rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom);
+       rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET);
+
        /*
         * Store led settings, for correct led behaviour.
         */
@@ -3756,7 +3754,7 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
        rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
        rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
 
-       rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &rt2x00dev->led_mcu_reg);
+       rt2x00dev->led_mcu_reg = eeprom;
 #endif /* CONFIG_RT2X00_LIB_LEDS */
 
        /*