]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - drivers/net/wireless/p54/p54spi.c
p54spi: fix locking warning in p54spi_op_tx
[linux-imx.git] / drivers / net / wireless / p54 / p54spi.c
index 2b222aaa6f0ad0226008e2fb04714e78ba76ad45..d1fe577de3d4de3b8694a6f9002452a0e9da0e57 100644 (file)
@@ -457,9 +457,10 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
        struct ieee80211_tx_info *info;
        struct p54_tx_info *minfo;
        struct p54s_tx_info *dinfo;
+       unsigned long flags;
        int ret = 0;
 
-       spin_lock_bh(&priv->tx_lock);
+       spin_lock_irqsave(&priv->tx_lock, flags);
 
        while (!list_empty(&priv->tx_pending)) {
                entry = list_entry(priv->tx_pending.next,
@@ -467,7 +468,7 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
 
                list_del_init(&entry->tx_list);
 
-               spin_unlock_bh(&priv->tx_lock);
+               spin_unlock_irqrestore(&priv->tx_lock, flags);
 
                dinfo = container_of((void *) entry, struct p54s_tx_info,
                                     tx_list);
@@ -479,16 +480,14 @@ static int p54spi_wq_tx(struct p54s_priv *priv)
 
                ret = p54spi_tx_frame(priv, skb);
 
-               spin_lock_bh(&priv->tx_lock);
-
                if (ret < 0) {
                        p54_free_skb(priv->hw, skb);
-                       goto out;
+                       return ret;
                }
-       }
 
-out:
-       spin_unlock_bh(&priv->tx_lock);
+               spin_lock_irqsave(&priv->tx_lock, flags);
+       }
+       spin_unlock_irqrestore(&priv->tx_lock, flags);
        return ret;
 }
 
@@ -498,12 +497,13 @@ static void p54spi_op_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
        struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data;
        struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data;
+       unsigned long flags;
 
        BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data)));
 
-       spin_lock_bh(&priv->tx_lock);
+       spin_lock_irqsave(&priv->tx_lock, flags);
        list_add_tail(&di->tx_list, &priv->tx_pending);
-       spin_unlock_bh(&priv->tx_lock);
+       spin_unlock_irqrestore(&priv->tx_lock, flags);
 
        queue_work(priv->hw->workqueue, &priv->work);
 }
@@ -604,6 +604,7 @@ out:
 static void p54spi_op_stop(struct ieee80211_hw *dev)
 {
        struct p54s_priv *priv = dev->priv;
+       unsigned long flags;
 
        if (mutex_lock_interruptible(&priv->mutex)) {
                /* FIXME: how to handle this error? */
@@ -615,9 +616,9 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
        cancel_work_sync(&priv->work);
 
        p54spi_power_off(priv);
-       spin_lock_bh(&priv->tx_lock);
+       spin_lock_irqsave(&priv->tx_lock, flags);
        INIT_LIST_HEAD(&priv->tx_pending);
-       spin_unlock_bh(&priv->tx_lock);
+       spin_unlock_irqrestore(&priv->tx_lock, flags);
 
        priv->fw_state = FW_STATE_OFF;
        mutex_unlock(&priv->mutex);