aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c36
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c36
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c18
11 files changed, 59 insertions, 60 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index ddb255a575df..8b14d24849b9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -114,7 +114,7 @@ static int iwlagn_load_section(struct iwl_priv *priv, const char *name,
114 FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); 114 FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD);
115 115
116 IWL_DEBUG_FW(priv, "%s uCode section being loaded...\n", name); 116 IWL_DEBUG_FW(priv, "%s uCode section being loaded...\n", name);
117 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 117 ret = wait_event_interruptible_timeout(priv->shrd->wait_command_queue,
118 priv->ucode_write_complete, 5 * HZ); 118 priv->ucode_write_complete, 5 * HZ);
119 if (ret == -ERESTARTSYS) { 119 if (ret == -ERESTARTSYS) {
120 IWL_ERR(priv, "Could not load the %s uCode section due " 120 IWL_ERR(priv, "Could not load the %s uCode section due "
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 8113fbe770a3..484f889a886e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3032,7 +3032,7 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
3032{ 3032{
3033 priv->shrd->workqueue = create_singlethread_workqueue(DRV_NAME); 3033 priv->shrd->workqueue = create_singlethread_workqueue(DRV_NAME);
3034 3034
3035 init_waitqueue_head(&priv->wait_command_queue); 3035 init_waitqueue_head(&priv->shrd->wait_command_queue);
3036 3036
3037 INIT_WORK(&priv->restart, iwl_bg_restart); 3037 INIT_WORK(&priv->restart, iwl_bg_restart);
3038 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); 3038 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 72b9203c06e2..d9897da7281f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -868,7 +868,7 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
868 * commands by clearing the ready bit */ 868 * commands by clearing the ready bit */
869 clear_bit(STATUS_READY, &priv->shrd->status); 869 clear_bit(STATUS_READY, &priv->shrd->status);
870 870
871 wake_up_interruptible(&priv->wait_command_queue); 871 wake_up_interruptible(&priv->shrd->wait_command_queue);
872 872
873 if (!ondemand) { 873 if (!ondemand) {
874 /* 874 /*
@@ -1865,3 +1865,8 @@ void iwl_stop_tx_ba_trans_ready(struct iwl_priv *priv,
1865 1865
1866 ieee80211_stop_tx_ba_cb_irqsafe(vif, addr, tid); 1866 ieee80211_stop_tx_ba_cb_irqsafe(vif, addr, tid);
1867} 1867}
1868
1869void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state)
1870{
1871 wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
1872}
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 1e54293532b0..8ae79e9cf5f1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -102,7 +102,7 @@ struct iwl_cmd_meta {
102 * invoked for SYNC commands, if it were and its result passed 102 * invoked for SYNC commands, if it were and its result passed
103 * through it would be simpler...) 103 * through it would be simpler...)
104 */ 104 */
105 void (*callback)(struct iwl_priv *priv, 105 void (*callback)(struct iwl_shared *shrd,
106 struct iwl_device_cmd *cmd, 106 struct iwl_device_cmd *cmd,
107 struct iwl_rx_packet *pkt); 107 struct iwl_rx_packet *pkt);
108 108
@@ -304,7 +304,7 @@ enum iwl_hcmd_dataflag {
304struct iwl_host_cmd { 304struct iwl_host_cmd {
305 const void *data[IWL_MAX_CMD_TFDS]; 305 const void *data[IWL_MAX_CMD_TFDS];
306 unsigned long reply_page; 306 unsigned long reply_page;
307 void (*callback)(struct iwl_priv *priv, 307 void (*callback)(struct iwl_shared *shrd,
308 struct iwl_device_cmd *cmd, 308 struct iwl_device_cmd *cmd,
309 struct iwl_rx_packet *pkt); 309 struct iwl_rx_packet *pkt);
310 u32 flags; 310 u32 flags;
@@ -1142,8 +1142,6 @@ struct iwl_priv {
1142 /* Rate scaling data */ 1142 /* Rate scaling data */
1143 u8 retry_rate; 1143 u8 retry_rate;
1144 1144
1145 wait_queue_head_t wait_command_queue;
1146
1147 int activity_timer_active; 1145 int activity_timer_active;
1148 1146
1149 /* counts mgmt, ctl, and data packets */ 1147 /* counts mgmt, ctl, and data packets */
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 8572548dd4a2..ee8fabd0b4f3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -563,7 +563,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
563 wiphy_rfkill_set_hw_state(priv->hw->wiphy, 563 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
564 test_bit(STATUS_RF_KILL_HW, &priv->shrd->status)); 564 test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));
565 else 565 else
566 wake_up_interruptible(&priv->wait_command_queue); 566 wake_up_interruptible(&priv->shrd->wait_command_queue);
567} 567}
568 568
569static void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, 569static void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 8b8cd54a32e0..9790d7eba39b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -250,6 +250,8 @@ struct iwl_shared {
250 struct ieee80211_hw *hw; 250 struct ieee80211_hw *hw;
251 251
252 struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT]; 252 struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT];
253
254 wait_queue_head_t wait_command_queue;
253}; 255};
254 256
255/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */ 257/*Whatever _m is (iwl_trans, iwl_priv, iwl_bus, these macros will work */
@@ -361,6 +363,7 @@ void iwl_start_tx_ba_trans_ready(struct iwl_priv *priv,
361void iwl_stop_tx_ba_trans_ready(struct iwl_priv *priv, 363void iwl_stop_tx_ba_trans_ready(struct iwl_priv *priv,
362 enum iwl_rxon_context_id ctx, 364 enum iwl_rxon_context_id ctx,
363 u8 sta_id, u8 tid); 365 u8 sta_id, u8 tid);
366void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state);
364 367
365/***************************************************** 368/*****************************************************
366* DRIVER STATUS FUNCTIONS 369* DRIVER STATUS FUNCTIONS
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 26b2bd4db6b4..e24135e7d37d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -123,14 +123,14 @@ static int iwl_process_add_sta_resp(struct iwl_priv *priv,
123 return ret; 123 return ret;
124} 124}
125 125
126static void iwl_add_sta_callback(struct iwl_priv *priv, 126static void iwl_add_sta_callback(struct iwl_shared *shrd,
127 struct iwl_device_cmd *cmd, 127 struct iwl_device_cmd *cmd,
128 struct iwl_rx_packet *pkt) 128 struct iwl_rx_packet *pkt)
129{ 129{
130 struct iwl_addsta_cmd *addsta = 130 struct iwl_addsta_cmd *addsta =
131 (struct iwl_addsta_cmd *)cmd->cmd.payload; 131 (struct iwl_addsta_cmd *)cmd->cmd.payload;
132 132
133 iwl_process_add_sta_resp(priv, addsta, pkt, false); 133 iwl_process_add_sta_resp(shrd->priv, addsta, pkt, false);
134 134
135} 135}
136 136
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
index ec4e73737681..f76526e080a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
@@ -195,7 +195,8 @@ int iwl_queue_init(struct iwl_queue *q, int count, int slots_num, u32 id);
195int iwl_trans_pcie_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd); 195int iwl_trans_pcie_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
196int __must_check iwl_trans_pcie_send_cmd_pdu(struct iwl_trans *trans, u8 id, 196int __must_check iwl_trans_pcie_send_cmd_pdu(struct iwl_trans *trans, u8 id,
197 u32 flags, u16 len, const void *data); 197 u32 flags, u16 len, const void *data);
198void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); 198void iwl_tx_cmd_complete(struct iwl_trans *trans,
199 struct iwl_rx_mem_buffer *rxb);
199void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans, 200void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_trans *trans,
200 struct iwl_tx_queue *txq, 201 struct iwl_tx_queue *txq,
201 u16 byte_cnt); 202 u16 byte_cnt);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
index 2d0ddb8d422d..e22cc6d8c07f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
@@ -453,7 +453,7 @@ static void iwl_rx_handle(struct iwl_trans *trans)
453 * iwl_trans_send_cmd() 453 * iwl_trans_send_cmd()
454 * as we reclaim the driver command queue */ 454 * as we reclaim the driver command queue */
455 if (rxb->page) 455 if (rxb->page)
456 iwl_tx_cmd_complete(priv(trans), rxb); 456 iwl_tx_cmd_complete(trans, rxb);
457 else 457 else
458 IWL_WARN(trans, "Claim null rxb?\n"); 458 IWL_WARN(trans, "Claim null rxb?\n");
459 } 459 }
@@ -646,7 +646,7 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
646 */ 646 */
647 clear_bit(STATUS_READY, &trans->shrd->status); 647 clear_bit(STATUS_READY, &trans->shrd->status);
648 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); 648 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);
649 wake_up_interruptible(&priv->wait_command_queue); 649 wake_up_interruptible(&priv->shrd->wait_command_queue);
650 IWL_ERR(trans, "RF is used by WiMAX\n"); 650 IWL_ERR(trans, "RF is used by WiMAX\n");
651 return; 651 return;
652 } 652 }
@@ -705,18 +705,18 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,
705 ptr = base + EVENT_START_OFFSET + (start_idx * event_size); 705 ptr = base + EVENT_START_OFFSET + (start_idx * event_size);
706 706
707 /* Make sure device is powered up for SRAM reads */ 707 /* Make sure device is powered up for SRAM reads */
708 spin_lock_irqsave(&bus(priv)->reg_lock, reg_flags); 708 spin_lock_irqsave(&bus(trans)->reg_lock, reg_flags);
709 iwl_grab_nic_access(bus(priv)); 709 iwl_grab_nic_access(bus(trans));
710 710
711 /* Set starting address; reads will auto-increment */ 711 /* Set starting address; reads will auto-increment */
712 iwl_write32(bus(priv), HBUS_TARG_MEM_RADDR, ptr); 712 iwl_write32(bus(trans), HBUS_TARG_MEM_RADDR, ptr);
713 rmb(); 713 rmb();
714 714
715 /* "time" is actually "data" for mode 0 (no timestamp). 715 /* "time" is actually "data" for mode 0 (no timestamp).
716 * place event id # at far right for easier visual parsing. */ 716 * place event id # at far right for easier visual parsing. */
717 for (i = 0; i < num_events; i++) { 717 for (i = 0; i < num_events; i++) {
718 ev = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 718 ev = iwl_read32(bus(trans), HBUS_TARG_MEM_RDAT);
719 time = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 719 time = iwl_read32(bus(trans), HBUS_TARG_MEM_RDAT);
720 if (mode == 0) { 720 if (mode == 0) {
721 /* data, ev */ 721 /* data, ev */
722 if (bufsz) { 722 if (bufsz) {
@@ -730,7 +730,7 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,
730 time, ev); 730 time, ev);
731 } 731 }
732 } else { 732 } else {
733 data = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 733 data = iwl_read32(bus(trans), HBUS_TARG_MEM_RDAT);
734 if (bufsz) { 734 if (bufsz) {
735 pos += scnprintf(*buf + pos, bufsz - pos, 735 pos += scnprintf(*buf + pos, bufsz - pos,
736 "EVT_LOGT:%010u:0x%08x:%04u\n", 736 "EVT_LOGT:%010u:0x%08x:%04u\n",
@@ -745,8 +745,8 @@ static int iwl_print_event_log(struct iwl_trans *trans, u32 start_idx,
745 } 745 }
746 746
747 /* Allow device to power down */ 747 /* Allow device to power down */
748 iwl_release_nic_access(bus(priv)); 748 iwl_release_nic_access(bus(trans));
749 spin_unlock_irqrestore(&bus(priv)->reg_lock, reg_flags); 749 spin_unlock_irqrestore(&bus(trans)->reg_lock, reg_flags);
750 return pos; 750 return pos;
751} 751}
752 752
@@ -823,10 +823,10 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log,
823 } 823 }
824 824
825 /* event log header */ 825 /* event log header */
826 capacity = iwl_read_targ_mem(bus(priv), base); 826 capacity = iwl_read_targ_mem(bus(trans), base);
827 mode = iwl_read_targ_mem(bus(priv), base + (1 * sizeof(u32))); 827 mode = iwl_read_targ_mem(bus(trans), base + (1 * sizeof(u32)));
828 num_wraps = iwl_read_targ_mem(bus(priv), base + (2 * sizeof(u32))); 828 num_wraps = iwl_read_targ_mem(bus(trans), base + (2 * sizeof(u32)));
829 next_entry = iwl_read_targ_mem(bus(priv), base + (3 * sizeof(u32))); 829 next_entry = iwl_read_targ_mem(bus(trans), base + (3 * sizeof(u32)));
830 830
831 if (capacity > logsize) { 831 if (capacity > logsize) {
832 IWL_ERR(trans, "Log capacity %d is bogus, limit to %d " 832 IWL_ERR(trans, "Log capacity %d is bogus, limit to %d "
@@ -908,8 +908,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
908 u32 inta_mask; 908 u32 inta_mask;
909#endif 909#endif
910 910
911 struct iwl_trans_pcie *trans_pcie = 911 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
912 IWL_TRANS_GET_PCIE_TRANS(trans);
913 struct isr_statistics *isr_stats = &trans_pcie->isr_stats; 912 struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
914 913
915 914
@@ -1003,8 +1002,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
1003 else 1002 else
1004 clear_bit(STATUS_RF_KILL_HW, 1003 clear_bit(STATUS_RF_KILL_HW,
1005 &trans->shrd->status); 1004 &trans->shrd->status);
1006 wiphy_rfkill_set_hw_state(priv(trans)->hw->wiphy, 1005 iwl_set_hw_rfkill_state(priv(trans), hw_rf_kill);
1007 hw_rf_kill);
1008 } 1006 }
1009 1007
1010 handled |= CSR_INT_BIT_RF_KILL; 1008 handled |= CSR_INT_BIT_RF_KILL;
@@ -1093,7 +1091,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
1093 handled |= CSR_INT_BIT_FH_TX; 1091 handled |= CSR_INT_BIT_FH_TX;
1094 /* Wake up uCode load routine, now that load is complete */ 1092 /* Wake up uCode load routine, now that load is complete */
1095 priv(trans)->ucode_write_complete = 1; 1093 priv(trans)->ucode_write_complete = 1;
1096 wake_up_interruptible(&priv(trans)->wait_command_queue); 1094 wake_up_interruptible(&trans->shrd->wait_command_queue);
1097 } 1095 }
1098 1096
1099 if (inta & ~handled) { 1097 if (inta & ~handled) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
index ea6a0bc8ca20..32314a60e2ac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
@@ -536,7 +536,6 @@ int iwl_trans_pcie_tx_agg_alloc(struct iwl_trans *trans,
536 struct iwl_tid_data *tid_data; 536 struct iwl_tid_data *tid_data;
537 unsigned long flags; 537 unsigned long flags;
538 int txq_id; 538 int txq_id;
539 struct iwl_priv *priv = priv(trans);
540 539
541 txq_id = iwlagn_txq_ctx_activate_free(trans); 540 txq_id = iwlagn_txq_ctx_activate_free(trans);
542 if (txq_id == -1) { 541 if (txq_id == -1) {
@@ -560,7 +559,7 @@ int iwl_trans_pcie_tx_agg_alloc(struct iwl_trans *trans,
560 "queue\n", tid_data->tfds_in_queue); 559 "queue\n", tid_data->tfds_in_queue);
561 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA; 560 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA;
562 } 561 }
563 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); 562 spin_unlock_irqrestore(&trans->shrd->sta_lock, flags);
564 563
565 return 0; 564 return 0;
566} 565}
@@ -856,16 +855,16 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
856 * need to be reclaimed. As result, some free space forms. If there is 855 * need to be reclaimed. As result, some free space forms. If there is
857 * enough free space (> low mark), wake the stack that feeds us. 856 * enough free space (> low mark), wake the stack that feeds us.
858 */ 857 */
859static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx) 858static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id,
859 int idx)
860{ 860{
861 struct iwl_trans_pcie *trans_pcie = 861 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
862 IWL_TRANS_GET_PCIE_TRANS(trans(priv));
863 struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id]; 862 struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id];
864 struct iwl_queue *q = &txq->q; 863 struct iwl_queue *q = &txq->q;
865 int nfreed = 0; 864 int nfreed = 0;
866 865
867 if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) { 866 if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) {
868 IWL_ERR(priv, "%s: Read index for DMA queue txq id (%d), " 867 IWL_ERR(trans, "%s: Read index for DMA queue txq id (%d), "
869 "index %d is out of range [0-%d] %d %d.\n", __func__, 868 "index %d is out of range [0-%d] %d %d.\n", __func__,
870 txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr); 869 txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr);
871 return; 870 return;
@@ -875,9 +874,9 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx)
875 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 874 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
876 875
877 if (nfreed++ > 0) { 876 if (nfreed++ > 0) {
878 IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx, 877 IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", idx,
879 q->write_ptr, q->read_ptr); 878 q->write_ptr, q->read_ptr);
880 iwlagn_fw_error(priv, false); 879 iwlagn_fw_error(priv(trans), false);
881 } 880 }
882 881
883 } 882 }
@@ -891,7 +890,7 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx)
891 * will be executed. The attached skb (if present) will only be freed 890 * will be executed. The attached skb (if present) will only be freed
892 * if the callback returns 1 891 * if the callback returns 1
893 */ 892 */
894void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 893void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb)
895{ 894{
896 struct iwl_rx_packet *pkt = rxb_addr(rxb); 895 struct iwl_rx_packet *pkt = rxb_addr(rxb);
897 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 896 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
@@ -900,7 +899,6 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
900 int cmd_index; 899 int cmd_index;
901 struct iwl_device_cmd *cmd; 900 struct iwl_device_cmd *cmd;
902 struct iwl_cmd_meta *meta; 901 struct iwl_cmd_meta *meta;
903 struct iwl_trans *trans = trans(priv);
904 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 902 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
905 struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue]; 903 struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
906 unsigned long flags; 904 unsigned long flags;
@@ -913,7 +911,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
913 txq_id, trans->shrd->cmd_queue, sequence, 911 txq_id, trans->shrd->cmd_queue, sequence,
914 trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr, 912 trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr,
915 trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) { 913 trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) {
916 iwl_print_hex_error(priv, pkt, 32); 914 iwl_print_hex_error(trans, pkt, 32);
917 return; 915 return;
918 } 916 }
919 917
@@ -929,17 +927,17 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
929 meta->source->reply_page = (unsigned long)rxb_addr(rxb); 927 meta->source->reply_page = (unsigned long)rxb_addr(rxb);
930 rxb->page = NULL; 928 rxb->page = NULL;
931 } else if (meta->callback) 929 } else if (meta->callback)
932 meta->callback(priv, cmd, pkt); 930 meta->callback(trans->shrd, cmd, pkt);
933 931
934 spin_lock_irqsave(&trans->hcmd_lock, flags); 932 spin_lock_irqsave(&trans->hcmd_lock, flags);
935 933
936 iwl_hcmd_queue_reclaim(priv, txq_id, index); 934 iwl_hcmd_queue_reclaim(trans, txq_id, index);
937 935
938 if (!(meta->flags & CMD_ASYNC)) { 936 if (!(meta->flags & CMD_ASYNC)) {
939 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); 937 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);
940 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", 938 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n",
941 get_cmd_string(cmd->hdr.cmd)); 939 get_cmd_string(cmd->hdr.cmd));
942 wake_up_interruptible(&priv->wait_command_queue); 940 wake_up_interruptible(&trans->shrd->wait_command_queue);
943 } 941 }
944 942
945 meta->flags = 0; 943 meta->flags = 0;
@@ -1031,12 +1029,12 @@ const char *get_cmd_string(u8 cmd)
1031 1029
1032#define HOST_COMPLETE_TIMEOUT (2 * HZ) 1030#define HOST_COMPLETE_TIMEOUT (2 * HZ)
1033 1031
1034static void iwl_generic_cmd_callback(struct iwl_priv *priv, 1032static void iwl_generic_cmd_callback(struct iwl_shared *shrd,
1035 struct iwl_device_cmd *cmd, 1033 struct iwl_device_cmd *cmd,
1036 struct iwl_rx_packet *pkt) 1034 struct iwl_rx_packet *pkt)
1037{ 1035{
1038 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 1036 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
1039 IWL_ERR(priv, "Bad return from %s (0x%08X)\n", 1037 IWL_ERR(shrd->trans, "Bad return from %s (0x%08X)\n",
1040 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 1038 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
1041 return; 1039 return;
1042 } 1040 }
@@ -1045,11 +1043,11 @@ static void iwl_generic_cmd_callback(struct iwl_priv *priv,
1045 switch (cmd->hdr.cmd) { 1043 switch (cmd->hdr.cmd) {
1046 case REPLY_TX_LINK_QUALITY_CMD: 1044 case REPLY_TX_LINK_QUALITY_CMD:
1047 case SENSITIVITY_CMD: 1045 case SENSITIVITY_CMD:
1048 IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", 1046 IWL_DEBUG_HC_DUMP(shrd->trans, "back from %s (0x%08X)\n",
1049 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 1047 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
1050 break; 1048 break;
1051 default: 1049 default:
1052 IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n", 1050 IWL_DEBUG_HC(shrd->trans, "back from %s (0x%08X)\n",
1053 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 1051 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
1054 } 1052 }
1055#endif 1053#endif
@@ -1107,7 +1105,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
1107 return ret; 1105 return ret;
1108 } 1106 }
1109 1107
1110 ret = wait_event_interruptible_timeout(priv(trans)->wait_command_queue, 1108 ret = wait_event_interruptible_timeout(trans->shrd->wait_command_queue,
1111 !test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status), 1109 !test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status),
1112 HOST_COMPLETE_TIMEOUT); 1110 HOST_COMPLETE_TIMEOUT);
1113 if (!ret) { 1111 if (!ret) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index cec13adb018e..44e2f911f89b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -604,9 +604,8 @@ error:
604 return ret; 604 return ret;
605} 605}
606 606
607static void iwl_set_pwr_vmain(struct iwl_priv *priv) 607static void iwl_set_pwr_vmain(struct iwl_trans *trans)
608{ 608{
609 struct iwl_trans *trans = trans(priv);
610/* 609/*
611 * (for documentation purposes) 610 * (for documentation purposes)
612 * to set power to V_AUX, do: 611 * to set power to V_AUX, do:
@@ -625,11 +624,10 @@ static void iwl_set_pwr_vmain(struct iwl_priv *priv)
625static int iwl_nic_init(struct iwl_trans *trans) 624static int iwl_nic_init(struct iwl_trans *trans)
626{ 625{
627 unsigned long flags; 626 unsigned long flags;
628 struct iwl_priv *priv = priv(trans);
629 627
630 /* nic_init */ 628 /* nic_init */
631 spin_lock_irqsave(&trans->shrd->lock, flags); 629 spin_lock_irqsave(&trans->shrd->lock, flags);
632 iwl_apm_init(priv); 630 iwl_apm_init(priv(trans));
633 631
634 /* Set interrupt coalescing calibration timer to default (512 usecs) */ 632 /* Set interrupt coalescing calibration timer to default (512 usecs) */
635 iwl_write8(bus(trans), CSR_INT_COALESCING, 633 iwl_write8(bus(trans), CSR_INT_COALESCING,
@@ -637,9 +635,9 @@ static int iwl_nic_init(struct iwl_trans *trans)
637 635
638 spin_unlock_irqrestore(&trans->shrd->lock, flags); 636 spin_unlock_irqrestore(&trans->shrd->lock, flags);
639 637
640 iwl_set_pwr_vmain(priv); 638 iwl_set_pwr_vmain(trans);
641 639
642 priv->cfg->lib->nic_config(priv); 640 priv(trans)->cfg->lib->nic_config(priv(trans));
643 641
644 /* Allocate the RX queue, or reset if it is already allocated */ 642 /* Allocate the RX queue, or reset if it is already allocated */
645 iwl_rx_init(trans); 643 iwl_rx_init(trans);
@@ -764,7 +762,6 @@ static const u8 iwlagn_pan_ac_to_queue[] = {
764static int iwl_trans_pcie_start_device(struct iwl_trans *trans) 762static int iwl_trans_pcie_start_device(struct iwl_trans *trans)
765{ 763{
766 int ret; 764 int ret;
767 struct iwl_priv *priv = priv(trans);
768 struct iwl_trans_pcie *trans_pcie = 765 struct iwl_trans_pcie *trans_pcie =
769 IWL_TRANS_GET_PCIE_TRANS(trans); 766 IWL_TRANS_GET_PCIE_TRANS(trans);
770 767
@@ -792,7 +789,7 @@ static int iwl_trans_pcie_start_device(struct iwl_trans *trans)
792 set_bit(STATUS_RF_KILL_HW, &trans->shrd->status); 789 set_bit(STATUS_RF_KILL_HW, &trans->shrd->status);
793 790
794 if (iwl_is_rfkill(trans->shrd)) { 791 if (iwl_is_rfkill(trans->shrd)) {
795 wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); 792 iwl_set_hw_rfkill_state(priv(trans), true);
796 iwl_enable_interrupts(trans); 793 iwl_enable_interrupts(trans);
797 return -ERFKILL; 794 return -ERFKILL;
798 } 795 }
@@ -1397,7 +1394,7 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans)
1397 else 1394 else
1398 clear_bit(STATUS_RF_KILL_HW, &trans->shrd->status); 1395 clear_bit(STATUS_RF_KILL_HW, &trans->shrd->status);
1399 1396
1400 wiphy_rfkill_set_hw_state(priv(trans)->hw->wiphy, hw_rfkill); 1397 iwl_set_hw_rfkill_state(priv(trans), hw_rfkill);
1401 1398
1402 return 0; 1399 return 0;
1403} 1400}
@@ -1674,7 +1671,6 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1674{ 1671{
1675 struct iwl_trans *trans = file->private_data; 1672 struct iwl_trans *trans = file->private_data;
1676 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1673 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1677 struct iwl_priv *priv = priv(trans);
1678 struct iwl_tx_queue *txq; 1674 struct iwl_tx_queue *txq;
1679 struct iwl_queue *q; 1675 struct iwl_queue *q;
1680 char *buf; 1676 char *buf;
@@ -1684,7 +1680,7 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1684 const size_t bufsz = sizeof(char) * 64 * hw_params(trans).max_txq_num; 1680 const size_t bufsz = sizeof(char) * 64 * hw_params(trans).max_txq_num;
1685 1681
1686 if (!trans_pcie->txq) { 1682 if (!trans_pcie->txq) {
1687 IWL_ERR(priv, "txq not ready\n"); 1683 IWL_ERR(trans, "txq not ready\n");
1688 return -EAGAIN; 1684 return -EAGAIN;
1689 } 1685 }
1690 buf = kzalloc(bufsz, GFP_KERNEL); 1686 buf = kzalloc(bufsz, GFP_KERNEL);