staging: most: hdm-usb: remove redundant spinlocks
authorChristian Gromm <christian.gromm@microchip.com>
Mon, 19 Sep 2016 15:40:23 +0000 (17:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Sep 2016 06:39:42 +0000 (08:39 +0200)
This patch removes the spinlocks when accessing the usb_anchor list,
because the struct usb_anchor is using its own lock.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/hdm-usb/hdm_usb.c

index 58f65a4384f6d64c3918513091479bee39341937..f872ce9e43a1fbc5a34fa160fa52b235eb396c23 100644 (file)
@@ -197,12 +197,8 @@ static void free_anchored_buffers(struct most_dev *mdev, unsigned int channel,
 {
        struct mbo *mbo;
        struct urb *urb;
-       spinlock_t *lock = mdev->anchor_list_lock + channel; /* temp. lock */
-       unsigned long flags;
 
-       spin_lock_irqsave(lock, flags);
        while ((urb = usb_get_from_anchor(&mdev->busy_urbs[channel]))) {
-               spin_unlock_irqrestore(lock, flags);
                mbo = urb->context;
                usb_kill_urb(urb);
                if (mbo && mbo->complete) {
@@ -211,9 +207,7 @@ static void free_anchored_buffers(struct most_dev *mdev, unsigned int channel,
                        mbo->complete(mbo);
                }
                usb_free_urb(urb);
-               spin_lock_irqsave(lock, flags);
        }
-       spin_unlock_irqrestore(lock, flags);
 }
 
 /**
@@ -605,10 +599,8 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
        struct device *dev;
        int retval = 0;
        struct urb *urb;
-       unsigned long flags;
        unsigned long length;
        void *virt_address;
-       spinlock_t *lock; /* temp. lock */
 
        if (unlikely(!iface || !mbo))
                return -EIO;
@@ -657,10 +649,7 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
        }
        urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
-       lock = mdev->anchor_list_lock + channel;
-       spin_lock_irqsave(lock, flags);
        usb_anchor_urb(urb, &mdev->busy_urbs[channel]);
-       spin_unlock_irqrestore(lock, flags);
 
        retval = usb_submit_urb(urb, GFP_KERNEL);
        if (retval) {
@@ -670,9 +659,7 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
        return 0;
 
 _error_1:
-       spin_lock_irqsave(lock, flags);
        usb_unanchor_urb(urb);
-       spin_unlock_irqrestore(lock, flags);
 _error:
        usb_free_urb(urb);
        return retval;