ath9k: fix antenna gain calculation
authorFelix Fietkau <nbd@openwrt.org>
Tue, 20 Sep 2011 10:42:45 +0000 (10:42 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 20 Sep 2011 10:42:45 +0000 (10:42 +0000)
SVN-Revision: 28261

package/mac80211/patches/581-ath9k_cleanup_txpower_handling.patch

index 4978ba1302a4f0eff6675d03c74d87a0c9deced4..029ce3d7af76da97a1e9da93beb79c30add859f4 100644 (file)
 +      channel = chan->chan;
 +      chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
 +      new_pwr = min_t(int, chan_pwr, reg->power_limit);
-+      max_gain = new_pwr - chan_pwr + channel->max_antenna_gain * 2;
++      max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
 +
 +      ant_gain = get_antenna_gain(ah, chan);
 +      if (ant_gain > max_gain)
 -      int reg_pwr = min_t(int, MAX_RATE_POWER, limit);
 -      int chan_pwr = channel->max_power * 2;
  
-+      reg->power_limit = min_t(int, limit * 2, MAX_RATE_POWER);
++      reg->power_limit = min_t(int, limit, MAX_RATE_POWER);
        if (test)
 -              reg_pwr = chan_pwr = MAX_RATE_POWER;
 +              channel->max_power = MAX_RATE_POWER / 2;