diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-08-26 02:11:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-29 15:25:35 -0400 |
commit | 845a9c0d8acea87dede740bc5feb9ec2d00505d9 (patch) | |
tree | e158e899b61d5e5b92c50e905a258d857015c764 | |
parent | effcea16e554b4d7497bbcfc80b9baca8e017691 (diff) |
iwlagn: move all iwl_is_XXX helpers to iwl-shared.h
Logic move after all priv->status moved to struct iwl_shared
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-sta.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-tt.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 66 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-power.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-shared.h | 65 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.c | 2 |
14 files changed, 100 insertions, 101 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c index 991977e2e1b0..7ce56ff4a525 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | |||
@@ -426,7 +426,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
426 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) | 426 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) |
427 | return -EINVAL; | 427 | return -EINVAL; |
428 | 428 | ||
429 | if (!iwl_is_alive(priv)) | 429 | if (!iwl_is_alive(priv->shrd)) |
430 | return -EBUSY; | 430 | return -EBUSY; |
431 | 431 | ||
432 | /* This function hardcodes a bunch of dual-mode assumptions */ | 432 | /* This function hardcodes a bunch of dual-mode assumptions */ |
@@ -544,7 +544,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
544 | goto out; | 544 | goto out; |
545 | } | 545 | } |
546 | 546 | ||
547 | if (!iwl_is_ready(priv)) { | 547 | if (!iwl_is_ready(priv->shrd)) { |
548 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 548 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); |
549 | goto out; | 549 | goto out; |
550 | } | 550 | } |
@@ -794,7 +794,7 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
794 | 794 | ||
795 | mutex_lock(&priv->shrd->mutex); | 795 | mutex_lock(&priv->shrd->mutex); |
796 | 796 | ||
797 | if (unlikely(!iwl_is_ready(priv))) { | 797 | if (unlikely(!iwl_is_ready(priv->shrd))) { |
798 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 798 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); |
799 | mutex_unlock(&priv->shrd->mutex); | 799 | mutex_unlock(&priv->shrd->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 4d02c328c377..8f0b86de1863 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c | |||
@@ -214,7 +214,7 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, | |||
214 | keyconf->keyidx); | 214 | keyconf->keyidx); |
215 | 215 | ||
216 | memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); | 216 | memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); |
217 | if (iwl_is_rfkill(priv)) { | 217 | if (iwl_is_rfkill(priv->shrd)) { |
218 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); | 218 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); |
219 | /* but keys in device are clear anyway so return success */ | 219 | /* but keys in device are clear anyway so return success */ |
220 | return 0; | 220 | return 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c index 03d8389d8ef8..1a39aafb3b05 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c | |||
@@ -511,7 +511,7 @@ static void iwl_bg_ct_enter(struct work_struct *work) | |||
511 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) | 511 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) |
512 | return; | 512 | return; |
513 | 513 | ||
514 | if (!iwl_is_ready(priv)) | 514 | if (!iwl_is_ready(priv->shrd)) |
515 | return; | 515 | return; |
516 | 516 | ||
517 | if (tt->state != IWL_TI_CT_KILL) { | 517 | if (tt->state != IWL_TI_CT_KILL) { |
@@ -540,7 +540,7 @@ static void iwl_bg_ct_exit(struct work_struct *work) | |||
540 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) | 540 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) |
541 | return; | 541 | return; |
542 | 542 | ||
543 | if (!iwl_is_ready(priv)) | 543 | if (!iwl_is_ready(priv->shrd)) |
544 | return; | 544 | return; |
545 | 545 | ||
546 | /* stop ct_kill_exit_tm timer */ | 546 | /* stop ct_kill_exit_tm timer */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index e95f9c61f95a..97d03a85d579 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -338,7 +338,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
338 | ctx = iwl_rxon_ctx_from_vif(info->control.vif); | 338 | ctx = iwl_rxon_ctx_from_vif(info->control.vif); |
339 | 339 | ||
340 | spin_lock_irqsave(&priv->shrd->lock, flags); | 340 | spin_lock_irqsave(&priv->shrd->lock, flags); |
341 | if (iwl_is_rfkill(priv)) { | 341 | if (iwl_is_rfkill(priv->shrd)) { |
342 | IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); | 342 | IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); |
343 | goto drop_unlock_priv; | 343 | goto drop_unlock_priv; |
344 | } | 344 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index a79ee7a451d1..f559c6362a00 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -251,7 +251,7 @@ static void iwl_bg_bt_runtime_config(struct work_struct *work) | |||
251 | return; | 251 | return; |
252 | 252 | ||
253 | /* dont send host command if rf-kill is on */ | 253 | /* dont send host command if rf-kill is on */ |
254 | if (!iwl_is_ready_rf(priv)) | 254 | if (!iwl_is_ready_rf(priv->shrd)) |
255 | return; | 255 | return; |
256 | iwlagn_send_advance_bt_config(priv); | 256 | iwlagn_send_advance_bt_config(priv); |
257 | } | 257 | } |
@@ -268,7 +268,7 @@ static void iwl_bg_bt_full_concurrency(struct work_struct *work) | |||
268 | goto out; | 268 | goto out; |
269 | 269 | ||
270 | /* dont send host command if rf-kill is on */ | 270 | /* dont send host command if rf-kill is on */ |
271 | if (!iwl_is_ready_rf(priv)) | 271 | if (!iwl_is_ready_rf(priv->shrd)) |
272 | goto out; | 272 | goto out; |
273 | 273 | ||
274 | IWL_DEBUG_INFO(priv, "BT coex in %s mode\n", | 274 | IWL_DEBUG_INFO(priv, "BT coex in %s mode\n", |
@@ -307,7 +307,7 @@ static void iwl_bg_statistics_periodic(unsigned long data) | |||
307 | return; | 307 | return; |
308 | 308 | ||
309 | /* dont send host command if rf-kill is on */ | 309 | /* dont send host command if rf-kill is on */ |
310 | if (!iwl_is_ready_rf(priv)) | 310 | if (!iwl_is_ready_rf(priv->shrd)) |
311 | return; | 311 | return; |
312 | 312 | ||
313 | iwl_send_statistics_request(priv, CMD_ASYNC, false); | 313 | iwl_send_statistics_request(priv, CMD_ASYNC, false); |
@@ -444,7 +444,7 @@ static void iwl_bg_tx_flush(struct work_struct *work) | |||
444 | return; | 444 | return; |
445 | 445 | ||
446 | /* do nothing if rf-kill is on */ | 446 | /* do nothing if rf-kill is on */ |
447 | if (!iwl_is_ready_rf(priv)) | 447 | if (!iwl_is_ready_rf(priv->shrd)) |
448 | return; | 448 | return; |
449 | 449 | ||
450 | IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n"); | 450 | IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n"); |
@@ -510,7 +510,7 @@ static ssize_t show_temperature(struct device *d, | |||
510 | struct iwl_shared *shrd = dev_get_drvdata(d); | 510 | struct iwl_shared *shrd = dev_get_drvdata(d); |
511 | struct iwl_priv *priv = shrd->priv; | 511 | struct iwl_priv *priv = shrd->priv; |
512 | 512 | ||
513 | if (!iwl_is_alive(priv)) | 513 | if (!iwl_is_alive(priv->shrd)) |
514 | return -EAGAIN; | 514 | return -EAGAIN; |
515 | 515 | ||
516 | return sprintf(buf, "%d\n", priv->temperature); | 516 | return sprintf(buf, "%d\n", priv->temperature); |
@@ -523,7 +523,7 @@ static ssize_t show_tx_power(struct device *d, | |||
523 | { | 523 | { |
524 | struct iwl_priv *priv = dev_get_drvdata(d); | 524 | struct iwl_priv *priv = dev_get_drvdata(d); |
525 | 525 | ||
526 | if (!iwl_is_ready_rf(priv)) | 526 | if (!iwl_is_ready_rf(priv->shrd)) |
527 | return sprintf(buf, "off\n"); | 527 | return sprintf(buf, "off\n"); |
528 | else | 528 | else |
529 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); | 529 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); |
@@ -1412,7 +1412,7 @@ int iwl_alive_start(struct iwl_priv *priv) | |||
1412 | /* Enable watchdog to monitor the driver tx queues */ | 1412 | /* Enable watchdog to monitor the driver tx queues */ |
1413 | iwl_setup_watchdog(priv); | 1413 | iwl_setup_watchdog(priv); |
1414 | 1414 | ||
1415 | if (iwl_is_rfkill(priv)) | 1415 | if (iwl_is_rfkill(priv->shrd)) |
1416 | return -ERFKILL; | 1416 | return -ERFKILL; |
1417 | 1417 | ||
1418 | /* download priority table before any calibration request */ | 1418 | /* download priority table before any calibration request */ |
@@ -2701,7 +2701,7 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, | |||
2701 | 2701 | ||
2702 | mutex_lock(&priv->shrd->mutex); | 2702 | mutex_lock(&priv->shrd->mutex); |
2703 | 2703 | ||
2704 | if (iwl_is_rfkill(priv)) | 2704 | if (iwl_is_rfkill(priv->shrd)) |
2705 | goto out; | 2705 | goto out; |
2706 | 2706 | ||
2707 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) || | 2707 | if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) || |
@@ -2836,7 +2836,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) | |||
2836 | IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); | 2836 | IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); |
2837 | goto done; | 2837 | goto done; |
2838 | } | 2838 | } |
2839 | if (iwl_is_rfkill(priv)) { | 2839 | if (iwl_is_rfkill(priv->shrd)) { |
2840 | IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n"); | 2840 | IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n"); |
2841 | goto done; | 2841 | goto done; |
2842 | } | 2842 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 347cbec935b9..cfc23c25e979 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1051,7 +1051,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | |||
1051 | return -EINVAL; | 1051 | return -EINVAL; |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | if (!iwl_is_ready_rf(priv)) | 1054 | if (!iwl_is_ready_rf(priv->shrd)) |
1055 | return -EIO; | 1055 | return -EIO; |
1056 | 1056 | ||
1057 | /* scan complete and commit_rxon use tx_power_next value, | 1057 | /* scan complete and commit_rxon use tx_power_next value, |
@@ -1131,7 +1131,7 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1131 | 1131 | ||
1132 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 1132 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
1133 | 1133 | ||
1134 | if (!iwl_is_ready_rf(priv)) { | 1134 | if (!iwl_is_ready_rf(priv->shrd)) { |
1135 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | 1135 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); |
1136 | return -EIO; | 1136 | return -EIO; |
1137 | } | 1137 | } |
@@ -1237,7 +1237,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
1237 | 1237 | ||
1238 | iwlagn_disable_roc(priv); | 1238 | iwlagn_disable_roc(priv); |
1239 | 1239 | ||
1240 | if (!iwl_is_ready_rf(priv)) { | 1240 | if (!iwl_is_ready_rf(priv->shrd)) { |
1241 | IWL_WARN(priv, "Try to add interface when device not ready\n"); | 1241 | IWL_WARN(priv, "Try to add interface when device not ready\n"); |
1242 | err = -EINVAL; | 1242 | err = -EINVAL; |
1243 | goto out; | 1243 | goto out; |
@@ -1657,7 +1657,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
1657 | 1657 | ||
1658 | mutex_lock(&priv->shrd->mutex); | 1658 | mutex_lock(&priv->shrd->mutex); |
1659 | 1659 | ||
1660 | if (!ctx->vif || !iwl_is_ready_rf(priv)) { | 1660 | if (!ctx->vif || !iwl_is_ready_rf(priv->shrd)) { |
1661 | /* | 1661 | /* |
1662 | * Huh? But wait ... this can maybe happen when | 1662 | * Huh? But wait ... this can maybe happen when |
1663 | * we're in the middle of a firmware restart! | 1663 | * we're in the middle of a firmware restart! |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 110ffaea0949..e5b3c356b392 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -393,72 +393,6 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, | |||
393 | int iwl_init_geos(struct iwl_priv *priv); | 393 | int iwl_init_geos(struct iwl_priv *priv); |
394 | void iwl_free_geos(struct iwl_priv *priv); | 394 | void iwl_free_geos(struct iwl_priv *priv); |
395 | 395 | ||
396 | /*************** DRIVER STATUS FUNCTIONS *****/ | ||
397 | |||
398 | #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ | ||
399 | /* 1 is unused (used to be STATUS_HCMD_SYNC_ACTIVE) */ | ||
400 | #define STATUS_INT_ENABLED 2 | ||
401 | #define STATUS_RF_KILL_HW 3 | ||
402 | #define STATUS_CT_KILL 4 | ||
403 | #define STATUS_INIT 5 | ||
404 | #define STATUS_ALIVE 6 | ||
405 | #define STATUS_READY 7 | ||
406 | #define STATUS_TEMPERATURE 8 | ||
407 | #define STATUS_GEO_CONFIGURED 9 | ||
408 | #define STATUS_EXIT_PENDING 10 | ||
409 | #define STATUS_STATISTICS 12 | ||
410 | #define STATUS_SCANNING 13 | ||
411 | #define STATUS_SCAN_ABORTING 14 | ||
412 | #define STATUS_SCAN_HW 15 | ||
413 | #define STATUS_POWER_PMI 16 | ||
414 | #define STATUS_FW_ERROR 17 | ||
415 | #define STATUS_DEVICE_ENABLED 18 | ||
416 | #define STATUS_CHANNEL_SWITCH_PENDING 19 | ||
417 | |||
418 | |||
419 | static inline int iwl_is_ready(struct iwl_priv *priv) | ||
420 | { | ||
421 | /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are | ||
422 | * set but EXIT_PENDING is not */ | ||
423 | return test_bit(STATUS_READY, &priv->shrd->status) && | ||
424 | test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) && | ||
425 | !test_bit(STATUS_EXIT_PENDING, &priv->shrd->status); | ||
426 | } | ||
427 | |||
428 | static inline int iwl_is_alive(struct iwl_priv *priv) | ||
429 | { | ||
430 | return test_bit(STATUS_ALIVE, &priv->shrd->status); | ||
431 | } | ||
432 | |||
433 | static inline int iwl_is_init(struct iwl_priv *priv) | ||
434 | { | ||
435 | return test_bit(STATUS_INIT, &priv->shrd->status); | ||
436 | } | ||
437 | |||
438 | static inline int iwl_is_rfkill_hw(struct iwl_priv *priv) | ||
439 | { | ||
440 | return test_bit(STATUS_RF_KILL_HW, &priv->shrd->status); | ||
441 | } | ||
442 | |||
443 | static inline int iwl_is_rfkill(struct iwl_priv *priv) | ||
444 | { | ||
445 | return iwl_is_rfkill_hw(priv); | ||
446 | } | ||
447 | |||
448 | static inline int iwl_is_ctkill(struct iwl_priv *priv) | ||
449 | { | ||
450 | return test_bit(STATUS_CT_KILL, &priv->shrd->status); | ||
451 | } | ||
452 | |||
453 | static inline int iwl_is_ready_rf(struct iwl_priv *priv) | ||
454 | { | ||
455 | |||
456 | if (iwl_is_rfkill(priv)) | ||
457 | return 0; | ||
458 | |||
459 | return iwl_is_ready(priv); | ||
460 | } | ||
461 | |||
462 | extern void iwl_send_bt_config(struct iwl_priv *priv); | 396 | extern void iwl_send_bt_config(struct iwl_priv *priv); |
463 | extern int iwl_send_statistics_request(struct iwl_priv *priv, | 397 | extern int iwl_send_statistics_request(struct iwl_priv *priv, |
464 | u8 flags, bool clear); | 398 | u8 flags, bool clear); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 787dae5fec99..9ca429c23ad1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -740,7 +740,7 @@ static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file, | |||
740 | if (value != -1 && (value < 0 || value >= IWL_POWER_NUM)) | 740 | if (value != -1 && (value < 0 || value >= IWL_POWER_NUM)) |
741 | return -EINVAL; | 741 | return -EINVAL; |
742 | 742 | ||
743 | if (!iwl_is_ready_rf(priv)) | 743 | if (!iwl_is_ready_rf(priv->shrd)) |
744 | return -EAGAIN; | 744 | return -EAGAIN; |
745 | 745 | ||
746 | priv->power_data.debug_sleep_level_override = value; | 746 | priv->power_data.debug_sleep_level_override = value; |
@@ -851,7 +851,7 @@ static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, | |||
851 | struct statistics_rx_non_phy *delta_general, *max_general; | 851 | struct statistics_rx_non_phy *delta_general, *max_general; |
852 | struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; | 852 | struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; |
853 | 853 | ||
854 | if (!iwl_is_alive(priv)) | 854 | if (!iwl_is_alive(priv->shrd)) |
855 | return -EAGAIN; | 855 | return -EAGAIN; |
856 | 856 | ||
857 | buf = kzalloc(bufsz, GFP_KERNEL); | 857 | buf = kzalloc(bufsz, GFP_KERNEL); |
@@ -1277,7 +1277,7 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, | |||
1277 | ssize_t ret; | 1277 | ssize_t ret; |
1278 | struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; | 1278 | struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; |
1279 | 1279 | ||
1280 | if (!iwl_is_alive(priv)) | 1280 | if (!iwl_is_alive(priv->shrd)) |
1281 | return -EAGAIN; | 1281 | return -EAGAIN; |
1282 | 1282 | ||
1283 | buf = kzalloc(bufsz, GFP_KERNEL); | 1283 | buf = kzalloc(bufsz, GFP_KERNEL); |
@@ -1471,7 +1471,7 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, | |||
1471 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; | 1471 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
1472 | struct statistics_div *div, *accum_div, *delta_div, *max_div; | 1472 | struct statistics_div *div, *accum_div, *delta_div, *max_div; |
1473 | 1473 | ||
1474 | if (!iwl_is_alive(priv)) | 1474 | if (!iwl_is_alive(priv->shrd)) |
1475 | return -EAGAIN; | 1475 | return -EAGAIN; |
1476 | 1476 | ||
1477 | buf = kzalloc(bufsz, GFP_KERNEL); | 1477 | buf = kzalloc(bufsz, GFP_KERNEL); |
@@ -1584,7 +1584,7 @@ static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, | |||
1584 | ssize_t ret; | 1584 | ssize_t ret; |
1585 | struct statistics_bt_activity *bt, *accum_bt; | 1585 | struct statistics_bt_activity *bt, *accum_bt; |
1586 | 1586 | ||
1587 | if (!iwl_is_alive(priv)) | 1587 | if (!iwl_is_alive(priv->shrd)) |
1588 | return -EAGAIN; | 1588 | return -EAGAIN; |
1589 | 1589 | ||
1590 | if (!priv->bt_enable_flag) | 1590 | if (!priv->bt_enable_flag) |
@@ -1672,7 +1672,7 @@ static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file, | |||
1672 | (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200; | 1672 | (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200; |
1673 | ssize_t ret; | 1673 | ssize_t ret; |
1674 | 1674 | ||
1675 | if (!iwl_is_alive(priv)) | 1675 | if (!iwl_is_alive(priv->shrd)) |
1676 | return -EAGAIN; | 1676 | return -EAGAIN; |
1677 | 1677 | ||
1678 | buf = kzalloc(bufsz, GFP_KERNEL); | 1678 | buf = kzalloc(bufsz, GFP_KERNEL); |
@@ -2259,7 +2259,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file, | |||
2259 | if (sscanf(buf, "%d", &flush) != 1) | 2259 | if (sscanf(buf, "%d", &flush) != 1) |
2260 | return -EINVAL; | 2260 | return -EINVAL; |
2261 | 2261 | ||
2262 | if (iwl_is_rfkill(priv)) | 2262 | if (iwl_is_rfkill(priv->shrd)) |
2263 | return -EFAULT; | 2263 | return -EFAULT; |
2264 | 2264 | ||
2265 | iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); | 2265 | iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 9f0e620fc3a1..2c91a48b8010 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -392,7 +392,7 @@ 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)) | 395 | if (!iwl_is_ready_rf(priv->shrd)) |
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 */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 1a0cb66d7bae..2bb94f7351c9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -362,7 +362,7 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv, | |||
362 | 362 | ||
363 | cancel_delayed_work(&priv->scan_check); | 363 | cancel_delayed_work(&priv->scan_check); |
364 | 364 | ||
365 | if (!iwl_is_ready_rf(priv)) { | 365 | if (!iwl_is_ready_rf(priv->shrd)) { |
366 | IWL_WARN(priv, "Request scan called when driver not ready.\n"); | 366 | IWL_WARN(priv, "Request scan called when driver not ready.\n"); |
367 | return -EIO; | 367 | return -EIO; |
368 | } | 368 | } |
@@ -606,7 +606,7 @@ out_complete: | |||
606 | 606 | ||
607 | out_settings: | 607 | out_settings: |
608 | /* Can we still talk to firmware ? */ | 608 | /* Can we still talk to firmware ? */ |
609 | if (!iwl_is_ready_rf(priv)) | 609 | if (!iwl_is_ready_rf(priv->shrd)) |
610 | goto out; | 610 | goto out; |
611 | 611 | ||
612 | iwlagn_post_scan(priv); | 612 | iwlagn_post_scan(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h index fd9a9224edfc..ff4c04fee429 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h | |||
@@ -246,4 +246,69 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, | |||
246 | struct iwl_cfg *cfg); | 246 | struct iwl_cfg *cfg); |
247 | void __devexit iwl_remove(struct iwl_priv * priv); | 247 | void __devexit iwl_remove(struct iwl_priv * priv); |
248 | 248 | ||
249 | /***************************************************** | ||
250 | * DRIVER STATUS FUNCTIONS | ||
251 | ******************************************************/ | ||
252 | #define STATUS_HCMD_ACTIVE 0 /* host command in progress */ | ||
253 | /* 1 is unused (used to be STATUS_HCMD_SYNC_ACTIVE) */ | ||
254 | #define STATUS_INT_ENABLED 2 | ||
255 | #define STATUS_RF_KILL_HW 3 | ||
256 | #define STATUS_CT_KILL 4 | ||
257 | #define STATUS_INIT 5 | ||
258 | #define STATUS_ALIVE 6 | ||
259 | #define STATUS_READY 7 | ||
260 | #define STATUS_TEMPERATURE 8 | ||
261 | #define STATUS_GEO_CONFIGURED 9 | ||
262 | #define STATUS_EXIT_PENDING 10 | ||
263 | #define STATUS_STATISTICS 12 | ||
264 | #define STATUS_SCANNING 13 | ||
265 | #define STATUS_SCAN_ABORTING 14 | ||
266 | #define STATUS_SCAN_HW 15 | ||
267 | #define STATUS_POWER_PMI 16 | ||
268 | #define STATUS_FW_ERROR 17 | ||
269 | #define STATUS_DEVICE_ENABLED 18 | ||
270 | #define STATUS_CHANNEL_SWITCH_PENDING 19 | ||
271 | |||
272 | static inline int iwl_is_ready(struct iwl_shared *shrd) | ||
273 | { | ||
274 | /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are | ||
275 | * set but EXIT_PENDING is not */ | ||
276 | return test_bit(STATUS_READY, &shrd->status) && | ||
277 | test_bit(STATUS_GEO_CONFIGURED, &shrd->status) && | ||
278 | !test_bit(STATUS_EXIT_PENDING, &shrd->status); | ||
279 | } | ||
280 | |||
281 | static inline int iwl_is_alive(struct iwl_shared *shrd) | ||
282 | { | ||
283 | return test_bit(STATUS_ALIVE, &shrd->status); | ||
284 | } | ||
285 | |||
286 | static inline int iwl_is_init(struct iwl_shared *shrd) | ||
287 | { | ||
288 | return test_bit(STATUS_INIT, &shrd->status); | ||
289 | } | ||
290 | |||
291 | static inline int iwl_is_rfkill_hw(struct iwl_shared *shrd) | ||
292 | { | ||
293 | return test_bit(STATUS_RF_KILL_HW, &shrd->status); | ||
294 | } | ||
295 | |||
296 | static inline int iwl_is_rfkill(struct iwl_shared *shrd) | ||
297 | { | ||
298 | return iwl_is_rfkill_hw(shrd); | ||
299 | } | ||
300 | |||
301 | static inline int iwl_is_ctkill(struct iwl_shared *shrd) | ||
302 | { | ||
303 | return test_bit(STATUS_CT_KILL, &shrd->status); | ||
304 | } | ||
305 | |||
306 | static inline int iwl_is_ready_rf(struct iwl_shared *shrd) | ||
307 | { | ||
308 | if (iwl_is_rfkill(shrd)) | ||
309 | return 0; | ||
310 | |||
311 | return iwl_is_ready(shrd); | ||
312 | } | ||
313 | |||
249 | #endif /* #__iwl_shared_h__ */ | 314 | #endif /* #__iwl_shared_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index d4c625c13119..1154e4843087 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -468,7 +468,7 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, | |||
468 | { | 468 | { |
469 | unsigned long flags; | 469 | unsigned long flags; |
470 | 470 | ||
471 | if (!iwl_is_ready(priv)) { | 471 | if (!iwl_is_ready(priv->shrd)) { |
472 | IWL_DEBUG_INFO(priv, | 472 | IWL_DEBUG_INFO(priv, |
473 | "Unable to remove station %pM, device not ready.\n", | 473 | "Unable to remove station %pM, device not ready.\n", |
474 | addr); | 474 | addr); |
@@ -572,7 +572,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
572 | int ret; | 572 | int ret; |
573 | bool send_lq; | 573 | bool send_lq; |
574 | 574 | ||
575 | if (!iwl_is_ready(priv)) { | 575 | if (!iwl_is_ready(priv->shrd)) { |
576 | IWL_DEBUG_INFO(priv, "Not ready yet, not restoring any stations.\n"); | 576 | IWL_DEBUG_INFO(priv, "Not ready yet, not restoring any stations.\n"); |
577 | return; | 577 | return; |
578 | } | 578 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c index a462d697a690..ac2fae12707a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c | |||
@@ -599,9 +599,9 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
599 | if (WARN_ON(copy_size > TFD_MAX_PAYLOAD_SIZE)) | 599 | if (WARN_ON(copy_size > TFD_MAX_PAYLOAD_SIZE)) |
600 | return -EINVAL; | 600 | return -EINVAL; |
601 | 601 | ||
602 | if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) { | 602 | if (iwl_is_rfkill(priv->shrd) || iwl_is_ctkill(priv->shrd)) { |
603 | IWL_WARN(priv, "Not sending command - %s KILL\n", | 603 | IWL_WARN(priv, "Not sending command - %s KILL\n", |
604 | iwl_is_rfkill(priv) ? "RF" : "CT"); | 604 | iwl_is_rfkill(priv->shrd) ? "RF" : "CT"); |
605 | return -EIO; | 605 | return -EIO; |
606 | } | 606 | } |
607 | 607 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c index a2950a4cc35c..b080e69374ea 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans.c | |||
@@ -715,7 +715,7 @@ static int iwl_trans_pcie_start_device(struct iwl_priv *priv) | |||
715 | else | 715 | else |
716 | set_bit(STATUS_RF_KILL_HW, &priv->shrd->status); | 716 | set_bit(STATUS_RF_KILL_HW, &priv->shrd->status); |
717 | 717 | ||
718 | if (iwl_is_rfkill(priv)) { | 718 | if (iwl_is_rfkill(priv->shrd)) { |
719 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); | 719 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); |
720 | iwl_enable_interrupts(trans(priv)); | 720 | iwl_enable_interrupts(trans(priv)); |
721 | return -ERFKILL; | 721 | return -ERFKILL; |