diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-06-23 05:12:37 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-24 15:42:33 -0400 |
commit | fa61cf70a6ae1089e459e4b59b2e8d8e90d8535e (patch) | |
tree | 1bd81709faaa15fb207de7db4df1ceed96374208 /net/mac80211/cfg.c | |
parent | a185045c8da1ec6627236b4ade0d949b15da43b3 (diff) |
cfg80211/mac80211: Update set_tx_power to use mBm instead of dBm units
In preparation for a TX power setting interface in the nl80211, change the
.set_tx_power function to use mBm units instead of dBm for greater accuracy and
smaller power levels.
Also, already in advance move the tx_power_setting enumeration to nl80211.
This change affects the .tx_set_power function prototype. As a result, the
corresponding changes are needed to modules using it. These are mac80211,
iwmc3200wifi and rndis_wlan.
Cc: Samuel Ortiz <samuel.ortiz@intel.com>
Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Acked-by: Samuel Ortiz <samuel.ortiz@intel.com>
Acked-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 003b6addf5fa..f4efbfa4f237 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1329,28 +1329,28 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |||
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | static int ieee80211_set_tx_power(struct wiphy *wiphy, | 1331 | static int ieee80211_set_tx_power(struct wiphy *wiphy, |
1332 | enum tx_power_setting type, int dbm) | 1332 | enum nl80211_tx_power_setting type, int mbm) |
1333 | { | 1333 | { |
1334 | struct ieee80211_local *local = wiphy_priv(wiphy); | 1334 | struct ieee80211_local *local = wiphy_priv(wiphy); |
1335 | struct ieee80211_channel *chan = local->hw.conf.channel; | 1335 | struct ieee80211_channel *chan = local->hw.conf.channel; |
1336 | u32 changes = 0; | 1336 | u32 changes = 0; |
1337 | 1337 | ||
1338 | switch (type) { | 1338 | switch (type) { |
1339 | case TX_POWER_AUTOMATIC: | 1339 | case NL80211_TX_POWER_AUTOMATIC: |
1340 | local->user_power_level = -1; | 1340 | local->user_power_level = -1; |
1341 | break; | 1341 | break; |
1342 | case TX_POWER_LIMITED: | 1342 | case NL80211_TX_POWER_LIMITED: |
1343 | if (dbm < 0) | 1343 | if (mbm < 0 || (mbm % 100)) |
1344 | return -EINVAL; | 1344 | return -EOPNOTSUPP; |
1345 | local->user_power_level = dbm; | 1345 | local->user_power_level = MBM_TO_DBM(mbm); |
1346 | break; | 1346 | break; |
1347 | case TX_POWER_FIXED: | 1347 | case NL80211_TX_POWER_FIXED: |
1348 | if (dbm < 0) | 1348 | if (mbm < 0 || (mbm % 100)) |
1349 | return -EINVAL; | 1349 | return -EOPNOTSUPP; |
1350 | /* TODO: move to cfg80211 when it knows the channel */ | 1350 | /* TODO: move to cfg80211 when it knows the channel */ |
1351 | if (dbm > chan->max_power) | 1351 | if (MBM_TO_DBM(mbm) > chan->max_power) |
1352 | return -EINVAL; | 1352 | return -EINVAL; |
1353 | local->user_power_level = dbm; | 1353 | local->user_power_level = MBM_TO_DBM(mbm); |
1354 | break; | 1354 | break; |
1355 | } | 1355 | } |
1356 | 1356 | ||