aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDon Fry <donald.h.fry@intel.com>2012-03-07 12:52:37 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-08 13:59:55 -0500
commit83626404a70da74c67f32f119e53c0ba032ba2d8 (patch)
treefdd6cff4fdffbe099d24a0c0dc8c6d07f6aca900 /drivers/net/wireless
parent9bdfbfadc4f0b3a756b54e7ec7cfaf92c22ce258 (diff)
iwlwifi: more status bit factoring
Continue splitting the status bits between transport and op_mode. All but a few are separated. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rx.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tt.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c40
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h31
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c31
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c38
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-mac80211.c34
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c50
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c8
17 files changed, 160 insertions, 166 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 3fed4bbb7e82..915183a3a873 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -51,7 +51,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
51 struct iwlagn_tx_power_dbm_cmd tx_power_cmd; 51 struct iwlagn_tx_power_dbm_cmd tx_power_cmd;
52 u8 tx_ant_cfg_cmd; 52 u8 tx_ant_cfg_cmd;
53 53
54 if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->shrd->status), 54 if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status),
55 "TX Power requested while scanning!\n")) 55 "TX Power requested while scanning!\n"))
56 return -EAGAIN; 56 return -EAGAIN;
57 57
@@ -575,7 +575,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
575 * STATUS_SCANNING to avoid race when queue_work two times from 575 * STATUS_SCANNING to avoid race when queue_work two times from
576 * different notifications, but quit and not perform any work at all. 576 * different notifications, but quit and not perform any work at all.
577 */ 577 */
578 if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) 578 if (test_bit(STATUS_SCAN_HW, &priv->status))
579 goto out; 579 goto out;
580 580
581 iwl_update_chain_flags(priv); 581 iwl_update_chain_flags(priv);
@@ -1291,9 +1291,9 @@ int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan)
1291 1291
1292int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) 1292int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1293{ 1293{
1294 if (iwl_is_rfkill(priv->shrd) || iwl_is_ctkill(priv)) { 1294 if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {
1295 IWL_WARN(priv, "Not sending command - %s KILL\n", 1295 IWL_WARN(priv, "Not sending command - %s KILL\n",
1296 iwl_is_rfkill(priv->shrd) ? "RF" : "CT"); 1296 iwl_is_rfkill(priv) ? "RF" : "CT");
1297 return -EIO; 1297 return -EIO;
1298 } 1298 }
1299 1299
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index 8e7cdfaf10cc..3ad43330f6a1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -159,7 +159,7 @@ static int iwlagn_rx_csa(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
159 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 159 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
160 struct iwl_rxon_cmd *rxon = (void *)&ctx->active; 160 struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
161 161
162 if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status)) 162 if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
163 return 0; 163 return 0;
164 164
165 if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { 165 if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
@@ -355,7 +355,7 @@ static void iwlagn_recover_from_statistics(struct iwl_priv *priv,
355{ 355{
356 unsigned int msecs; 356 unsigned int msecs;
357 357
358 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 358 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
359 return; 359 return;
360 360
361 msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies); 361 msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies);
@@ -575,7 +575,7 @@ static int iwlagn_rx_statistics(struct iwl_priv *priv,
575 575
576 priv->rx_statistics_jiffies = stamp; 576 priv->rx_statistics_jiffies = stamp;
577 577
578 set_bit(STATUS_STATISTICS, &priv->shrd->status); 578 set_bit(STATUS_STATISTICS, &priv->status);
579 579
580 /* Reschedule the statistics timer to occur in 580 /* Reschedule the statistics timer to occur in
581 * reg_recalib_period seconds to ensure we get a 581 * reg_recalib_period seconds to ensure we get a
@@ -584,7 +584,7 @@ static int iwlagn_rx_statistics(struct iwl_priv *priv,
584 mod_timer(&priv->statistics_periodic, jiffies + 584 mod_timer(&priv->statistics_periodic, jiffies +
585 msecs_to_jiffies(reg_recalib_period * 1000)); 585 msecs_to_jiffies(reg_recalib_period * 1000));
586 586
587 if (unlikely(!test_bit(STATUS_SCANNING, &priv->shrd->status)) && 587 if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
588 (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { 588 (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
589 iwlagn_rx_calc_noise(priv); 589 iwlagn_rx_calc_noise(priv);
590 queue_work(priv->workqueue, &priv->run_time_calib_work); 590 queue_work(priv->workqueue, &priv->run_time_calib_work);
@@ -658,18 +658,18 @@ static int iwlagn_rx_card_state_notif(struct iwl_priv *priv,
658 iwl_tt_exit_ct_kill(priv); 658 iwl_tt_exit_ct_kill(priv);
659 659
660 if (flags & HW_CARD_DISABLED) 660 if (flags & HW_CARD_DISABLED)
661 set_bit(STATUS_RF_KILL_HW, &priv->shrd->status); 661 set_bit(STATUS_RF_KILL_HW, &priv->status);
662 else 662 else
663 clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status); 663 clear_bit(STATUS_RF_KILL_HW, &priv->status);
664 664
665 665
666 if (!(flags & RXON_CARD_DISABLED)) 666 if (!(flags & RXON_CARD_DISABLED))
667 iwl_scan_cancel(priv); 667 iwl_scan_cancel(priv);
668 668
669 if ((test_bit(STATUS_RF_KILL_HW, &status) != 669 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
670 test_bit(STATUS_RF_KILL_HW, &priv->shrd->status))) 670 test_bit(STATUS_RF_KILL_HW, &priv->status)))
671 wiphy_rfkill_set_hw_state(priv->hw->wiphy, 671 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
672 test_bit(STATUS_RF_KILL_HW, &priv->shrd->status)); 672 test_bit(STATUS_RF_KILL_HW, &priv->status));
673 else 673 else
674 wake_up(&priv->shrd->wait_command_queue); 674 wake_up(&priv->shrd->wait_command_queue);
675 return 0; 675 return 0;
@@ -691,7 +691,7 @@ static int iwlagn_rx_missed_beacon_notif(struct iwl_priv *priv,
691 le32_to_cpu(missed_beacon->total_missed_becons), 691 le32_to_cpu(missed_beacon->total_missed_becons),
692 le32_to_cpu(missed_beacon->num_recvd_beacons), 692 le32_to_cpu(missed_beacon->num_recvd_beacons),
693 le32_to_cpu(missed_beacon->num_expected_beacons)); 693 le32_to_cpu(missed_beacon->num_expected_beacons));
694 if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) 694 if (!test_bit(STATUS_SCANNING, &priv->status))
695 iwl_init_sensitivity(priv); 695 iwl_init_sensitivity(priv);
696 } 696 }
697 return 0; 697 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 66e9a71aaac6..36909077f994 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -361,7 +361,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
361 slot0 = bcnint / 2; 361 slot0 = bcnint / 2;
362 slot1 = bcnint - slot0; 362 slot1 = bcnint - slot0;
363 363
364 if (test_bit(STATUS_SCAN_HW, &priv->shrd->status) || 364 if (test_bit(STATUS_SCAN_HW, &priv->status) ||
365 (!ctx_bss->vif->bss_conf.idle && 365 (!ctx_bss->vif->bss_conf.idle &&
366 !ctx_bss->vif->bss_conf.assoc)) { 366 !ctx_bss->vif->bss_conf.assoc)) {
367 slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME; 367 slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME;
@@ -377,7 +377,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
377 ctx_pan->beacon_int; 377 ctx_pan->beacon_int;
378 slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1); 378 slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);
379 379
380 if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) { 380 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
381 slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME; 381 slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME;
382 slot1 = IWL_MIN_SLOT_TIME; 382 slot1 = IWL_MIN_SLOT_TIME;
383 } 383 }
@@ -421,7 +421,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
421 421
422 lockdep_assert_held(&priv->mutex); 422 lockdep_assert_held(&priv->mutex);
423 423
424 if (!iwl_is_alive(priv->shrd)) 424 if (!iwl_is_alive(priv))
425 return -EBUSY; 425 return -EBUSY;
426 426
427 /* This function hardcodes a bunch of dual-mode assumptions */ 427 /* This function hardcodes a bunch of dual-mode assumptions */
@@ -457,7 +457,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
457 * receive commit_rxon request 457 * receive commit_rxon request
458 * abort any previous channel switch if still in process 458 * abort any previous channel switch if still in process
459 */ 459 */
460 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status) && 460 if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
461 (priv->switch_channel != ctx->staging.channel)) { 461 (priv->switch_channel != ctx->staging.channel)) {
462 IWL_DEBUG_11H(priv, "abort channel switch on %d\n", 462 IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
463 le16_to_cpu(priv->switch_channel)); 463 le16_to_cpu(priv->switch_channel));
@@ -551,12 +551,12 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
551 551
552 mutex_lock(&priv->mutex); 552 mutex_lock(&priv->mutex);
553 553
554 if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) { 554 if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
555 IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); 555 IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
556 goto out; 556 goto out;
557 } 557 }
558 558
559 if (!iwl_is_ready(priv->shrd)) { 559 if (!iwl_is_ready(priv)) {
560 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 560 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
561 goto out; 561 goto out;
562 } 562 }
@@ -794,7 +794,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
794 794
795 mutex_lock(&priv->mutex); 795 mutex_lock(&priv->mutex);
796 796
797 if (unlikely(!iwl_is_ready(priv->shrd))) { 797 if (unlikely(!iwl_is_ready(priv))) {
798 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 798 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
799 mutex_unlock(&priv->mutex); 799 mutex_unlock(&priv->mutex);
800 return; 800 return;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index cf5cc1060cf4..23e9eab477bb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -490,7 +490,7 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
490{ 490{
491 u8 tid; 491 u8 tid;
492 492
493 if (!iwl_is_ready(priv->shrd)) { 493 if (!iwl_is_ready(priv)) {
494 IWL_DEBUG_INFO(priv, 494 IWL_DEBUG_INFO(priv,
495 "Unable to remove station %pM, device not ready.\n", 495 "Unable to remove station %pM, device not ready.\n",
496 addr); 496 addr);
@@ -598,7 +598,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
598 int ret; 598 int ret;
599 bool send_lq; 599 bool send_lq;
600 600
601 if (!iwl_is_ready(priv->shrd)) { 601 if (!iwl_is_ready(priv)) {
602 IWL_DEBUG_INFO(priv, 602 IWL_DEBUG_INFO(priv,
603 "Not ready yet, not restoring any stations.\n"); 603 "Not ready yet, not restoring any stations.\n");
604 return; 604 return;
@@ -997,7 +997,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
997 keyconf->keyidx); 997 keyconf->keyidx);
998 998
999 memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); 999 memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
1000 if (iwl_is_rfkill(priv->shrd)) { 1000 if (iwl_is_rfkill(priv)) {
1001 IWL_DEBUG_WEP(priv, 1001 IWL_DEBUG_WEP(priv,
1002 "Not sending REPLY_WEPKEY command due to RFKILL.\n"); 1002 "Not sending REPLY_WEPKEY command due to RFKILL.\n");
1003 /* but keys in device are clear anyway so return success */ 1003 /* but keys in device are clear anyway so return success */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
index fa9415309cd6..baaf5ba2fc38 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
@@ -174,7 +174,7 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
174 struct iwl_tt_mgmt *tt = &priv->thermal_throttle; 174 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
175 unsigned long flags; 175 unsigned long flags;
176 176
177 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 177 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
178 return; 178 return;
179 179
180 if (tt->state == IWL_TI_CT_KILL) { 180 if (tt->state == IWL_TI_CT_KILL) {
@@ -225,7 +225,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data)
225 struct iwl_priv *priv = (struct iwl_priv *)data; 225 struct iwl_priv *priv = (struct iwl_priv *)data;
226 struct iwl_tt_mgmt *tt = &priv->thermal_throttle; 226 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
227 227
228 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 228 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
229 return; 229 return;
230 230
231 /* temperature timer expired, ready to go into CT_KILL state */ 231 /* temperature timer expired, ready to go into CT_KILL state */
@@ -504,10 +504,10 @@ static void iwl_bg_ct_enter(struct work_struct *work)
504 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter); 504 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter);
505 struct iwl_tt_mgmt *tt = &priv->thermal_throttle; 505 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
506 506
507 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 507 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
508 return; 508 return;
509 509
510 if (!iwl_is_ready(priv->shrd)) 510 if (!iwl_is_ready(priv))
511 return; 511 return;
512 512
513 if (tt->state != IWL_TI_CT_KILL) { 513 if (tt->state != IWL_TI_CT_KILL) {
@@ -533,10 +533,10 @@ static void iwl_bg_ct_exit(struct work_struct *work)
533 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit); 533 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit);
534 struct iwl_tt_mgmt *tt = &priv->thermal_throttle; 534 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
535 535
536 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 536 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
537 return; 537 return;
538 538
539 if (!iwl_is_ready(priv->shrd)) 539 if (!iwl_is_ready(priv))
540 return; 540 return;
541 541
542 /* stop ct_kill_exit_tm timer */ 542 /* stop ct_kill_exit_tm timer */
@@ -563,7 +563,7 @@ static void iwl_bg_ct_exit(struct work_struct *work)
563 563
564void iwl_tt_enter_ct_kill(struct iwl_priv *priv) 564void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
565{ 565{
566 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 566 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
567 return; 567 return;
568 568
569 IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n"); 569 IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n");
@@ -572,7 +572,7 @@ void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
572 572
573void iwl_tt_exit_ct_kill(struct iwl_priv *priv) 573void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
574{ 574{
575 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 575 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
576 return; 576 return;
577 577
578 IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n"); 578 IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n");
@@ -584,7 +584,7 @@ static void iwl_bg_tt_work(struct work_struct *work)
584 struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work); 584 struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work);
585 s32 temp = priv->temperature; /* degrees CELSIUS except specified */ 585 s32 temp = priv->temperature; /* degrees CELSIUS except specified */
586 586
587 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 587 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
588 return; 588 return;
589 589
590 if (!priv->thermal_throttle.advanced_tt) 590 if (!priv->thermal_throttle.advanced_tt)
@@ -595,7 +595,7 @@ static void iwl_bg_tt_work(struct work_struct *work)
595 595
596void iwl_tt_handler(struct iwl_priv *priv) 596void iwl_tt_handler(struct iwl_priv *priv)
597{ 597{
598 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 598 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
599 return; 599 return;
600 600
601 IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n"); 601 IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index ac5c1311ef33..9f224548b636 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -297,7 +297,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
297 if (info->control.vif) 297 if (info->control.vif)
298 ctx = iwl_rxon_ctx_from_vif(info->control.vif); 298 ctx = iwl_rxon_ctx_from_vif(info->control.vif);
299 299
300 if (iwl_is_rfkill(priv->shrd)) { 300 if (iwl_is_rfkill(priv)) {
301 IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); 301 IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
302 goto drop_unlock_priv; 302 goto drop_unlock_priv;
303 } 303 }
@@ -1000,7 +1000,7 @@ static void iwl_check_abort_status(struct iwl_priv *priv,
1000{ 1000{
1001 if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) { 1001 if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
1002 IWL_ERR(priv, "Tx flush command to flush out all frames\n"); 1002 IWL_ERR(priv, "Tx flush command to flush out all frames\n");
1003 if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 1003 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
1004 queue_work(priv->workqueue, &priv->tx_flush); 1004 queue_work(priv->workqueue, &priv->tx_flush);
1005 } 1005 }
1006} 1006}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 397342402d1e..d45def33d0f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -244,11 +244,11 @@ static void iwl_bg_bt_runtime_config(struct work_struct *work)
244 struct iwl_priv *priv = 244 struct iwl_priv *priv =
245 container_of(work, struct iwl_priv, bt_runtime_config); 245 container_of(work, struct iwl_priv, bt_runtime_config);
246 246
247 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 247 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
248 return; 248 return;
249 249
250 /* dont send host command if rf-kill is on */ 250 /* dont send host command if rf-kill is on */
251 if (!iwl_is_ready_rf(priv->shrd)) 251 if (!iwl_is_ready_rf(priv))
252 return; 252 return;
253 iwlagn_send_advance_bt_config(priv); 253 iwlagn_send_advance_bt_config(priv);
254} 254}
@@ -261,11 +261,11 @@ static void iwl_bg_bt_full_concurrency(struct work_struct *work)
261 261
262 mutex_lock(&priv->mutex); 262 mutex_lock(&priv->mutex);
263 263
264 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 264 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
265 goto out; 265 goto out;
266 266
267 /* dont send host command if rf-kill is on */ 267 /* dont send host command if rf-kill is on */
268 if (!iwl_is_ready_rf(priv->shrd)) 268 if (!iwl_is_ready_rf(priv))
269 goto out; 269 goto out;
270 270
271 IWL_DEBUG_INFO(priv, "BT coex in %s mode\n", 271 IWL_DEBUG_INFO(priv, "BT coex in %s mode\n",
@@ -300,11 +300,11 @@ static void iwl_bg_statistics_periodic(unsigned long data)
300{ 300{
301 struct iwl_priv *priv = (struct iwl_priv *)data; 301 struct iwl_priv *priv = (struct iwl_priv *)data;
302 302
303 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 303 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
304 return; 304 return;
305 305
306 /* dont send host command if rf-kill is on */ 306 /* dont send host command if rf-kill is on */
307 if (!iwl_is_ready_rf(priv->shrd)) 307 if (!iwl_is_ready_rf(priv))
308 return; 308 return;
309 309
310 iwl_send_statistics_request(priv, CMD_ASYNC, false); 310 iwl_send_statistics_request(priv, CMD_ASYNC, false);
@@ -461,7 +461,7 @@ static void iwl_bg_ucode_trace(unsigned long data)
461{ 461{
462 struct iwl_priv *priv = (struct iwl_priv *)data; 462 struct iwl_priv *priv = (struct iwl_priv *)data;
463 463
464 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 464 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
465 return; 465 return;
466 466
467 if (priv->event_log.ucode_trace) { 467 if (priv->event_log.ucode_trace) {
@@ -477,11 +477,11 @@ static void iwl_bg_tx_flush(struct work_struct *work)
477 struct iwl_priv *priv = 477 struct iwl_priv *priv =
478 container_of(work, struct iwl_priv, tx_flush); 478 container_of(work, struct iwl_priv, tx_flush);
479 479
480 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 480 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
481 return; 481 return;
482 482
483 /* do nothing if rf-kill is on */ 483 /* do nothing if rf-kill is on */
484 if (!iwl_is_ready_rf(priv->shrd)) 484 if (!iwl_is_ready_rf(priv))
485 return; 485 return;
486 486
487 IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n"); 487 IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n");
@@ -640,12 +640,12 @@ int iwl_alive_start(struct iwl_priv *priv)
640 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); 640 IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
641 641
642 /* After the ALIVE response, we can send host commands to the uCode */ 642 /* After the ALIVE response, we can send host commands to the uCode */
643 set_bit(STATUS_ALIVE, &priv->shrd->status); 643 set_bit(STATUS_ALIVE, &priv->status);
644 644
645 /* Enable watchdog to monitor the driver tx queues */ 645 /* Enable watchdog to monitor the driver tx queues */
646 iwl_setup_watchdog(priv); 646 iwl_setup_watchdog(priv);
647 647
648 if (iwl_is_rfkill(priv->shrd)) 648 if (iwl_is_rfkill(priv))
649 return -ERFKILL; 649 return -ERFKILL;
650 650
651 if (priv->event_log.ucode_trace) { 651 if (priv->event_log.ucode_trace) {
@@ -719,7 +719,7 @@ int iwl_alive_start(struct iwl_priv *priv)
719 iwl_reset_run_time_calib(priv); 719 iwl_reset_run_time_calib(priv);
720 } 720 }
721 721
722 set_bit(STATUS_READY, &priv->shrd->status); 722 set_bit(STATUS_READY, &priv->status);
723 723
724 /* Configure the adapter for unassociated operation */ 724 /* Configure the adapter for unassociated operation */
725 ret = iwlagn_commit_rxon(priv, ctx); 725 ret = iwlagn_commit_rxon(priv, ctx);
@@ -786,7 +786,7 @@ void iwl_down(struct iwl_priv *priv)
786 ieee80211_remain_on_channel_expired(priv->hw); 786 ieee80211_remain_on_channel_expired(priv->hw);
787 787
788 exit_pending = 788 exit_pending =
789 test_and_set_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 789 test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
790 790
791 /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set 791 /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
792 * to prevent rearm timer */ 792 * to prevent rearm timer */
@@ -811,7 +811,7 @@ void iwl_down(struct iwl_priv *priv)
811 /* Wipe out the EXIT_PENDING status bit if we are not actually 811 /* Wipe out the EXIT_PENDING status bit if we are not actually
812 * exiting the module */ 812 * exiting the module */
813 if (!exit_pending) 813 if (!exit_pending)
814 clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 814 clear_bit(STATUS_EXIT_PENDING, &priv->status);
815 815
816 if (priv->mac80211_registered) 816 if (priv->mac80211_registered)
817 ieee80211_stop_queues(priv->hw); 817 ieee80211_stop_queues(priv->hw);
@@ -820,13 +820,13 @@ void iwl_down(struct iwl_priv *priv)
820 820
821 /* Clear out all status bits but a few that are stable across reset */ 821 /* Clear out all status bits but a few that are stable across reset */
822 priv->shrd->status &= 822 priv->shrd->status &=
823 test_bit(STATUS_RF_KILL_HW, &priv->shrd->status) << 823 test_bit(STATUS_RF_KILL_HW, &priv->status) <<
824 STATUS_RF_KILL_HW | 824 STATUS_RF_KILL_HW |
825 test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) << 825 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
826 STATUS_GEO_CONFIGURED | 826 STATUS_GEO_CONFIGURED |
827 test_bit(STATUS_FW_ERROR, &priv->shrd->status) << 827 test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
828 STATUS_FW_ERROR | 828 STATUS_FW_ERROR |
829 test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) << 829 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
830 STATUS_EXIT_PENDING; 830 STATUS_EXIT_PENDING;
831 831
832 dev_kfree_skb(priv->beacon_skb); 832 dev_kfree_skb(priv->beacon_skb);
@@ -846,8 +846,8 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
846 846
847 mutex_lock(&priv->mutex); 847 mutex_lock(&priv->mutex);
848 848
849 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) || 849 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
850 test_bit(STATUS_SCANNING, &priv->shrd->status)) { 850 test_bit(STATUS_SCANNING, &priv->status)) {
851 mutex_unlock(&priv->mutex); 851 mutex_unlock(&priv->mutex);
852 return; 852 return;
853 } 853 }
@@ -903,7 +903,7 @@ static void iwl_bg_restart(struct work_struct *data)
903{ 903{
904 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); 904 struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
905 905
906 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 906 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
907 return; 907 return;
908 908
909 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) { 909 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index ede1852b1d7e..eb96855ddf8d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -353,28 +353,23 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
353 353
354/* status checks */ 354/* status checks */
355 355
356static inline int iwl_is_ready(struct iwl_shared *shrd) 356static inline int iwl_is_ready(struct iwl_priv *priv)
357{ 357{
358 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are 358 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
359 * set but EXIT_PENDING is not */ 359 * set but EXIT_PENDING is not */
360 return test_bit(STATUS_READY, &shrd->status) && 360 return test_bit(STATUS_READY, &priv->status) &&
361 test_bit(STATUS_GEO_CONFIGURED, &shrd->status) && 361 test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
362 !test_bit(STATUS_EXIT_PENDING, &shrd->status); 362 !test_bit(STATUS_EXIT_PENDING, &priv->status);
363} 363}
364 364
365static inline int iwl_is_alive(struct iwl_shared *shrd) 365static inline int iwl_is_alive(struct iwl_priv *priv)
366{ 366{
367 return test_bit(STATUS_ALIVE, &shrd->status); 367 return test_bit(STATUS_ALIVE, &priv->status);
368} 368}
369 369
370static inline int iwl_is_rfkill_hw(struct iwl_shared *shrd) 370static inline int iwl_is_rfkill(struct iwl_priv *priv)
371{ 371{
372 return test_bit(STATUS_RF_KILL_HW, &shrd->status); 372 return test_bit(STATUS_RF_KILL_HW, &priv->status);
373}
374
375static inline int iwl_is_rfkill(struct iwl_shared *shrd)
376{
377 return iwl_is_rfkill_hw(shrd);
378} 373}
379 374
380static inline int iwl_is_ctkill(struct iwl_priv *priv) 375static inline int iwl_is_ctkill(struct iwl_priv *priv)
@@ -382,18 +377,18 @@ static inline int iwl_is_ctkill(struct iwl_priv *priv)
382 return test_bit(STATUS_CT_KILL, &priv->status); 377 return test_bit(STATUS_CT_KILL, &priv->status);
383} 378}
384 379
385static inline int iwl_is_ready_rf(struct iwl_shared *shrd) 380static inline int iwl_is_ready_rf(struct iwl_priv *priv)
386{ 381{
387 if (iwl_is_rfkill(shrd)) 382 if (iwl_is_rfkill(priv))
388 return 0; 383 return 0;
389 384
390 return iwl_is_ready(shrd); 385 return iwl_is_ready(priv);
391} 386}
392 387
393#ifdef CONFIG_IWLWIFI_DEBUG 388#ifdef CONFIG_IWLWIFI_DEBUG
394#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \ 389#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
395do { \ 390do { \
396 if (!iwl_is_rfkill((m)->shrd)) \ 391 if (!iwl_is_rfkill((m))) \
397 IWL_ERR(m, fmt, ##args); \ 392 IWL_ERR(m, fmt, ##args); \
398 else \ 393 else \
399 __iwl_err(trans(m)->dev, true, \ 394 __iwl_err(trans(m)->dev, true, \
@@ -403,7 +398,7 @@ do { \
403#else 398#else
404#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \ 399#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
405do { \ 400do { \
406 if (!iwl_is_rfkill((m)->shrd)) \ 401 if (!iwl_is_rfkill((m))) \
407 IWL_ERR(m, fmt, ##args); \ 402 IWL_ERR(m, fmt, ##args); \
408 else \ 403 else \
409 __iwl_err(trans(m)->dev, true, true, fmt, ##args); \ 404 __iwl_err(trans(m)->dev, true, true, fmt, ##args); \
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index df7b165b290c..8b85940731f2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -113,7 +113,7 @@ int iwl_init_geos(struct iwl_priv *priv)
113 if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || 113 if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
114 priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { 114 priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
115 IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n"); 115 IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n");
116 set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status); 116 set_bit(STATUS_GEO_CONFIGURED, &priv->status);
117 return 0; 117 return 0;
118 } 118 }
119 119
@@ -212,7 +212,7 @@ int iwl_init_geos(struct iwl_priv *priv)
212 priv->bands[IEEE80211_BAND_2GHZ].n_channels, 212 priv->bands[IEEE80211_BAND_2GHZ].n_channels,
213 priv->bands[IEEE80211_BAND_5GHZ].n_channels); 213 priv->bands[IEEE80211_BAND_5GHZ].n_channels);
214 214
215 set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status); 215 set_bit(STATUS_GEO_CONFIGURED, &priv->status);
216 216
217 return 0; 217 return 0;
218} 218}
@@ -224,7 +224,7 @@ void iwl_free_geos(struct iwl_priv *priv)
224{ 224{
225 kfree(priv->ieee_channels); 225 kfree(priv->ieee_channels);
226 kfree(priv->ieee_rates); 226 kfree(priv->ieee_rates);
227 clear_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status); 227 clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
228} 228}
229 229
230static bool iwl_is_channel_extension(struct iwl_priv *priv, 230static bool iwl_is_channel_extension(struct iwl_priv *priv,
@@ -798,11 +798,10 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
798 */ 798 */
799 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 799 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
800 800
801 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 801 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
802 return; 802 return;
803 803
804 if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, 804 if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
805 &priv->shrd->status))
806 ieee80211_chswitch_done(ctx->vif, is_success); 805 ieee80211_chswitch_done(ctx->vif, is_success);
807} 806}
808 807
@@ -849,7 +848,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
849 848
850 /* Keep the restart process from trying to send host 849 /* Keep the restart process from trying to send host
851 * commands by clearing the ready bit */ 850 * commands by clearing the ready bit */
852 clear_bit(STATUS_READY, &priv->shrd->status); 851 clear_bit(STATUS_READY, &priv->status);
853 852
854 wake_up(&priv->shrd->wait_command_queue); 853 wake_up(&priv->shrd->wait_command_queue);
855 854
@@ -874,7 +873,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
874 priv->reload_count = 0; 873 priv->reload_count = 0;
875 } 874 }
876 875
877 if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) { 876 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
878 if (iwlagn_mod_params.restart_fw) { 877 if (iwlagn_mod_params.restart_fw) {
879 IWL_DEBUG_FW_ERRORS(priv, 878 IWL_DEBUG_FW_ERRORS(priv,
880 "Restarting adapter due to uCode error.\n"); 879 "Restarting adapter due to uCode error.\n");
@@ -912,7 +911,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
912 return -EINVAL; 911 return -EINVAL;
913 } 912 }
914 913
915 if (!iwl_is_ready_rf(priv->shrd)) 914 if (!iwl_is_ready_rf(priv))
916 return -EIO; 915 return -EIO;
917 916
918 /* scan complete and commit_rxon use tx_power_next value, 917 /* scan complete and commit_rxon use tx_power_next value,
@@ -920,7 +919,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
920 priv->tx_power_next = tx_power; 919 priv->tx_power_next = tx_power;
921 920
922 /* do not set tx power when scanning or channel changing */ 921 /* do not set tx power when scanning or channel changing */
923 defer = test_bit(STATUS_SCANNING, &priv->shrd->status) || 922 defer = test_bit(STATUS_SCANNING, &priv->status) ||
924 memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); 923 memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
925 if (defer && !force) { 924 if (defer && !force) {
926 IWL_DEBUG_INFO(priv, "Deferring tx power set\n"); 925 IWL_DEBUG_INFO(priv, "Deferring tx power set\n");
@@ -1219,7 +1218,7 @@ void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len)
1219 1218
1220static void iwl_force_rf_reset(struct iwl_priv *priv) 1219static void iwl_force_rf_reset(struct iwl_priv *priv)
1221{ 1220{
1222 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 1221 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1223 return; 1222 return;
1224 1223
1225 if (!iwl_is_any_associated(priv)) { 1224 if (!iwl_is_any_associated(priv)) {
@@ -1244,7 +1243,7 @@ int iwl_force_reset(struct iwl_priv *priv, int mode, bool external)
1244{ 1243{
1245 struct iwl_force_reset *force_reset; 1244 struct iwl_force_reset *force_reset;
1246 1245
1247 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 1246 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1248 return -EINVAL; 1247 return -EINVAL;
1249 1248
1250 if (mode >= IWL_MAX_FORCE_RESET) { 1249 if (mode >= IWL_MAX_FORCE_RESET) {
@@ -1334,10 +1333,10 @@ void iwl_bg_watchdog(unsigned long data)
1334 int cnt; 1333 int cnt;
1335 unsigned long timeout; 1334 unsigned long timeout;
1336 1335
1337 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) 1336 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1338 return; 1337 return;
1339 1338
1340 if (iwl_is_rfkill(priv->shrd)) 1339 if (iwl_is_rfkill(priv))
1341 return; 1340 return;
1342 1341
1343 timeout = hw_params(priv).wd_timeout; 1342 timeout = hw_params(priv).wd_timeout;
@@ -1461,9 +1460,9 @@ void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
1461 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); 1460 struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
1462 1461
1463 if (state) 1462 if (state)
1464 set_bit(STATUS_RF_KILL_HW, &priv->shrd->status); 1463 set_bit(STATUS_RF_KILL_HW, &priv->status);
1465 else 1464 else
1466 clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status); 1465 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1467 1466
1468 wiphy_rfkill_set_hw_state(priv->hw->wiphy, state); 1467 wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
1469} 1468}
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 1c235d685ae6..7a1334e8c358 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -454,7 +454,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
454 char *buf; 454 char *buf;
455 ssize_t ret; 455 ssize_t ret;
456 456
457 if (!test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status)) 457 if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
458 return -EAGAIN; 458 return -EAGAIN;
459 459
460 buf = kzalloc(bufsz, GFP_KERNEL); 460 buf = kzalloc(bufsz, GFP_KERNEL);
@@ -525,28 +525,26 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
525 525
526 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n", 526 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
527 test_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status)); 527 test_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status));
528 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
529 test_bit(STATUS_INT_ENABLED, &priv->shrd->status));
530 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", 528 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
531 test_bit(STATUS_RF_KILL_HW, &priv->shrd->status)); 529 test_bit(STATUS_RF_KILL_HW, &priv->status));
532 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n", 530 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
533 test_bit(STATUS_CT_KILL, &priv->status)); 531 test_bit(STATUS_CT_KILL, &priv->status));
534 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", 532 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
535 test_bit(STATUS_ALIVE, &priv->shrd->status)); 533 test_bit(STATUS_ALIVE, &priv->status));
536 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n", 534 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
537 test_bit(STATUS_READY, &priv->shrd->status)); 535 test_bit(STATUS_READY, &priv->status));
538 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n", 536 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
539 test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status)); 537 test_bit(STATUS_GEO_CONFIGURED, &priv->status));
540 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", 538 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
541 test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)); 539 test_bit(STATUS_EXIT_PENDING, &priv->status));
542 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", 540 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
543 test_bit(STATUS_STATISTICS, &priv->shrd->status)); 541 test_bit(STATUS_STATISTICS, &priv->status));
544 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", 542 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
545 test_bit(STATUS_SCANNING, &priv->shrd->status)); 543 test_bit(STATUS_SCANNING, &priv->status));
546 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n", 544 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
547 test_bit(STATUS_SCAN_ABORTING, &priv->shrd->status)); 545 test_bit(STATUS_SCAN_ABORTING, &priv->status));
548 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n", 546 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
549 test_bit(STATUS_SCAN_HW, &priv->shrd->status)); 547 test_bit(STATUS_SCAN_HW, &priv->status));
550 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n", 548 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
551 test_bit(STATUS_POWER_PMI, &priv->shrd->status)); 549 test_bit(STATUS_POWER_PMI, &priv->shrd->status));
552 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n", 550 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
@@ -752,7 +750,7 @@ static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file,
752 if (value != -1 && (value < 0 || value >= IWL_POWER_NUM)) 750 if (value != -1 && (value < 0 || value >= IWL_POWER_NUM))
753 return -EINVAL; 751 return -EINVAL;
754 752
755 if (!iwl_is_ready_rf(priv->shrd)) 753 if (!iwl_is_ready_rf(priv))
756 return -EAGAIN; 754 return -EAGAIN;
757 755
758 priv->power_data.debug_sleep_level_override = value; 756 priv->power_data.debug_sleep_level_override = value;
@@ -947,7 +945,7 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
947 struct statistics_rx_non_phy *delta_general, *max_general; 945 struct statistics_rx_non_phy *delta_general, *max_general;
948 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; 946 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
949 947
950 if (!iwl_is_alive(priv->shrd)) 948 if (!iwl_is_alive(priv))
951 return -EAGAIN; 949 return -EAGAIN;
952 950
953 buf = kzalloc(bufsz, GFP_KERNEL); 951 buf = kzalloc(bufsz, GFP_KERNEL);
@@ -1376,7 +1374,7 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1376 ssize_t ret; 1374 ssize_t ret;
1377 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; 1375 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
1378 1376
1379 if (!iwl_is_alive(priv->shrd)) 1377 if (!iwl_is_alive(priv))
1380 return -EAGAIN; 1378 return -EAGAIN;
1381 1379
1382 buf = kzalloc(bufsz, GFP_KERNEL); 1380 buf = kzalloc(bufsz, GFP_KERNEL);
@@ -1578,7 +1576,7 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1578 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; 1576 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
1579 struct statistics_div *div, *accum_div, *delta_div, *max_div; 1577 struct statistics_div *div, *accum_div, *delta_div, *max_div;
1580 1578
1581 if (!iwl_is_alive(priv->shrd)) 1579 if (!iwl_is_alive(priv))
1582 return -EAGAIN; 1580 return -EAGAIN;
1583 1581
1584 buf = kzalloc(bufsz, GFP_KERNEL); 1582 buf = kzalloc(bufsz, GFP_KERNEL);
@@ -1697,7 +1695,7 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file,
1697 ssize_t ret; 1695 ssize_t ret;
1698 struct statistics_bt_activity *bt, *accum_bt; 1696 struct statistics_bt_activity *bt, *accum_bt;
1699 1697
1700 if (!iwl_is_alive(priv->shrd)) 1698 if (!iwl_is_alive(priv))
1701 return -EAGAIN; 1699 return -EAGAIN;
1702 1700
1703 if (!priv->bt_enable_flag) 1701 if (!priv->bt_enable_flag)
@@ -1790,7 +1788,7 @@ static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file,
1790 (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200; 1788 (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200;
1791 ssize_t ret; 1789 ssize_t ret;
1792 1790
1793 if (!iwl_is_alive(priv->shrd)) 1791 if (!iwl_is_alive(priv))
1794 return -EAGAIN; 1792 return -EAGAIN;
1795 1793
1796 buf = kzalloc(bufsz, GFP_KERNEL); 1794 buf = kzalloc(bufsz, GFP_KERNEL);
@@ -2148,7 +2146,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file,
2148 2146
2149 if (trace) { 2147 if (trace) {
2150 priv->event_log.ucode_trace = true; 2148 priv->event_log.ucode_trace = true;
2151 if (iwl_is_alive(priv->shrd)) { 2149 if (iwl_is_alive(priv)) {
2152 /* start collecting data now */ 2150 /* start collecting data now */
2153 mod_timer(&priv->ucode_trace, jiffies); 2151 mod_timer(&priv->ucode_trace, jiffies);
2154 } 2152 }
@@ -2338,7 +2336,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file,
2338 if (sscanf(buf, "%d", &flush) != 1) 2336 if (sscanf(buf, "%d", &flush) != 1)
2339 return -EINVAL; 2337 return -EINVAL;
2340 2338
2341 if (iwl_is_rfkill(priv->shrd)) 2339 if (iwl_is_rfkill(priv))
2342 return -EFAULT; 2340 return -EFAULT;
2343 2341
2344 iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); 2342 iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index f2f706f084a5..1993a2b7ae63 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -126,7 +126,7 @@ static int iwl_led_cmd(struct iwl_priv *priv,
126 }; 126 };
127 int ret; 127 int ret;
128 128
129 if (!test_bit(STATUS_READY, &priv->shrd->status)) 129 if (!test_bit(STATUS_READY, &priv->status))
130 return -EBUSY; 130 return -EBUSY;
131 131
132 if (priv->blink_on == on && priv->blink_off == off) 132 if (priv->blink_on == on && priv->blink_off == off)
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index dcf39f84f239..54d3709c0a6c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -266,7 +266,7 @@ static int __iwl_up(struct iwl_priv *priv)
266 266
267 lockdep_assert_held(&priv->mutex); 267 lockdep_assert_held(&priv->mutex);
268 268
269 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) { 269 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
270 IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); 270 IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
271 return -EIO; 271 return -EIO;
272 } 272 }
@@ -297,9 +297,9 @@ static int __iwl_up(struct iwl_priv *priv)
297 return 0; 297 return 0;
298 298
299 error: 299 error:
300 set_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 300 set_bit(STATUS_EXIT_PENDING, &priv->status);
301 iwl_down(priv); 301 iwl_down(priv);
302 clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status); 302 clear_bit(STATUS_EXIT_PENDING, &priv->status);
303 303
304 IWL_ERR(priv, "Unable to initialize device.\n"); 304 IWL_ERR(priv, "Unable to initialize device.\n");
305 return ret; 305 return ret;
@@ -322,7 +322,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw)
322 IWL_DEBUG_INFO(priv, "Start UP work done.\n"); 322 IWL_DEBUG_INFO(priv, "Start UP work done.\n");
323 323
324 /* Now we should be done, and the READY bit should be set. */ 324 /* Now we should be done, and the READY bit should be set. */
325 if (WARN_ON(!test_bit(STATUS_READY, &priv->shrd->status))) 325 if (WARN_ON(!test_bit(STATUS_READY, &priv->status)))
326 ret = -EIO; 326 ret = -EIO;
327 327
328 iwlagn_led_enable(priv); 328 iwlagn_led_enable(priv);
@@ -807,7 +807,7 @@ static int iwlagn_mac_sta_state(struct ieee80211_hw *hw,
807 * mac80211 might WARN if we fail, but due the way we 807 * mac80211 might WARN if we fail, but due the way we
808 * (badly) handle hard rfkill, we might fail here 808 * (badly) handle hard rfkill, we might fail here
809 */ 809 */
810 if (iwl_is_rfkill(priv->shrd)) 810 if (iwl_is_rfkill(priv))
811 ret = 0; 811 ret = 0;
812 812
813 mutex_unlock(&priv->mutex); 813 mutex_unlock(&priv->mutex);
@@ -839,12 +839,12 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
839 839
840 mutex_lock(&priv->mutex); 840 mutex_lock(&priv->mutex);
841 841
842 if (iwl_is_rfkill(priv->shrd)) 842 if (iwl_is_rfkill(priv))
843 goto out; 843 goto out;
844 844
845 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) || 845 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
846 test_bit(STATUS_SCANNING, &priv->shrd->status) || 846 test_bit(STATUS_SCANNING, &priv->status) ||
847 test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status)) 847 test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
848 goto out; 848 goto out;
849 849
850 if (!iwl_is_associated_ctx(ctx)) 850 if (!iwl_is_associated_ctx(ctx))
@@ -884,10 +884,10 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
884 * at this point, staging_rxon has the 884 * at this point, staging_rxon has the
885 * configuration for channel switch 885 * configuration for channel switch
886 */ 886 */
887 set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status); 887 set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
888 priv->switch_channel = cpu_to_le16(ch); 888 priv->switch_channel = cpu_to_le16(ch);
889 if (cfg(priv)->lib->set_channel_switch(priv, ch_switch)) { 889 if (cfg(priv)->lib->set_channel_switch(priv, ch_switch)) {
890 clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status); 890 clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
891 priv->switch_channel = 0; 891 priv->switch_channel = 0;
892 ieee80211_chswitch_done(ctx->vif, false); 892 ieee80211_chswitch_done(ctx->vif, false);
893 } 893 }
@@ -954,11 +954,11 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop)
954 mutex_lock(&priv->mutex); 954 mutex_lock(&priv->mutex);
955 IWL_DEBUG_MAC80211(priv, "enter\n"); 955 IWL_DEBUG_MAC80211(priv, "enter\n");
956 956
957 if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) { 957 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
958 IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); 958 IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n");
959 goto done; 959 goto done;
960 } 960 }
961 if (iwl_is_rfkill(priv->shrd)) { 961 if (iwl_is_rfkill(priv)) {
962 IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n"); 962 IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n");
963 goto done; 963 goto done;
964 } 964 }
@@ -999,7 +999,7 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
999 IWL_DEBUG_MAC80211(priv, "enter\n"); 999 IWL_DEBUG_MAC80211(priv, "enter\n");
1000 mutex_lock(&priv->mutex); 1000 mutex_lock(&priv->mutex);
1001 1001
1002 if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) { 1002 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
1003 err = -EBUSY; 1003 err = -EBUSY;
1004 goto out; 1004 goto out;
1005 } 1005 }
@@ -1140,7 +1140,7 @@ static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw,
1140 1140
1141 IWL_DEBUG_MAC80211(priv, "enter\n"); 1141 IWL_DEBUG_MAC80211(priv, "enter\n");
1142 1142
1143 if (!iwl_is_ready_rf(priv->shrd)) { 1143 if (!iwl_is_ready_rf(priv)) {
1144 IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); 1144 IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
1145 return -EIO; 1145 return -EIO;
1146 } 1146 }
@@ -1241,7 +1241,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
1241 1241
1242 iwlagn_disable_roc(priv); 1242 iwlagn_disable_roc(priv);
1243 1243
1244 if (!iwl_is_ready_rf(priv->shrd)) { 1244 if (!iwl_is_ready_rf(priv)) {
1245 IWL_WARN(priv, "Try to add interface when device not ready\n"); 1245 IWL_WARN(priv, "Try to add interface when device not ready\n");
1246 err = -EINVAL; 1246 err = -EINVAL;
1247 goto out; 1247 goto out;
@@ -1365,7 +1365,7 @@ static int iwlagn_mac_change_interface(struct ieee80211_hw *hw,
1365 1365
1366 mutex_lock(&priv->mutex); 1366 mutex_lock(&priv->mutex);
1367 1367
1368 if (!ctx->vif || !iwl_is_ready_rf(priv->shrd)) { 1368 if (!ctx->vif || !iwl_is_ready_rf(priv)) {
1369 /* 1369 /*
1370 * Huh? But wait ... this can maybe happen when 1370 * Huh? But wait ... this can maybe happen when
1371 * we're in the middle of a firmware restart! 1371 * we're in the middle of a firmware restart!
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index f79ff16e29f4..958d9d09aee3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -392,12 +392,12 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
392 if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) 392 if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force)
393 return 0; 393 return 0;
394 394
395 if (!iwl_is_ready_rf(priv->shrd)) 395 if (!iwl_is_ready_rf(priv))
396 return -EIO; 396 return -EIO;
397 397
398 /* scan complete use sleep_power_next, need to be updated */ 398 /* scan complete use sleep_power_next, need to be updated */
399 memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); 399 memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd));
400 if (test_bit(STATUS_SCANNING, &priv->shrd->status) && !force) { 400 if (test_bit(STATUS_SCANNING, &priv->status) && !force) {
401 IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n"); 401 IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n");
402 return 0; 402 return 0;
403 } 403 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 8c3fb3233d9f..902efe4bc898 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -66,9 +66,9 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
66 /* Exit instantly with error when device is not ready 66 /* Exit instantly with error when device is not ready
67 * to receive scan abort command or it does not perform 67 * to receive scan abort command or it does not perform
68 * hardware scan currently */ 68 * hardware scan currently */
69 if (!test_bit(STATUS_READY, &priv->shrd->status) || 69 if (!test_bit(STATUS_READY, &priv->status) ||
70 !test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) || 70 !test_bit(STATUS_GEO_CONFIGURED, &priv->status) ||
71 !test_bit(STATUS_SCAN_HW, &priv->shrd->status) || 71 !test_bit(STATUS_SCAN_HW, &priv->status) ||
72 test_bit(STATUS_FW_ERROR, &priv->shrd->status)) 72 test_bit(STATUS_FW_ERROR, &priv->shrd->status))
73 return -EIO; 73 return -EIO;
74 74
@@ -118,18 +118,18 @@ static void iwl_process_scan_complete(struct iwl_priv *priv)
118 118
119 lockdep_assert_held(&priv->mutex); 119 lockdep_assert_held(&priv->mutex);
120 120
121 if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status)) 121 if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->status))
122 return; 122 return;
123 123
124 IWL_DEBUG_SCAN(priv, "Completed scan.\n"); 124 IWL_DEBUG_SCAN(priv, "Completed scan.\n");
125 125
126 cancel_delayed_work(&priv->scan_check); 126 cancel_delayed_work(&priv->scan_check);
127 127
128 aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status); 128 aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status);
129 if (aborted) 129 if (aborted)
130 IWL_DEBUG_SCAN(priv, "Aborted scan completed.\n"); 130 IWL_DEBUG_SCAN(priv, "Aborted scan completed.\n");
131 131
132 if (!test_and_clear_bit(STATUS_SCANNING, &priv->shrd->status)) { 132 if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) {
133 IWL_DEBUG_SCAN(priv, "Scan already completed.\n"); 133 IWL_DEBUG_SCAN(priv, "Scan already completed.\n");
134 goto out_settings; 134 goto out_settings;
135 } 135 }
@@ -165,7 +165,7 @@ out_complete:
165 165
166out_settings: 166out_settings:
167 /* Can we still talk to firmware ? */ 167 /* Can we still talk to firmware ? */
168 if (!iwl_is_ready_rf(priv->shrd)) 168 if (!iwl_is_ready_rf(priv))
169 return; 169 return;
170 170
171 iwlagn_post_scan(priv); 171 iwlagn_post_scan(priv);
@@ -175,16 +175,16 @@ void iwl_force_scan_end(struct iwl_priv *priv)
175{ 175{
176 lockdep_assert_held(&priv->mutex); 176 lockdep_assert_held(&priv->mutex);
177 177
178 if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) { 178 if (!test_bit(STATUS_SCANNING, &priv->status)) {
179 IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n"); 179 IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n");
180 return; 180 return;
181 } 181 }
182 182
183 IWL_DEBUG_SCAN(priv, "Forcing scan end\n"); 183 IWL_DEBUG_SCAN(priv, "Forcing scan end\n");
184 clear_bit(STATUS_SCANNING, &priv->shrd->status); 184 clear_bit(STATUS_SCANNING, &priv->status);
185 clear_bit(STATUS_SCAN_HW, &priv->shrd->status); 185 clear_bit(STATUS_SCAN_HW, &priv->status);
186 clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status); 186 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
187 clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status); 187 clear_bit(STATUS_SCAN_COMPLETE, &priv->status);
188 iwl_complete_scan(priv, true); 188 iwl_complete_scan(priv, true);
189} 189}
190 190
@@ -194,12 +194,12 @@ static void iwl_do_scan_abort(struct iwl_priv *priv)
194 194
195 lockdep_assert_held(&priv->mutex); 195 lockdep_assert_held(&priv->mutex);
196 196
197 if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) { 197 if (!test_bit(STATUS_SCANNING, &priv->status)) {
198 IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n"); 198 IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n");
199 return; 199 return;
200 } 200 }
201 201
202 if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->shrd->status)) { 202 if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) {
203 IWL_DEBUG_SCAN(priv, "Scan abort in progress\n"); 203 IWL_DEBUG_SCAN(priv, "Scan abort in progress\n");
204 return; 204 return;
205 } 205 }
@@ -238,7 +238,7 @@ void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
238 iwl_do_scan_abort(priv); 238 iwl_do_scan_abort(priv);
239 239
240 while (time_before_eq(jiffies, timeout)) { 240 while (time_before_eq(jiffies, timeout)) {
241 if (!test_bit(STATUS_SCAN_HW, &priv->shrd->status)) 241 if (!test_bit(STATUS_SCAN_HW, &priv->status))
242 goto finished; 242 goto finished;
243 msleep(20); 243 msleep(20);
244 } 244 }
@@ -350,8 +350,8 @@ static int iwl_rx_scan_complete_notif(struct iwl_priv *priv,
350 * to clear, we need to set SCAN_COMPLETE before clearing SCAN_HW 350 * to clear, we need to set SCAN_COMPLETE before clearing SCAN_HW
351 * to avoid a race there. 351 * to avoid a race there.
352 */ 352 */
353 set_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status); 353 set_bit(STATUS_SCAN_COMPLETE, &priv->status);
354 clear_bit(STATUS_SCAN_HW, &priv->shrd->status); 354 clear_bit(STATUS_SCAN_HW, &priv->status);
355 queue_work(priv->workqueue, &priv->scan_completed); 355 queue_work(priv->workqueue, &priv->scan_completed);
356 356
357 if (priv->iw_mode != NL80211_IFTYPE_ADHOC && 357 if (priv->iw_mode != NL80211_IFTYPE_ADHOC &&
@@ -927,7 +927,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
927 scan->len = cpu_to_le16(cmd.len[0]); 927 scan->len = cpu_to_le16(cmd.len[0]);
928 928
929 /* set scan bit here for PAN params */ 929 /* set scan bit here for PAN params */
930 set_bit(STATUS_SCAN_HW, &priv->shrd->status); 930 set_bit(STATUS_SCAN_HW, &priv->status);
931 931
932 ret = iwlagn_set_pan_params(priv); 932 ret = iwlagn_set_pan_params(priv);
933 if (ret) 933 if (ret)
@@ -935,7 +935,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
935 935
936 ret = iwl_dvm_send_cmd(priv, &cmd); 936 ret = iwl_dvm_send_cmd(priv, &cmd);
937 if (ret) { 937 if (ret) {
938 clear_bit(STATUS_SCAN_HW, &priv->shrd->status); 938 clear_bit(STATUS_SCAN_HW, &priv->status);
939 iwlagn_set_pan_params(priv); 939 iwlagn_set_pan_params(priv);
940 } 940 }
941 941
@@ -962,18 +962,18 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
962 962
963 cancel_delayed_work(&priv->scan_check); 963 cancel_delayed_work(&priv->scan_check);
964 964
965 if (!iwl_is_ready_rf(priv->shrd)) { 965 if (!iwl_is_ready_rf(priv)) {
966 IWL_WARN(priv, "Request scan called when driver not ready.\n"); 966 IWL_WARN(priv, "Request scan called when driver not ready.\n");
967 return -EIO; 967 return -EIO;
968 } 968 }
969 969
970 if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) { 970 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
971 IWL_DEBUG_SCAN(priv, 971 IWL_DEBUG_SCAN(priv,
972 "Multiple concurrent scan requests in parallel.\n"); 972 "Multiple concurrent scan requests in parallel.\n");
973 return -EBUSY; 973 return -EBUSY;
974 } 974 }
975 975
976 if (test_bit(STATUS_SCAN_ABORTING, &priv->shrd->status)) { 976 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
977 IWL_DEBUG_SCAN(priv, "Scan request while abort pending.\n"); 977 IWL_DEBUG_SCAN(priv, "Scan request while abort pending.\n");
978 return -EBUSY; 978 return -EBUSY;
979 } 979 }
@@ -983,14 +983,14 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
983 scan_type == IWL_SCAN_ROC ? "remain-on-channel " : 983 scan_type == IWL_SCAN_ROC ? "remain-on-channel " :
984 "internal short "); 984 "internal short ");
985 985
986 set_bit(STATUS_SCANNING, &priv->shrd->status); 986 set_bit(STATUS_SCANNING, &priv->status);
987 priv->scan_type = scan_type; 987 priv->scan_type = scan_type;
988 priv->scan_start = jiffies; 988 priv->scan_start = jiffies;
989 priv->scan_band = band; 989 priv->scan_band = band;
990 990
991 ret = iwlagn_request_scan(priv, vif); 991 ret = iwlagn_request_scan(priv, vif);
992 if (ret) { 992 if (ret) {
993 clear_bit(STATUS_SCANNING, &priv->shrd->status); 993 clear_bit(STATUS_SCANNING, &priv->status);
994 priv->scan_type = IWL_SCAN_NORMAL; 994 priv->scan_type = IWL_SCAN_NORMAL;
995 return ret; 995 return ret;
996 } 996 }
@@ -1025,7 +1025,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
1025 goto unlock; 1025 goto unlock;
1026 } 1026 }
1027 1027
1028 if (test_bit(STATUS_SCANNING, &priv->shrd->status)) { 1028 if (test_bit(STATUS_SCANNING, &priv->status)) {
1029 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); 1029 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
1030 goto unlock; 1030 goto unlock;
1031 } 1031 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 16a32ae4046e..dd64e69b1569 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -356,7 +356,8 @@ void iwl_dump_csr(struct iwl_trans *trans);
356******************************************************/ 356******************************************************/
357static inline void iwl_disable_interrupts(struct iwl_trans *trans) 357static inline void iwl_disable_interrupts(struct iwl_trans *trans)
358{ 358{
359 clear_bit(STATUS_INT_ENABLED, &trans->shrd->status); 359 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
360 clear_bit(STATUS_INT_ENABLED, &trans_pcie->status);
360 361
361 /* disable interrupts from uCode/NIC to host */ 362 /* disable interrupts from uCode/NIC to host */
362 iwl_write32(trans, CSR_INT_MASK, 0x00000000); 363 iwl_write32(trans, CSR_INT_MASK, 0x00000000);
@@ -370,11 +371,10 @@ static inline void iwl_disable_interrupts(struct iwl_trans *trans)
370 371
371static inline void iwl_enable_interrupts(struct iwl_trans *trans) 372static inline void iwl_enable_interrupts(struct iwl_trans *trans)
372{ 373{
373 struct iwl_trans_pcie *trans_pcie = 374 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
374 IWL_TRANS_GET_PCIE_TRANS(trans);
375 375
376 IWL_DEBUG_ISR(trans, "Enabling interrupts\n"); 376 IWL_DEBUG_ISR(trans, "Enabling interrupts\n");
377 set_bit(STATUS_INT_ENABLED, &trans->shrd->status); 377 set_bit(STATUS_INT_ENABLED, &trans_pcie->status);
378 iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask); 378 iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
379} 379}
380 380
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 2d6ea42b0d8e..32820913a2fd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -1131,7 +1131,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
1131 1131
1132 /* Re-enable all interrupts */ 1132 /* Re-enable all interrupts */
1133 /* only Re-enable if disabled by irq */ 1133 /* only Re-enable if disabled by irq */
1134 if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status)) 1134 if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status))
1135 iwl_enable_interrupts(trans); 1135 iwl_enable_interrupts(trans);
1136 /* Re-enable RF_KILL if it occurred */ 1136 /* Re-enable RF_KILL if it occurred */
1137 else if (handled & CSR_INT_BIT_RF_KILL) 1137 else if (handled & CSR_INT_BIT_RF_KILL)
@@ -1303,7 +1303,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
1303 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 1303 /* iwl_irq_tasklet() will service interrupts and re-enable them */
1304 if (likely(inta)) 1304 if (likely(inta))
1305 tasklet_schedule(&trans_pcie->irq_tasklet); 1305 tasklet_schedule(&trans_pcie->irq_tasklet);
1306 else if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) && 1306 else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
1307 !trans_pcie->inta) 1307 !trans_pcie->inta)
1308 iwl_enable_interrupts(trans); 1308 iwl_enable_interrupts(trans);
1309 1309
@@ -1314,7 +1314,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
1314 none: 1314 none:
1315 /* re-enable interrupts here since we don't have anything to service. */ 1315 /* re-enable interrupts here since we don't have anything to service. */
1316 /* only Re-enable if disabled by irq and no schedules tasklet. */ 1316 /* only Re-enable if disabled by irq and no schedules tasklet. */
1317 if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) && 1317 if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
1318 !trans_pcie->inta) 1318 !trans_pcie->inta)
1319 iwl_enable_interrupts(trans); 1319 iwl_enable_interrupts(trans);
1320 1320
@@ -1414,7 +1414,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
1414 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 1414 /* iwl_irq_tasklet() will service interrupts and re-enable them */
1415 if (likely(inta)) 1415 if (likely(inta))
1416 tasklet_schedule(&trans_pcie->irq_tasklet); 1416 tasklet_schedule(&trans_pcie->irq_tasklet);
1417 else if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) && 1417 else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
1418 !trans_pcie->inta) { 1418 !trans_pcie->inta) {
1419 /* Allow interrupt if was disabled by this handler and 1419 /* Allow interrupt if was disabled by this handler and
1420 * no tasklet was schedules, We should not enable interrupt, 1420 * no tasklet was schedules, We should not enable interrupt,
@@ -1430,7 +1430,7 @@ irqreturn_t iwl_isr_ict(int irq, void *data)
1430 /* re-enable interrupts here since we don't have anything to service. 1430 /* re-enable interrupts here since we don't have anything to service.
1431 * only Re-enable if disabled by irq. 1431 * only Re-enable if disabled by irq.
1432 */ 1432 */
1433 if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) && 1433 if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
1434 !trans_pcie->inta) 1434 !trans_pcie->inta)
1435 iwl_enable_interrupts(trans); 1435 iwl_enable_interrupts(trans);
1436 1436
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index e78098e79ee1..3b8a5fb771f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -684,6 +684,7 @@ static void iwl_apm_config(struct iwl_trans *trans)
684 */ 684 */
685static int iwl_apm_init(struct iwl_trans *trans) 685static int iwl_apm_init(struct iwl_trans *trans)
686{ 686{
687 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
687 int ret = 0; 688 int ret = 0;
688 IWL_DEBUG_INFO(trans, "Init card's basic functions\n"); 689 IWL_DEBUG_INFO(trans, "Init card's basic functions\n");
689 690
@@ -753,7 +754,7 @@ static int iwl_apm_init(struct iwl_trans *trans)
753 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG, 754 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
754 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 755 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
755 756
756 set_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status); 757 set_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status);
757 758
758out: 759out:
759 return ret; 760 return ret;
@@ -779,9 +780,10 @@ static int iwl_apm_stop_master(struct iwl_trans *trans)
779 780
780static void iwl_apm_stop(struct iwl_trans *trans) 781static void iwl_apm_stop(struct iwl_trans *trans)
781{ 782{
783 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
782 IWL_DEBUG_INFO(trans, "Stop card, put in low power state\n"); 784 IWL_DEBUG_INFO(trans, "Stop card, put in low power state\n");
783 785
784 clear_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status); 786 clear_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status);
785 787
786 /* Stop device's DMA activity */ 788 /* Stop device's DMA activity */
787 iwl_apm_stop_master(trans); 789 iwl_apm_stop_master(trans);
@@ -1265,7 +1267,7 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
1265 * restart. So don't process again if the device is 1267 * restart. So don't process again if the device is
1266 * already dead. 1268 * already dead.
1267 */ 1269 */
1268 if (test_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status)) { 1270 if (test_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status)) {
1269 iwl_trans_tx_stop(trans); 1271 iwl_trans_tx_stop(trans);
1270#ifndef CONFIG_IWLWIFI_IDI 1272#ifndef CONFIG_IWLWIFI_IDI
1271 iwl_trans_rx_stop(trans); 1273 iwl_trans_rx_stop(trans);