rt2x00: read 5GHz TX power values from the correct offset
authorGabor Juhos <juhosg@openwrt.org>
Sat, 22 Jun 2013 11:13:25 +0000 (13:13 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 24 Jun 2013 18:44:25 +0000 (14:44 -0400)
The current code uses the same index value both
for the channel information array and for the TX
power table. The index starts from 14, however the
index of the TX power table must start from zero.

Fix it, in order to get the correct TX power value
for a given channel.

The changes in rt61pci.c and rt73usb.c are compile
tested only.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Cc: stable@vger.kernel.org
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 3aa30ddcbfea1095887b837dafbb3f03f2a912c5..4072242b24528ef32327010389ef09816f6b2f47 100644 (file)
@@ -6254,8 +6254,8 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
                default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2);
 
                for (i = 14; i < spec->num_channels; i++) {
-                       info[i].default_power1 = default_power1[i];
-                       info[i].default_power2 = default_power2[i];
+                       info[i].default_power1 = default_power1[i - 14];
+                       info[i].default_power2 = default_power2[i - 14];
                }
        }
 
index 53754bc66d051500ec62ab2fbc9c1b50d199ff2c..54d3ddfc988845cfa844b5c1d76c6a78ec62e4de 100644 (file)
@@ -2825,7 +2825,8 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
                tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
                for (i = 14; i < spec->num_channels; i++) {
                        info[i].max_power = MAX_TXPOWER;
-                       info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
+                       info[i].default_power1 =
+                                       TXPOWER_FROM_DEV(tx_power[i - 14]);
                }
        }
 
index 1616ed484ceb02c928be16eaa06f72fe76b60dd8..1d3880e09a13eabb73e93c77b7af948ca12421f8 100644 (file)
@@ -2167,7 +2167,8 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
                tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START);
                for (i = 14; i < spec->num_channels; i++) {
                        info[i].max_power = MAX_TXPOWER;
-                       info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]);
+                       info[i].default_power1 =
+                                       TXPOWER_FROM_DEV(tx_power[i - 14]);
                }
        }
 
This page took 0.033694 seconds and 5 git commands to generate.