mwl8k: mwl8k_queue_work() cleanup
[pandora-kernel.git] / drivers / net / wireless / mwl8k.c
index cc0aa80..7bbdca4 100644 (file)
@@ -1080,17 +1080,17 @@ struct mwl8k_txq_info {
 };
 
 static int mwl8k_scan_tx_ring(struct mwl8k_priv *priv,
-                               struct mwl8k_txq_info txinfo[],
-                               u32 num_queues)
+                               struct mwl8k_txq_info *txinfo)
 {
        int count, desc, status;
        struct mwl8k_tx_queue *txq;
        struct mwl8k_tx_desc *tx_desc;
        int ndescs = 0;
 
-       memset(txinfo, 0, num_queues * sizeof(struct mwl8k_txq_info));
+       memset(txinfo, 0, MWL8K_TX_QUEUES * sizeof(struct mwl8k_txq_info));
+
        spin_lock_bh(&priv->tx_lock);
-       for (count = 0; count < num_queues; count++) {
+       for (count = 0; count < MWL8K_TX_QUEUES; count++) {
                txq = priv->txq + count;
                txinfo[count].len = txq->tx_stats.len;
                txinfo[count].head = txq->tx_head;
@@ -1113,7 +1113,7 @@ static int mwl8k_scan_tx_ring(struct mwl8k_priv *priv,
        return ndescs;
 }
 
-static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw, u32 delay_ms)
+static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw)
 {
        struct mwl8k_priv *priv = hw->priv;
        DECLARE_COMPLETION_ONSTACK(cmd_wait);
@@ -1135,12 +1135,12 @@ static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw, u32 delay_ms)
        spin_unlock_bh(&priv->tx_lock);
 
        if (count) {
-               struct mwl8k_txq_info txinfo[4];
+               struct mwl8k_txq_info txinfo[MWL8K_TX_QUEUES];
                int index;
                int newcount;
 
                timeout = wait_for_completion_timeout(&cmd_wait,
-                                       msecs_to_jiffies(delay_ms));
+                                       msecs_to_jiffies(1000));
                if (timeout)
                        return 0;
 
@@ -1149,11 +1149,11 @@ static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw, u32 delay_ms)
                newcount = mwl8k_txq_busy(priv);
                spin_unlock_bh(&priv->tx_lock);
 
-               printk(KERN_ERR "%s(%u) TIMEDOUT:%ums Pend:%u-->%u\n",
-                      __func__, __LINE__, delay_ms, count, newcount);
+               printk(KERN_ERR "%s(%u) TIMEDOUT:1000ms Pend:%u-->%u\n",
+                      __func__, __LINE__, count, newcount);
 
-               mwl8k_scan_tx_ring(priv, txinfo, 4);
-               for (index = 0; index < 4; index++)
+               mwl8k_scan_tx_ring(priv, txinfo);
+               for (index = 0; index < MWL8K_TX_QUEUES; index++)
                        printk(KERN_ERR
                                "TXQ:%u L:%u H:%u T:%u FW:%u DRV:%u U:%u\n",
                                        index,
@@ -1257,46 +1257,60 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb)
 {
        struct mwl8k_priv *priv = hw->priv;
        struct ieee80211_tx_info *tx_info;
+       struct mwl8k_vif *mwl8k_vif;
        struct ieee80211_hdr *wh;
        struct mwl8k_tx_queue *txq;
        struct mwl8k_tx_desc *tx;
-       struct mwl8k_dma_data *tr;
-       struct mwl8k_vif *mwl8k_vif;
        dma_addr_t dma;
-       u16 qos = 0;
-       bool qosframe = false, ampduframe = false;
-       bool mcframe = false, eapolframe = false;
-       bool amsduframe = false;
-       __le16 fc;
+       u32 txstatus;
+       u8 txdatarate;
+       u16 qos;
 
-       txq = priv->txq + index;
-       tx = txq->tx_desc_area + txq->tx_tail;
-
-       BUG_ON(txq->tx_skb[txq->tx_tail] != NULL);
+       wh = (struct ieee80211_hdr *)skb->data;
+       if (ieee80211_is_data_qos(wh->frame_control))
+               qos = le16_to_cpu(*((__le16 *)ieee80211_get_qos_ctl(wh)));
+       else
+               qos = 0;
 
-       /*
-        * Append HW DMA header to start of packet.
-        */
        mwl8k_add_dma_header(skb);
+       wh = &((struct mwl8k_dma_data *)skb->data)->wh;
 
        tx_info = IEEE80211_SKB_CB(skb);
        mwl8k_vif = MWL8K_VIF(tx_info->control.vif);
-       tr = (struct mwl8k_dma_data *)skb->data;
-       wh = &tr->wh;
-       fc = wh->frame_control;
-       qosframe = ieee80211_is_data_qos(fc);
-       mcframe = is_multicast_ether_addr(wh->addr1);
-       ampduframe = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
 
        if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
                u16 seqno = mwl8k_vif->seqno;
+
                wh->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
                wh->seq_ctrl |= cpu_to_le16(seqno << 4);
                mwl8k_vif->seqno = seqno++ % 4096;
        }
 
-       if (qosframe)
-               qos = le16_to_cpu(*((__le16 *)ieee80211_get_qos_ctl(wh)));
+       /* Setup firmware control bit fields for each frame type.  */
+       txstatus = 0;
+       txdatarate = 0;
+       if (ieee80211_is_mgmt(wh->frame_control) ||
+           ieee80211_is_ctl(wh->frame_control)) {
+               txdatarate = 0;
+               qos = mwl8k_qos_setbit_eosp(qos);
+               /* Set Queue size to unspecified */
+               qos = mwl8k_qos_setbit_qlen(qos, 0xff);
+       } else if (ieee80211_is_data(wh->frame_control)) {
+               txdatarate = 1;
+               if (is_multicast_ether_addr(wh->addr1))
+                       txstatus |= MWL8K_TXD_STATUS_MULTICAST_TX;
+
+               /* Send pkt in an aggregate if AMPDU frame.  */
+               if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
+                       qos = mwl8k_qos_setbit_ack(qos,
+                               MWL8K_TXD_ACK_POLICY_BLOCKACK);
+               else
+                       qos = mwl8k_qos_setbit_ack(qos,
+                               MWL8K_TXD_ACK_POLICY_NORMAL);
+
+               if (qos & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
+                       qos = mwl8k_qos_setbit_amsdu(qos);
+       }
 
        dma = pci_map_single(priv->pdev, skb->data,
                                skb->len, PCI_DMA_TODEVICE);
@@ -1304,95 +1318,40 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb)
        if (pci_dma_mapping_error(priv->pdev, dma)) {
                printk(KERN_DEBUG "%s: failed to dma map skb, "
                        "dropping TX frame.\n", priv->name);
-
-               if (skb != NULL)
-                       dev_kfree_skb(skb);
+               dev_kfree_skb(skb);
                return NETDEV_TX_OK;
        }
 
-       /* Set desc header, cpu bit order.  */
-       tx->status = 0;
-       tx->data_rate = 0;
-       tx->tx_priority = index;
-       tx->qos_control = 0;
-       tx->rate_info = 0;
-       tx->peer_id = mwl8k_vif->peer_id;
-
-       amsduframe = !!(qos & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT);
-
-       /* Setup firmware control bit fields for each frame type.  */
-       if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) {
-               tx->data_rate = 0;
-               qos = mwl8k_qos_setbit_eosp(qos);
-               /* Set Queue size to unspecified */
-               qos = mwl8k_qos_setbit_qlen(qos, 0xff);
-       } else if (ieee80211_is_data(fc)) {
-               tx->data_rate = 1;
-               if (mcframe)
-                       tx->status |= MWL8K_TXD_STATUS_MULTICAST_TX;
+       spin_lock_bh(&priv->tx_lock);
 
-               /*
-                * Tell firmware to not send EAPOL pkts in an
-                * aggregate.  Verify against mac80211 tx path.  If
-                * stack turns off AMPDU for an EAPOL frame this
-                * check will be removed.
-                */
-               if (eapolframe) {
-                       qos = mwl8k_qos_setbit_ack(qos,
-                               MWL8K_TXD_ACK_POLICY_NORMAL);
-               } else {
-                       /* Send pkt in an aggregate if AMPDU frame.  */
-                       if (ampduframe)
-                               qos = mwl8k_qos_setbit_ack(qos,
-                                       MWL8K_TXD_ACK_POLICY_BLOCKACK);
-                       else
-                               qos = mwl8k_qos_setbit_ack(qos,
-                                       MWL8K_TXD_ACK_POLICY_NORMAL);
+       txq = priv->txq + index;
 
-                       if (amsduframe)
-                               qos = mwl8k_qos_setbit_amsdu(qos);
-               }
-       }
+       BUG_ON(txq->tx_skb[txq->tx_tail] != NULL);
+       txq->tx_skb[txq->tx_tail] = skb;
 
-       /* Convert to little endian */
+       tx = txq->tx_desc_area + txq->tx_tail;
+       tx->data_rate = txdatarate;
+       tx->tx_priority = index;
        tx->qos_control = cpu_to_le16(qos);
-       tx->status = cpu_to_le32(tx->status);
        tx->pkt_phys_addr = cpu_to_le32(dma);
        tx->pkt_len = cpu_to_le16(skb->len);
-
-       txq->tx_skb[txq->tx_tail] = skb;
-
-       spin_lock_bh(&priv->tx_lock);
-
-       tx->status = cpu_to_le32(MWL8K_TXD_STATUS_OK |
-                                       MWL8K_TXD_STATUS_FW_OWNED);
+       tx->rate_info = 0;
+       tx->peer_id = mwl8k_vif->peer_id;
        wmb();
+       tx->status = cpu_to_le32(MWL8K_TXD_STATUS_FW_OWNED | txstatus);
+
+       txq->tx_stats.count++;
        txq->tx_stats.len++;
        priv->pending_tx_pkts++;
-       txq->tx_stats.count++;
-       txq->tx_tail++;
 
+       txq->tx_tail++;
        if (txq->tx_tail == MWL8K_TX_DESCS)
                txq->tx_tail = 0;
+
        if (txq->tx_head == txq->tx_tail)
                ieee80211_stop_queue(hw, index);
 
-       if (priv->inconfig) {
-               /*
-                * Silently queue packet when we are in the middle of
-                * a config cycle.  Notify firmware only if we are
-                * waiting for TXQs to empty.  If a packet is sent
-                * before .config() is complete, perhaps it is better
-                * to drop the packet, as the channel is being changed
-                * and the packet will end up on the wrong channel.
-                */
-               printk(KERN_ERR "%s(): WARNING TX activity while "
-                       "in config\n", __func__);
-
-               if (priv->tx_wait != NULL)
-                       mwl8k_tx_start(priv);
-       } else
-               mwl8k_tx_start(priv);
+       mwl8k_tx_start(priv);
 
        spin_unlock_bh(&priv->tx_lock);
 
@@ -2430,84 +2389,15 @@ struct mwl8k_work_struct {
 
        /* Result code.  */
        int rc;
-
-       /*
-        * Optional field. Refer to explanation of MWL8K_WQ_XXX_XXX
-        * flags for explanation.  Defaults to MWL8K_WQ_DEFAULT_OPTIONS.
-        */
-       u32 options;
-
-       /* Optional field.  Defaults to MWL8K_CONFIG_TIMEOUT_MS.  */
-       unsigned long timeout_ms;
-
-       /* Optional field.  Defaults to MWL8K_WQ_TXWAIT_ATTEMPTS.  */
-       u32 txwait_attempts;
-
-       /* Optional field.  Defaults to MWL8K_TXWAIT_MS.  */
-       u32 tx_timeout_ms;
-       u32 step;
 };
 
-/* Flags controlling behavior of config queue requests */
-
-/* Caller spins while waiting for completion.  */
-#define MWL8K_WQ_SPIN                  0x00000001
-
-/* Wait for TX queues to empty before proceeding with configuration.  */
-#define MWL8K_WQ_TX_WAIT_EMPTY         0x00000002
-
-/* Queue request and return immediately.  */
-#define MWL8K_WQ_POST_REQUEST          0x00000004
-
-/*
- * Caller sleeps and waits for task complete notification.
- * Do not use in atomic context.
- */
-#define MWL8K_WQ_SLEEP                 0x00000008
-
-/* Free work struct when task is done.  */
-#define MWL8K_WQ_FREE_WORKSTRUCT       0x00000010
-
-/*
- * Config request is queued and returns to caller imediately.  Use
- * this in atomic context. Work struct is freed by mwl8k_queue_work()
- * when this flag is set.
- */
-#define MWL8K_WQ_QUEUE_ONLY    (MWL8K_WQ_POST_REQUEST | \
-                                MWL8K_WQ_FREE_WORKSTRUCT)
-
-/* Default work queue behavior is to sleep and wait for tx completion.  */
-#define MWL8K_WQ_DEFAULT_OPTIONS (MWL8K_WQ_SLEEP | MWL8K_WQ_TX_WAIT_EMPTY)
-
-/*
- * Default config request timeout.  Add adjustments to make sure the
- * config thread waits long enough for both tx wait and cmd wait before
- * timing out.
- */
-
-/* Time to wait for all TXQs to drain.  TX Doorbell is pressed each time.  */
-#define MWL8K_TXWAIT_TIMEOUT_MS                1000
-
-/* Default number of TX wait attempts.  */
-#define MWL8K_WQ_TXWAIT_ATTEMPTS       4
-
-/* Total time to wait for TXQ to drain.  */
-#define MWL8K_TXWAIT_MS                        (MWL8K_TXWAIT_TIMEOUT_MS * \
-                                               MWL8K_WQ_TXWAIT_ATTEMPTS)
-
-/* Scheduling slop.  */
-#define MWL8K_OS_SCHEDULE_OVERHEAD_MS  200
-
-#define MWL8K_CONFIG_TIMEOUT_MS        (MWL8K_CMD_TIMEOUT_MS + \
-                                MWL8K_TXWAIT_MS + \
-                                MWL8K_OS_SCHEDULE_OVERHEAD_MS)
-
 static void mwl8k_config_thread(struct work_struct *wt)
 {
        struct mwl8k_work_struct *worker = (struct mwl8k_work_struct *)wt;
        struct ieee80211_hw *hw = worker->hw;
        struct mwl8k_priv *priv = hw->priv;
        int rc = 0;
+       int iter;
 
        spin_lock_irq(&priv->tx_lock);
        priv->inconfig = true;
@@ -2520,44 +2410,16 @@ static void mwl8k_config_thread(struct work_struct *wt)
         * reconfiguration. This avoids interrupting any in-flight
         * DMA transfers to the hardware.
         */
-       if (worker->options & MWL8K_WQ_TX_WAIT_EMPTY) {
-               u32 timeout;
-               u32 time_remaining;
-               u32 iter;
-               u32 tx_wait_attempts = worker->txwait_attempts;
-
-               time_remaining = worker->tx_timeout_ms;
-               if (!tx_wait_attempts)
-                       tx_wait_attempts = 1;
-
-               timeout = worker->tx_timeout_ms/tx_wait_attempts;
-               if (!timeout)
-                       timeout = 1;
-
-               iter = tx_wait_attempts;
-               do {
-                       int wait_time;
-
-                       if (time_remaining > timeout) {
-                               time_remaining -= timeout;
-                               wait_time = timeout;
-                       } else
-                               wait_time = time_remaining;
-
-                       if (!wait_time)
-                               wait_time = 1;
-
-                       rc = mwl8k_tx_wait_empty(hw, wait_time);
-                       if (rc)
-                               printk(KERN_ERR "%s() txwait timeout=%ums "
-                                       "Retry:%u/%u\n", __func__, timeout,
-                                       tx_wait_attempts - iter + 1,
-                                       tx_wait_attempts);
+       iter = 4;
+       do {
+               rc = mwl8k_tx_wait_empty(hw);
+               if (rc)
+                       printk(KERN_ERR "%s() txwait timeout=1000ms "
+                               "Retry:%u/%u\n", __func__, 4 - iter + 1, 4);
+       } while (rc && --iter);
 
-               } while (rc && --iter);
+       rc = iter ? 0 : -ETIMEDOUT;
 
-               rc = iter ? 0 : -ETIMEDOUT;
-       }
        if (!rc)
                rc = worker->wfunc(wt);
 
@@ -2566,65 +2428,39 @@ static void mwl8k_config_thread(struct work_struct *wt)
        if (priv->pending_tx_pkts && priv->radio_on)
                mwl8k_tx_start(priv);
        spin_unlock_irq(&priv->tx_lock);
+
        ieee80211_wake_queues(hw);
 
        worker->rc = rc;
-       if (worker->options & MWL8K_WQ_SLEEP)
-               complete(worker->cmd_wait);
-
-       if (worker->options & MWL8K_WQ_FREE_WORKSTRUCT)
-               kfree(wt);
+       complete(worker->cmd_wait);
 }
 
 static int mwl8k_queue_work(struct ieee80211_hw *hw,
                                struct mwl8k_work_struct *worker,
-                               struct workqueue_struct *wqueue,
                                int (*wfunc)(struct work_struct *w))
 {
+       struct mwl8k_priv *priv = hw->priv;
        unsigned long timeout = 0;
        int rc = 0;
 
        DECLARE_COMPLETION_ONSTACK(cmd_wait);
 
-       if (!worker->timeout_ms)
-               worker->timeout_ms = MWL8K_CONFIG_TIMEOUT_MS;
-
-       if (!worker->options)
-               worker->options = MWL8K_WQ_DEFAULT_OPTIONS;
-
-       if (!worker->txwait_attempts)
-               worker->txwait_attempts = MWL8K_WQ_TXWAIT_ATTEMPTS;
-
-       if (!worker->tx_timeout_ms)
-               worker->tx_timeout_ms = MWL8K_TXWAIT_MS;
-
        worker->hw = hw;
        worker->cmd_wait = &cmd_wait;
        worker->rc = 1;
        worker->wfunc = wfunc;
 
        INIT_WORK(&worker->wt, mwl8k_config_thread);
-       queue_work(wqueue, &worker->wt);
+       queue_work(priv->config_wq, &worker->wt);
 
-       if (worker->options & MWL8K_WQ_POST_REQUEST) {
-               rc = 0;
-       } else {
-               if (worker->options & MWL8K_WQ_SPIN) {
-                       timeout = worker->timeout_ms;
-                       while (timeout && (worker->rc > 0)) {
-                               mdelay(1);
-                               timeout--;
-                       }
-               } else if (worker->options & MWL8K_WQ_SLEEP)
-                       timeout = wait_for_completion_timeout(&cmd_wait,
-                               msecs_to_jiffies(worker->timeout_ms));
+       timeout = wait_for_completion_timeout(&cmd_wait,
+               msecs_to_jiffies(10000));
 
-               if (timeout)
-                       rc = worker->rc;
-               else {
-                       cancel_work_sync(&worker->wt);
-                       rc = -ETIMEDOUT;
-               }
+       if (timeout)
+               rc = worker->rc;
+       else {
+               cancel_work_sync(&worker->wt);
+               rc = -ETIMEDOUT;
        }
 
        return rc;
@@ -2710,8 +2546,7 @@ static int mwl8k_start(struct ieee80211_hw *hw)
                goto mwl8k_start_disable_irq;
        }
 
-       rc = mwl8k_queue_work(hw, &worker->header,
-                             priv->config_wq, mwl8k_start_wt);
+       rc = mwl8k_queue_work(hw, &worker->header, mwl8k_start_wt);
        kfree(worker);
        if (!rc)
                return rc;
@@ -2761,16 +2596,13 @@ static void mwl8k_stop(struct ieee80211_hw *hw)
        if (worker == NULL)
                return;
 
-       rc = mwl8k_queue_work(hw, &worker->header,
-                             priv->config_wq, mwl8k_stop_wt);
+       rc = mwl8k_queue_work(hw, &worker->header, mwl8k_stop_wt);
        kfree(worker);
        if (rc == -ETIMEDOUT)
                printk(KERN_ERR "%s() timed out\n", __func__);
 
        /* Disable interrupts */
-       spin_lock_irq(&priv->tx_lock);
        iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK);
-       spin_unlock_irq(&priv->tx_lock);
        free_irq(priv->pdev->irq, hw);
 
        /* Stop finalize join worker */
@@ -2856,6 +2688,12 @@ static int mwl8k_config_wt(struct work_struct *wt)
        struct mwl8k_priv *priv = hw->priv;
        int rc = 0;
 
+       if (conf->flags & IEEE80211_CONF_IDLE) {
+               mwl8k_cmd_802_11_radio_disable(hw);
+               priv->current_channel = NULL;
+               goto mwl8k_config_exit;
+       }
+
        if (mwl8k_cmd_802_11_radio_enable(hw)) {
                rc = -EINVAL;
                goto mwl8k_config_exit;
@@ -2886,15 +2724,14 @@ static int mwl8k_config(struct ieee80211_hw *hw, u32 changed)
 {
        int rc = 0;
        struct mwl8k_config_worker *worker;
-       struct mwl8k_priv *priv = hw->priv;
 
        worker = kzalloc(sizeof(*worker), GFP_KERNEL);
        if (worker == NULL)
                return -ENOMEM;
 
        worker->changed = changed;
-       rc = mwl8k_queue_work(hw, &worker->header,
-                             priv->config_wq, mwl8k_config_wt);
+
+       rc = mwl8k_queue_work(hw, &worker->header, mwl8k_config_wt);
        if (rc == -ETIMEDOUT) {
                printk(KERN_ERR "%s() timed out.\n", __func__);
                rc = -EINVAL;
@@ -2987,7 +2824,6 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw,
                                   u32 changed)
 {
        struct mwl8k_bss_info_changed_worker *worker;
-       struct mwl8k_priv *priv = hw->priv;
        struct mwl8k_vif *mv_vif = MWL8K_VIF(vif);
        int rc;
 
@@ -3004,9 +2840,7 @@ static void mwl8k_bss_info_changed(struct ieee80211_hw *hw,
        worker->vif = vif;
        worker->info = info;
        worker->changed = changed;
-       rc = mwl8k_queue_work(hw, &worker->header,
-                             priv->config_wq,
-                             mwl8k_bss_info_changed_wt);
+       rc = mwl8k_queue_work(hw, &worker->header, mwl8k_bss_info_changed_wt);
        kfree(worker);
        if (rc == -ETIMEDOUT)
                printk(KERN_ERR "%s() timed out\n", __func__);
@@ -3065,7 +2899,6 @@ static void mwl8k_configure_filter(struct ieee80211_hw *hw,
                                   unsigned int *total_flags,
                                   u64 multicast)
 {
-       struct mwl8k_priv *priv = hw->priv;
        struct mwl8k_configure_filter_worker *worker;
 
        /* Clear unsupported feature flags */
@@ -3082,8 +2915,7 @@ static void mwl8k_configure_filter(struct ieee80211_hw *hw,
        worker->total_flags = *total_flags;
        worker->multicast_adr_cmd = (void *)(unsigned long)multicast;
 
-       mwl8k_queue_work(hw, &worker->header, priv->config_wq,
-                        mwl8k_configure_filter_wt);
+       mwl8k_queue_work(hw, &worker->header, mwl8k_configure_filter_wt);
 }
 
 struct mwl8k_set_rts_threshold_worker {
@@ -3109,7 +2941,6 @@ static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 {
        int rc;
        struct mwl8k_set_rts_threshold_worker *worker;
-       struct mwl8k_priv *priv = hw->priv;
 
        worker = kzalloc(sizeof(*worker), GFP_KERNEL);
        if (worker == NULL)
@@ -3117,9 +2948,7 @@ static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 
        worker->value = value;
 
-       rc = mwl8k_queue_work(hw, &worker->header,
-                             priv->config_wq,
-                             mwl8k_set_rts_threshold_wt);
+       rc = mwl8k_queue_work(hw, &worker->header, mwl8k_set_rts_threshold_wt);
        kfree(worker);
 
        if (rc == -ETIMEDOUT) {
@@ -3167,7 +2996,6 @@ static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue,
 {
        int rc;
        struct mwl8k_conf_tx_worker *worker;
-       struct mwl8k_priv *priv = hw->priv;
 
        worker = kzalloc(sizeof(*worker), GFP_KERNEL);
        if (worker == NULL)
@@ -3175,8 +3003,7 @@ static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue,
 
        worker->queue = queue;
        worker->params = params;
-       rc = mwl8k_queue_work(hw, &worker->header,
-                             priv->config_wq, mwl8k_conf_tx_wt);
+       rc = mwl8k_queue_work(hw, &worker->header, mwl8k_conf_tx_wt);
        kfree(worker);
        if (rc == -ETIMEDOUT) {
                printk(KERN_ERR "%s() timed out\n", __func__);
@@ -3220,15 +3047,13 @@ static int mwl8k_get_stats(struct ieee80211_hw *hw,
 {
        int rc;
        struct mwl8k_get_stats_worker *worker;
-       struct mwl8k_priv *priv = hw->priv;
 
        worker = kzalloc(sizeof(*worker), GFP_KERNEL);
        if (worker == NULL)
                return -ENOMEM;
 
        worker->stats = stats;
-       rc = mwl8k_queue_work(hw, &worker->header,
-                             priv->config_wq, mwl8k_get_stats_wt);
+       rc = mwl8k_queue_work(hw, &worker->header, mwl8k_get_stats_wt);
 
        kfree(worker);
        if (rc == -ETIMEDOUT) {
@@ -3457,9 +3282,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev,
        }
 
        /* Disable interrupts */
-       spin_lock_irq(&priv->tx_lock);
        iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK);
-       spin_unlock_irq(&priv->tx_lock);
        free_irq(priv->pdev->irq, hw);
 
        rc = ieee80211_register_hw(hw);
@@ -3483,9 +3306,7 @@ err_stop_firmware:
        mwl8k_release_firmware(priv);
 
 err_free_irq:
-       spin_lock_irq(&priv->tx_lock);
        iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK);
-       spin_unlock_irq(&priv->tx_lock);
        free_irq(priv->pdev->irq, hw);
 
 err_free_queues: