aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wext.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r--net/mac80211/wext.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 31d2e74a1bc0..231cab57351f 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -656,6 +656,7 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
656 union iwreq_data *data, char *extra) 656 union iwreq_data *data, char *extra)
657{ 657{
658 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 658 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
659 struct ieee80211_channel* chan = local->hw.conf.channel;
659 u32 reconf_flags = 0; 660 u32 reconf_flags = 0;
660 int new_power_level; 661 int new_power_level;
661 662
@@ -663,20 +664,13 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
663 return -EINVAL; 664 return -EINVAL;
664 if (data->txpower.flags & IW_TXPOW_RANGE) 665 if (data->txpower.flags & IW_TXPOW_RANGE)
665 return -EINVAL; 666 return -EINVAL;
667 if (!chan)
668 return -EINVAL;
666 669
667 if (data->txpower.fixed) { 670 if (data->txpower.fixed)
668 new_power_level = data->txpower.value; 671 new_power_level = min(data->txpower.value, chan->max_power);
669 } else { 672 else /* Automatic power level setting */
670 /*
671 * Automatic power level. Use maximum power for the current
672 * channel. Should be part of rate control.
673 */
674 struct ieee80211_channel* chan = local->hw.conf.channel;
675 if (!chan)
676 return -EINVAL;
677
678 new_power_level = chan->max_power; 673 new_power_level = chan->max_power;
679 }
680 674
681 if (local->hw.conf.power_level != new_power_level) { 675 if (local->hw.conf.power_level != new_power_level) {
682 local->hw.conf.power_level = new_power_level; 676 local->hw.conf.power_level = new_power_level;