]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: most: hdm-usb: reduce context of list_del mutex
authorChristian Gromm <christian.gromm@microchip.com>
Mon, 18 Jul 2016 15:25:27 +0000 (17:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 18:36:47 +0000 (20:36 +0200)
This patch reduces context of the list_del mutex for the function
hdm_enqueue().

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
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 9ec29788c0471f9adfc3050c62d1f29a3dfe89e3..e63784d18d3d5adb26aa5796b314e709c6db3592 100644 (file)
@@ -663,15 +663,11 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
        init_completion(&anchor->urb_compl);
        mbo->priv = anchor;
 
-       spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags);
-       list_add_tail(&anchor->list, &mdev->anchor_list[channel]);
-       spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags);
-
        if ((mdev->padding_active[channel]) &&
            (conf->direction & MOST_CH_TX))
                if (hdm_add_padding(mdev, channel, mbo)) {
                        retval = -EIO;
-                       goto _error_1;
+                       goto _error;
                }
 
        urb->transfer_dma = mbo->bus_address;
@@ -699,6 +695,10 @@ static int hdm_enqueue(struct most_interface *iface, int channel,
        }
        urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
+       spin_lock_irqsave(&mdev->anchor_list_lock[channel], flags);
+       list_add_tail(&anchor->list, &mdev->anchor_list[channel]);
+       spin_unlock_irqrestore(&mdev->anchor_list_lock[channel], flags);
+
        retval = usb_submit_urb(urb, GFP_KERNEL);
        if (retval) {
                dev_err(dev, "URB submit failed with error %d.\n", retval);