aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-04-19 10:45:16 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-04-30 11:39:30 -0400
commite43e85c40d83f0a7a6ff5631d1009d142b72dbca (patch)
treeb3656925b866c62b3e247fa5d7e3de4da12dd984 /drivers/net
parent4119904f3ebf30c25afb42195740f9ee5dc7749c (diff)
iwlagn: refactor restart
The WoWLAN resume code will have to essentially do a restart, but without going through the work struct. To support that, refactor the restart by splitting out the preparation code into a new function. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c68
1 files changed, 37 insertions, 31 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index a4ec524f465..c27147c4d4a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2493,6 +2493,42 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
2493 mutex_unlock(&priv->mutex); 2493 mutex_unlock(&priv->mutex);
2494} 2494}
2495 2495
2496static void iwlagn_prepare_restart(struct iwl_priv *priv)
2497{
2498 struct iwl_rxon_context *ctx;
2499 bool bt_full_concurrent;
2500 u8 bt_ci_compliance;
2501 u8 bt_load;
2502 u8 bt_status;
2503
2504 lockdep_assert_held(&priv->mutex);
2505
2506 for_each_context(priv, ctx)
2507 ctx->vif = NULL;
2508 priv->is_open = 0;
2509
2510 /*
2511 * __iwl_down() will clear the BT status variables,
2512 * which is correct, but when we restart we really
2513 * want to keep them so restore them afterwards.
2514 *
2515 * The restart process will later pick them up and
2516 * re-configure the hw when we reconfigure the BT
2517 * command.
2518 */
2519 bt_full_concurrent = priv->bt_full_concurrent;
2520 bt_ci_compliance = priv->bt_ci_compliance;
2521 bt_load = priv->bt_traffic_load;
2522 bt_status = priv->bt_status;
2523
2524 __iwl_down(priv);
2525
2526 priv->bt_full_concurrent = bt_full_concurrent;
2527 priv->bt_ci_compliance = bt_ci_compliance;
2528 priv->bt_traffic_load = bt_load;
2529 priv->bt_status = bt_status;
2530}
2531
2496static void iwl_bg_restart(struct work_struct *data) 2532static void iwl_bg_restart(struct work_struct *data)
2497{ 2533{
2498 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 2534 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
@@ -2501,38 +2537,8 @@ static void iwl_bg_restart(struct work_struct *data)
2501 return; 2537 return;
2502 2538
2503 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 2539 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
2504 struct iwl_rxon_context *ctx;
2505 bool bt_full_concurrent;
2506 u8 bt_ci_compliance;
2507 u8 bt_load;
2508 u8 bt_status;
2509
2510 mutex_lock(&priv->mutex); 2540 mutex_lock(&priv->mutex);
2511 for_each_context(priv, ctx) 2541 iwlagn_prepare_restart(priv);
2512 ctx->vif = NULL;
2513 priv->is_open = 0;
2514
2515 /*
2516 * __iwl_down() will clear the BT status variables,
2517 * which is correct, but when we restart we really
2518 * want to keep them so restore them afterwards.
2519 *
2520 * The restart process will later pick them up and
2521 * re-configure the hw when we reconfigure the BT
2522 * command.
2523 */
2524 bt_full_concurrent = priv->bt_full_concurrent;
2525 bt_ci_compliance = priv->bt_ci_compliance;
2526 bt_load = priv->bt_traffic_load;
2527 bt_status = priv->bt_status;
2528
2529 __iwl_down(priv);
2530
2531 priv->bt_full_concurrent = bt_full_concurrent;
2532 priv->bt_ci_compliance = bt_ci_compliance;
2533 priv->bt_traffic_load = bt_load;
2534 priv->bt_status = bt_status;
2535
2536 mutex_unlock(&priv->mutex); 2542 mutex_unlock(&priv->mutex);
2537 iwl_cancel_deferred_work(priv); 2543 iwl_cancel_deferred_work(priv);
2538 ieee80211_restart_hw(priv->hw); 2544 ieee80211_restart_hw(priv->hw);