aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2012-07-24 02:35:39 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-25 10:11:12 -0400
commit5e31fc0815a4e2c72b1b495fe7a0d8f9bfb9e4b4 (patch)
tree604c118db641c5787baeaa0aaa24bb8f9b2e35fa
parent3aa569c3fedbd0d16041d08bf6e89b8c43aee650 (diff)
wireless: reg: restore previous behaviour of chan->max_power calculations
commit eccc068e8e84c8fe997115629925e0422a98e4de Author: Hong Wu <Hong.Wu@dspg.com> Date: Wed Jan 11 20:33:39 2012 +0200 wireless: Save original maximum regulatory transmission power for the calucation of the local maximum transmit pow changed the way we calculate chan->max_power as min(chan->max_power, chan->max_reg_power). That broke rt2x00 (and perhaps some other drivers) that do not set chan->max_power. It is not so easy to fix this problem correctly in rt2x00. According to commit eccc068e8 changelog, change claim only to save maximum regulatory power - changing setting of chan->max_power was side effect. This patch restore previous calculations of chan->max_power and do not touch chan->max_reg_power. Cc: stable@vger.kernel.org # 3.4+ Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/wireless/reg.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index baf5704740ee..460af03d8149 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -891,7 +891,21 @@ static void handle_channel(struct wiphy *wiphy,
891 chan->max_antenna_gain = min(chan->orig_mag, 891 chan->max_antenna_gain = min(chan->orig_mag,
892 (int) MBI_TO_DBI(power_rule->max_antenna_gain)); 892 (int) MBI_TO_DBI(power_rule->max_antenna_gain));
893 chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp); 893 chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
894 chan->max_power = min(chan->max_power, chan->max_reg_power); 894 if (chan->orig_mpwr) {
895 /*
896 * Devices that have their own custom regulatory domain
897 * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the
898 * passed country IE power settings.
899 */
900 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
901 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY &&
902 wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
903 chan->max_power = chan->max_reg_power;
904 else
905 chan->max_power = min(chan->orig_mpwr,
906 chan->max_reg_power);
907 } else
908 chan->max_power = chan->max_reg_power;
895} 909}
896 910
897static void handle_band(struct wiphy *wiphy, 911static void handle_band(struct wiphy *wiphy,