aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-26 02:10:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-29 15:25:33 -0400
commit0c325769a394559941acda83e888a1d9b1ef8b7f (patch)
tree6c64e9a7f14f5d8c9d6d0df095aa2747caddc0b8 /drivers/net/wireless/iwlwifi/iwl-trans.c
parent57210f7c9f04a2509ee54a0f454003a714db96dd (diff)
iwlagn: move ISR related data to transport layer
Since the ISR is entirely in the transport layer, its data should be in the pcie specific region. Change sync_irq to first disable and then synchronize the IRQ. iwl_isr and iwl_isr_ict now receive iwl_trans. 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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index 621b9a822090..687a09226e6d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -711,7 +711,7 @@ static int iwl_trans_pcie_start_device(struct iwl_priv *priv)
711 711
712 if (iwl_is_rfkill(priv)) { 712 if (iwl_is_rfkill(priv)) {
713 wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); 713 wiphy_rfkill_set_hw_state(priv->hw->wiphy, true);
714 iwl_enable_interrupts(priv); 714 iwl_enable_interrupts(trans(priv));
715 return -ERFKILL; 715 return -ERFKILL;
716 } 716 }
717 717
@@ -730,7 +730,7 @@ static int iwl_trans_pcie_start_device(struct iwl_priv *priv)
730 730
731 /* clear (again), then enable host interrupts */ 731 /* clear (again), then enable host interrupts */
732 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 732 iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
733 iwl_enable_interrupts(priv); 733 iwl_enable_interrupts(trans(priv));
734 734
735 /* really make sure rfkill handshake bits are cleared */ 735 /* really make sure rfkill handshake bits are cleared */
736 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 736 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
@@ -931,19 +931,14 @@ static int iwl_trans_tx_stop(struct iwl_priv *priv)
931 931
932static void iwl_trans_pcie_stop_device(struct iwl_priv *priv) 932static void iwl_trans_pcie_stop_device(struct iwl_priv *priv)
933{ 933{
934 unsigned long flags;
935
936 /* stop and reset the on-board processor */ 934 /* stop and reset the on-board processor */
937 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); 935 iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
938 936
939 /* tell the device to stop sending interrupts */ 937 /* tell the device to stop sending interrupts */
940 spin_lock_irqsave(&priv->shrd->lock, flags); 938 iwl_trans_disable_sync_irq(trans(priv));
941 iwl_disable_interrupts(priv);
942 spin_unlock_irqrestore(&priv->shrd->lock, flags);
943 iwl_trans_sync_irq(trans(priv));
944 939
945 /* device going down, Stop using ICT table */ 940 /* device going down, Stop using ICT table */
946 iwl_disable_ict(priv); 941 iwl_disable_ict(trans(priv));
947 942
948 /* 943 /*
949 * If a HW restart happens during firmware loading, 944 * If a HW restart happens during firmware loading,
@@ -1132,19 +1127,20 @@ static int iwl_trans_pcie_request_irq(struct iwl_trans *trans)
1132{ 1127{
1133 struct iwl_trans_pcie *trans_pcie = 1128 struct iwl_trans_pcie *trans_pcie =
1134 IWL_TRANS_GET_PCIE_TRANS(trans); 1129 IWL_TRANS_GET_PCIE_TRANS(trans);
1135 struct iwl_priv *priv = priv(trans);
1136 int err; 1130 int err;
1137 1131
1138 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 1132 trans_pcie->inta_mask = CSR_INI_SET_MASK;
1139 iwl_irq_tasklet, (unsigned long)priv); 1133
1134 tasklet_init(&trans_pcie->irq_tasklet, (void (*)(unsigned long))
1135 iwl_irq_tasklet, (unsigned long)trans);
1140 1136
1141 iwl_alloc_isr_ict(priv); 1137 iwl_alloc_isr_ict(trans);
1142 1138
1143 err = request_irq(bus(trans)->irq, iwl_isr_ict, IRQF_SHARED, 1139 err = request_irq(bus(trans)->irq, iwl_isr_ict, IRQF_SHARED,
1144 DRV_NAME, priv); 1140 DRV_NAME, trans);
1145 if (err) { 1141 if (err) {
1146 IWL_ERR(priv, "Error allocating IRQ %d\n", priv->bus->irq); 1142 IWL_ERR(trans, "Error allocating IRQ %d\n", bus(trans)->irq);
1147 iwl_free_isr_ict(priv); 1143 iwl_free_isr_ict(trans);
1148 return err; 1144 return err;
1149 } 1145 }
1150 1146
@@ -1152,17 +1148,25 @@ static int iwl_trans_pcie_request_irq(struct iwl_trans *trans)
1152 return 0; 1148 return 0;
1153} 1149}
1154 1150
1155static void iwl_trans_pcie_sync_irq(struct iwl_priv *priv) 1151static void iwl_trans_pcie_disable_sync_irq(struct iwl_trans *trans)
1156{ 1152{
1153 unsigned long flags;
1154 struct iwl_trans_pcie *trans_pcie =
1155 IWL_TRANS_GET_PCIE_TRANS(trans);
1156
1157 spin_lock_irqsave(&trans->shrd->lock, flags);
1158 iwl_disable_interrupts(trans);
1159 spin_unlock_irqrestore(&trans->shrd->lock, flags);
1160
1157 /* wait to make sure we flush pending tasklet*/ 1161 /* wait to make sure we flush pending tasklet*/
1158 synchronize_irq(priv->bus->irq); 1162 synchronize_irq(bus(trans)->irq);
1159 tasklet_kill(&priv->irq_tasklet); 1163 tasklet_kill(&trans_pcie->irq_tasklet);
1160} 1164}
1161 1165
1162static void iwl_trans_pcie_free(struct iwl_priv *priv) 1166static void iwl_trans_pcie_free(struct iwl_priv *priv)
1163{ 1167{
1164 free_irq(priv->bus->irq, priv); 1168 free_irq(priv->bus->irq, trans(priv));
1165 iwl_free_isr_ict(priv); 1169 iwl_free_isr_ict(trans(priv));
1166 kfree(trans(priv)); 1170 kfree(trans(priv));
1167 trans(priv) = NULL; 1171 trans(priv) = NULL;
1168} 1172}
@@ -1191,7 +1195,7 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans)
1191{ 1195{
1192 bool hw_rfkill = false; 1196 bool hw_rfkill = false;
1193 1197
1194 iwl_enable_interrupts(priv(trans)); 1198 iwl_enable_interrupts(trans);
1195 1199
1196 if (!(iwl_read32(priv(trans), CSR_GP_CNTRL) & 1200 if (!(iwl_read32(priv(trans), CSR_GP_CNTRL) &
1197 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) 1201 CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
@@ -1500,7 +1504,7 @@ const struct iwl_trans_ops trans_ops_pcie = {
1500 1504
1501 .kick_nic = iwl_trans_pcie_kick_nic, 1505 .kick_nic = iwl_trans_pcie_kick_nic,
1502 1506
1503 .sync_irq = iwl_trans_pcie_sync_irq, 1507 .disable_sync_irq = iwl_trans_pcie_disable_sync_irq,
1504 .free = iwl_trans_pcie_free, 1508 .free = iwl_trans_pcie_free,
1505 1509
1506 .dbgfs_register = iwl_trans_pcie_dbgfs_register, 1510 .dbgfs_register = iwl_trans_pcie_dbgfs_register,