diff options
author | Meenakshi Venkataraman <meenakshi.venkataraman@intel.com> | 2012-03-13 21:10:19 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2012-04-12 17:22:41 -0400 |
commit | e6a62a6e5f352b8d6ffaa93e13a6ff7bdc7f07b2 (patch) | |
tree | 0dc302162effdffbdcd50f8770bf40443afc0acc /drivers/net/wireless | |
parent | 193219cf0f9fd687b53e18b8b8310d59b2d0ca2c (diff) |
iwlwifi: move iwl_set_tx_power and make it static
This function is used only in iwl-agn-rxon.c,
move it there and mark it static.
Move this function as part of iwl-core.c
cleanup.
Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 5 |
3 files changed, 55 insertions, 60 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c index 18776ab4414..d2da1f3130c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | |||
@@ -407,6 +407,61 @@ static int iwlagn_rxon_disconn(struct iwl_priv *priv, | |||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | static int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | ||
411 | { | ||
412 | int ret; | ||
413 | s8 prev_tx_power; | ||
414 | bool defer; | ||
415 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
416 | |||
417 | lockdep_assert_held(&priv->mutex); | ||
418 | |||
419 | if (priv->tx_power_user_lmt == tx_power && !force) | ||
420 | return 0; | ||
421 | |||
422 | if (tx_power < IWLAGN_TX_POWER_TARGET_POWER_MIN) { | ||
423 | IWL_WARN(priv, | ||
424 | "Requested user TXPOWER %d below lower limit %d.\n", | ||
425 | tx_power, | ||
426 | IWLAGN_TX_POWER_TARGET_POWER_MIN); | ||
427 | return -EINVAL; | ||
428 | } | ||
429 | |||
430 | if (tx_power > priv->tx_power_device_lmt) { | ||
431 | IWL_WARN(priv, | ||
432 | "Requested user TXPOWER %d above upper limit %d.\n", | ||
433 | tx_power, priv->tx_power_device_lmt); | ||
434 | return -EINVAL; | ||
435 | } | ||
436 | |||
437 | if (!iwl_is_ready_rf(priv)) | ||
438 | return -EIO; | ||
439 | |||
440 | /* scan complete and commit_rxon use tx_power_next value, | ||
441 | * it always need to be updated for newest request */ | ||
442 | priv->tx_power_next = tx_power; | ||
443 | |||
444 | /* do not set tx power when scanning or channel changing */ | ||
445 | defer = test_bit(STATUS_SCANNING, &priv->status) || | ||
446 | memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); | ||
447 | if (defer && !force) { | ||
448 | IWL_DEBUG_INFO(priv, "Deferring tx power set\n"); | ||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | prev_tx_power = priv->tx_power_user_lmt; | ||
453 | priv->tx_power_user_lmt = tx_power; | ||
454 | |||
455 | ret = iwlagn_send_tx_power(priv); | ||
456 | |||
457 | /* if fail to set tx_power, restore the orig. tx power */ | ||
458 | if (ret) { | ||
459 | priv->tx_power_user_lmt = prev_tx_power; | ||
460 | priv->tx_power_next = prev_tx_power; | ||
461 | } | ||
462 | return ret; | ||
463 | } | ||
464 | |||
410 | static int iwlagn_rxon_connect(struct iwl_priv *priv, | 465 | static int iwlagn_rxon_connect(struct iwl_priv *priv, |
411 | struct iwl_rxon_context *ctx) | 466 | struct iwl_rxon_context *ctx) |
412 | { | 467 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 42789ed6e49..3bd47e726dc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -66,61 +66,6 @@ void iwl_print_rx_config_cmd(struct iwl_priv *priv, | |||
66 | } | 66 | } |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | ||
70 | { | ||
71 | int ret; | ||
72 | s8 prev_tx_power; | ||
73 | bool defer; | ||
74 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
75 | |||
76 | lockdep_assert_held(&priv->mutex); | ||
77 | |||
78 | if (priv->tx_power_user_lmt == tx_power && !force) | ||
79 | return 0; | ||
80 | |||
81 | if (tx_power < IWLAGN_TX_POWER_TARGET_POWER_MIN) { | ||
82 | IWL_WARN(priv, | ||
83 | "Requested user TXPOWER %d below lower limit %d.\n", | ||
84 | tx_power, | ||
85 | IWLAGN_TX_POWER_TARGET_POWER_MIN); | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | |||
89 | if (tx_power > priv->tx_power_device_lmt) { | ||
90 | IWL_WARN(priv, | ||
91 | "Requested user TXPOWER %d above upper limit %d.\n", | ||
92 | tx_power, priv->tx_power_device_lmt); | ||
93 | return -EINVAL; | ||
94 | } | ||
95 | |||
96 | if (!iwl_is_ready_rf(priv)) | ||
97 | return -EIO; | ||
98 | |||
99 | /* scan complete and commit_rxon use tx_power_next value, | ||
100 | * it always need to be updated for newest request */ | ||
101 | priv->tx_power_next = tx_power; | ||
102 | |||
103 | /* do not set tx power when scanning or channel changing */ | ||
104 | defer = test_bit(STATUS_SCANNING, &priv->status) || | ||
105 | memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); | ||
106 | if (defer && !force) { | ||
107 | IWL_DEBUG_INFO(priv, "Deferring tx power set\n"); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | prev_tx_power = priv->tx_power_user_lmt; | ||
112 | priv->tx_power_user_lmt = tx_power; | ||
113 | |||
114 | ret = iwlagn_send_tx_power(priv); | ||
115 | |||
116 | /* if fail to set tx_power, restore the orig. tx power */ | ||
117 | if (ret) { | ||
118 | priv->tx_power_user_lmt = prev_tx_power; | ||
119 | priv->tx_power_next = prev_tx_power; | ||
120 | } | ||
121 | return ret; | ||
122 | } | ||
123 | |||
124 | void iwl_send_bt_config(struct iwl_priv *priv) | 69 | void iwl_send_bt_config(struct iwl_priv *priv) |
125 | { | 70 | { |
126 | struct iwl_bt_cmd bt_cmd = { | 71 | struct iwl_bt_cmd bt_cmd = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 81c287cc9af..fdd314f25b7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -118,11 +118,6 @@ static inline void iwl_update_stats(struct iwl_priv *priv, bool is_tx, | |||
118 | } | 118 | } |
119 | #endif | 119 | #endif |
120 | 120 | ||
121 | /***************************************************** | ||
122 | * TX power | ||
123 | ****************************************************/ | ||
124 | int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); | ||
125 | |||
126 | /******************************************************************************* | 121 | /******************************************************************************* |
127 | * Scanning | 122 | * Scanning |
128 | ******************************************************************************/ | 123 | ******************************************************************************/ |