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>
This commit is contained in:
Johannes Berg 2011-04-19 07:45:16 -07:00 committed by Wey-Yi Guy
parent 4119904f3e
commit e43e85c40d
1 changed files with 37 additions and 31 deletions

View File

@ -2493,21 +2493,16 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
} }
static void iwl_bg_restart(struct work_struct *data) static void iwlagn_prepare_restart(struct iwl_priv *priv)
{ {
struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;
if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
struct iwl_rxon_context *ctx; struct iwl_rxon_context *ctx;
bool bt_full_concurrent; bool bt_full_concurrent;
u8 bt_ci_compliance; u8 bt_ci_compliance;
u8 bt_load; u8 bt_load;
u8 bt_status; u8 bt_status;
mutex_lock(&priv->mutex); lockdep_assert_held(&priv->mutex);
for_each_context(priv, ctx) for_each_context(priv, ctx)
ctx->vif = NULL; ctx->vif = NULL;
priv->is_open = 0; priv->is_open = 0;
@ -2532,7 +2527,18 @@ static void iwl_bg_restart(struct work_struct *data)
priv->bt_ci_compliance = bt_ci_compliance; priv->bt_ci_compliance = bt_ci_compliance;
priv->bt_traffic_load = bt_load; priv->bt_traffic_load = bt_load;
priv->bt_status = bt_status; priv->bt_status = bt_status;
}
static void iwl_bg_restart(struct work_struct *data)
{
struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return;
if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
mutex_lock(&priv->mutex);
iwlagn_prepare_restart(priv);
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
iwl_cancel_deferred_work(priv); iwl_cancel_deferred_work(priv);
ieee80211_restart_hw(priv->hw); ieee80211_restart_hw(priv->hw);