iwlagn: remove priv dereferences from the transport layer
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-core.c
index 048c8e2578f589d7b2b92acfe59d24febce64b25..d9897da7281f52829e2df4722c4e8271ea76ea0a 100644 (file)
@@ -868,7 +868,7 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
         * commands by clearing the ready bit */
        clear_bit(STATUS_READY, &priv->shrd->status);
 
-       wake_up_interruptible(&priv->wait_command_queue);
+       wake_up_interruptible(&priv->shrd->wait_command_queue);
 
        if (!ondemand) {
                /*
@@ -907,9 +907,10 @@ static int iwl_apm_stop_master(struct iwl_priv *priv)
        int ret = 0;
 
        /* stop device's busmaster DMA activity */
-       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
+       iwl_set_bit(bus(priv), CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
 
-       ret = iwl_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED,
+       ret = iwl_poll_bit(bus(priv), CSR_RESET,
+                       CSR_RESET_REG_FLAG_MASTER_DISABLED,
                        CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
        if (ret)
                IWL_WARN(priv, "Master Disable Timed Out, 100 usec\n");
@@ -929,7 +930,7 @@ void iwl_apm_stop(struct iwl_priv *priv)
        iwl_apm_stop_master(priv);
 
        /* Reset the entire device */
-       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
+       iwl_set_bit(bus(priv), CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
 
        udelay(10);
 
@@ -937,7 +938,7 @@ void iwl_apm_stop(struct iwl_priv *priv)
         * Clear "initialization complete" bit to move adapter from
         * D0A* (powered-up Active) --> D0U* (Uninitialized) state.
         */
-       iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+       iwl_clear_bit(bus(priv), CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
 }
 
 
@@ -957,45 +958,45 @@ int iwl_apm_init(struct iwl_priv *priv)
         */
 
        /* Disable L0S exit timer (platform NMI Work/Around) */
-       iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
+       iwl_set_bit(bus(priv), CSR_GIO_CHICKEN_BITS,
                          CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
 
        /*
         * Disable L0s without affecting L1;
         *  don't wait for ICH L0s (ICH bug W/A)
         */
-       iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
+       iwl_set_bit(bus(priv), CSR_GIO_CHICKEN_BITS,
                          CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
 
        /* Set FH wait threshold to maximum (HW error during stress W/A) */
-       iwl_set_bit(priv, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL);
+       iwl_set_bit(bus(priv), CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL);
 
        /*
         * Enable HAP INTA (interrupt from management bus) to
         * wake device's PCI Express link L1a -> L0s
         */
-       iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+       iwl_set_bit(bus(priv), CSR_HW_IF_CONFIG_REG,
                                    CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
 
        bus_apm_config(priv->bus);
 
        /* Configure analog phase-lock-loop before activating to D0A */
        if (priv->cfg->base_params->pll_cfg_val)
-               iwl_set_bit(priv, CSR_ANA_PLL_CFG,
+               iwl_set_bit(bus(priv), CSR_ANA_PLL_CFG,
                            priv->cfg->base_params->pll_cfg_val);
 
        /*
         * Set "initialization complete" bit to move adapter from
         * D0U* --> D0A* (powered-up active) state.
         */
-       iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+       iwl_set_bit(bus(priv), CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
 
        /*
         * Wait for clock stabilization; once stabilized, access to
         * device-internal resources is supported, e.g. iwl_write_prph()
         * and accesses to uCode SRAM.
         */
-       ret = iwl_poll_bit(priv, CSR_GP_CNTRL,
+       ret = iwl_poll_bit(bus(priv), CSR_GP_CNTRL,
                        CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
                        CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
        if (ret < 0) {
@@ -1010,11 +1011,11 @@ int iwl_apm_init(struct iwl_priv *priv)
         * do not disable clocks.  This preserves any hardware bits already
         * set by default in "CLK_CTRL_REG" after reset.
         */
-       iwl_write_prph(priv, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT);
+       iwl_write_prph(bus(priv), APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT);
        udelay(20);
 
        /* Disable L1-Active */
-       iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
+       iwl_set_bits_prph(bus(priv), APMG_PCIDEV_STT_REG,
                          APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
 
        set_bit(STATUS_DEVICE_ENABLED, &priv->shrd->status);
@@ -1723,32 +1724,12 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        return err;
 }
 
-/*
- * On every watchdog tick we check (latest) time stamp. If it does not
- * change during timeout period and queue is not empty we reset firmware.
- */
-static int iwl_check_stuck_queue(struct iwl_priv *priv, int cnt)
+static inline int iwl_check_stuck_queue(struct iwl_priv *priv, int txq)
 {
-       struct iwl_tx_queue *txq = &priv->txq[cnt];
-       struct iwl_queue *q = &txq->q;
-       unsigned long timeout;
-       int ret;
-
-       if (q->read_ptr == q->write_ptr) {
-               txq->time_stamp = jiffies;
-               return 0;
-       }
-
-       timeout = txq->time_stamp +
-                 msecs_to_jiffies(priv->cfg->base_params->wd_timeout);
-
-       if (time_after(jiffies, timeout)) {
-               IWL_ERR(priv, "Queue %d stuck for %u ms.\n",
-                               q->id, priv->cfg->base_params->wd_timeout);
-               ret = iwl_force_reset(priv, IWL_FW_RESET, false);
+       if (iwl_trans_check_stuck_queue(trans(priv), txq)) {
+               int ret = iwl_force_reset(priv, IWL_FW_RESET, false);
                return (ret == -EAGAIN) ? 0 : 1;
        }
-
        return 0;
 }
 
@@ -1857,3 +1838,35 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
        return cpu_to_le32(res);
 }
 
+void iwl_start_tx_ba_trans_ready(struct iwl_priv *priv,
+                                enum iwl_rxon_context_id ctx,
+                                u8 sta_id, u8 tid)
+{
+       struct ieee80211_vif *vif;
+       u8 *addr = priv->stations[sta_id].sta.sta.addr;
+
+       if (ctx == NUM_IWL_RXON_CTX)
+               ctx = priv->stations[sta_id].ctxid;
+       vif = priv->contexts[ctx].vif;
+
+       ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid);
+}
+
+void iwl_stop_tx_ba_trans_ready(struct iwl_priv *priv,
+                               enum iwl_rxon_context_id ctx,
+                               u8 sta_id, u8 tid)
+{
+       struct ieee80211_vif *vif;
+       u8 *addr = priv->stations[sta_id].sta.sta.addr;
+
+       if (ctx == NUM_IWL_RXON_CTX)
+               ctx = priv->stations[sta_id].ctxid;
+       vif = priv->contexts[ctx].vif;
+
+       ieee80211_stop_tx_ba_cb_irqsafe(vif, addr, tid);
+}
+
+void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state)
+{
+       wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
+}
This page took 0.026966 seconds and 5 git commands to generate.