]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00291729 PXP: remove a mutex lock from pxp channel
authorFancy Fang <B47543@freescale.com>
Wed, 11 Dec 2013 10:21:10 +0000 (18:21 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:48 +0000 (10:06 +0200)
This mutex lock is no longer necessary in PXP dma driver. After
the commit "ENGR00291400 PXP: Organize PXP task queue to be FIFO",
protection fields can be protected by the spin lock in PXP channel
now.

Signed-off-by: Fancy Fang <B47543@freescale.com>
drivers/dma/pxp/pxp_dma_v2.c
include/linux/pxp_dma.h

index 30d6a14e20ce4e8c3595e9128ace4d094c774599..4cbcde5960050408ac85e5453dc8d227591a614d 100644 (file)
@@ -1149,7 +1149,8 @@ static dma_cookie_t pxp_tx_submit(struct dma_async_tx_descriptor *tx)
 
        dev_dbg(&pxp_chan->dma_chan.dev->device, "received TX\n");
 
-       mutex_lock(&pxp_chan->chan_mutex);
+       /* pxp_chan->lock can be taken under ichan->lock, but not v.v. */
+       spin_lock_irqsave(&pxp_chan->lock, flags);
 
        cookie = pxp_chan->dma_chan.cookie;
 
@@ -1160,9 +1161,6 @@ static dma_cookie_t pxp_tx_submit(struct dma_async_tx_descriptor *tx)
        pxp_chan->dma_chan.cookie = cookie;
        tx->cookie = cookie;
 
-       /* pxp_chan->lock can be taken under ichan->lock, but not v.v. */
-       spin_lock_irqsave(&pxp_chan->lock, flags);
-
        /* Here we add the tx descriptor to our PxP task queue. */
        list_add_tail(&desc->list, &pxp_chan->queue);
 
@@ -1170,7 +1168,6 @@ static dma_cookie_t pxp_tx_submit(struct dma_async_tx_descriptor *tx)
 
        dev_dbg(&pxp_chan->dma_chan.dev->device, "done TX\n");
 
-       mutex_unlock(&pxp_chan->chan_mutex);
        return cookie;
 }
 
@@ -1379,15 +1376,16 @@ static void __pxp_terminate_all(struct dma_chan *chan)
 static int pxp_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
                        unsigned long arg)
 {
+       unsigned long flags;
        struct pxp_channel *pxp_chan = to_pxp_channel(chan);
 
        /* Only supports DMA_TERMINATE_ALL */
        if (cmd != DMA_TERMINATE_ALL)
                return -ENXIO;
 
-       mutex_lock(&pxp_chan->chan_mutex);
+       spin_lock_irqsave(&pxp_chan->lock, flags);
        __pxp_terminate_all(chan);
-       mutex_unlock(&pxp_chan->chan_mutex);
+       spin_unlock_irqrestore(&pxp_chan->lock, flags);
 
        return 0;
 }
@@ -1423,15 +1421,16 @@ err_chan:
 
 static void pxp_free_chan_resources(struct dma_chan *chan)
 {
+       unsigned long flags;
        struct pxp_channel *pxp_chan = to_pxp_channel(chan);
 
-       mutex_lock(&pxp_chan->chan_mutex);
+       spin_lock_irqsave(&pxp_chan->lock, flags);
 
        __pxp_terminate_all(chan);
 
        pxp_chan->status = PXP_CHANNEL_FREE;
 
-       mutex_unlock(&pxp_chan->chan_mutex);
+       spin_unlock_irqrestore(&pxp_chan->lock, flags);
 }
 
 static enum dma_status pxp_tx_status(struct dma_chan *chan,
@@ -1589,7 +1588,6 @@ static int pxp_dma_init(struct pxps *pxp)
                struct dma_chan *dma_chan = &pxp_chan->dma_chan;
 
                spin_lock_init(&pxp_chan->lock);
-               mutex_init(&pxp_chan->chan_mutex);
 
                /* Only one EOF IRQ for PxP, shared by all channels */
                pxp_chan->eof_irq = pxp->irq;
index 61b3e7de4c5784e2a19483290a72261511533f61..613d89f143f93d643b70c50cbfe44f34a4643bc8 100644 (file)
@@ -47,8 +47,9 @@ struct pxp_channel {
        struct pxp_tx_desc *desc;       /* allocated tx-descriptors */
        struct list_head queue; /* queued tx-descriptors */
        struct list_head list;  /* track queued channel number */
-       spinlock_t lock;        /* protects sg[0,1], queue */
-       struct mutex chan_mutex;        /* protects status, cookie, free_list */
+       spinlock_t lock;        /* protects sg[0,1], queue,
+                                * status, cookie, free_list
+                                */
        int active_buffer;
        unsigned int eof_irq;
        char eof_name[16];      /* EOF IRQ name for request_irq()  */