linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/48] ARM: PL08x: fix missed spin-unlock in pl08x_issue_pending()
Date: Mon, 03 Jan 2011 22:32:05 +0000	[thread overview]
Message-ID: <E1PZswf-0001OF-I1@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20110103222943.GB4572@n2100.arm.linux.org.uk>

pl08x_issue_pending() returns with the spinlock locked and interrupts
disabled if the channel is waiting for a physical DMA to become free.
This is wrong - especially as pl08x_issue_pending() is an API function
as it leads to deadlocks.  Fix it to always return with the spinlock
unlocked.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/dma/amba-pl08x.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index b3b3180..9a8d445 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1294,15 +1294,11 @@ static void pl08x_issue_pending(struct dma_chan *chan)
 	unsigned long flags;
 
 	spin_lock_irqsave(&plchan->lock, flags);
-	/* Something is already active */
-	if (plchan->at) {
-			spin_unlock_irqrestore(&plchan->lock, flags);
-			return;
-	}
-
-	/* Didn't get a physical channel so waiting for it ... */
-	if (plchan->state == PL08X_CHAN_WAITING)
+	/* Something is already active, or we're waiting for a channel... */
+	if (plchan->at || plchan->state == PL08X_CHAN_WAITING) {
+		spin_unlock_irqrestore(&plchan->lock, flags);
 		return;
+	}
 
 	/* Take the first element in the queue and execute it */
 	if (!list_empty(&plchan->desc_list)) {
-- 
1.6.2.5

  parent reply	other threads:[~2011-01-03 22:32 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-03 22:29 [PATCH 00/48] PL08x DMA Russell King - ARM Linux
2011-01-03 22:30 ` [PATCH 01/48] ARM: PL08x: fix spelling errors Russell King - ARM Linux
2011-01-03 22:30 ` [PATCH 02/48] ARM: PL08x: fix array overflow in dma_set_runtime_config() Russell King - ARM Linux
2011-01-03 22:31 ` [PATCH 03/48] ARM: PL08x: fix atomic_t usage and tx_submit() return value range Russell King - ARM Linux
2011-01-03 22:31 ` [PATCH 04/48] ARM: PL08x: fix locking in tasklet Russell King - ARM Linux
2011-01-03 22:31 ` [PATCH 05/48] ARM: PL08x: fix a leak when preparing TXDs Russell King - ARM Linux
2011-01-03 22:32 ` Russell King - ARM Linux [this message]
2011-01-03 22:32 ` [PATCH 07/48] ARM: PL08x: fix deadlock in terminate_all Russell King - ARM Linux
2011-01-03 22:32 ` [PATCH 08/48] ARM: PL08x: fix sparse warnings Russell King - ARM Linux
2011-01-03 22:33 ` [PATCH 09/48] ARM: PL08x: add comment explaining the flow control methods Russell King - ARM Linux
2011-01-03 22:33 ` [PATCH 10/48] ARM: PL08x: improve the announcement printk Russell King - ARM Linux
2011-01-03 22:33 ` [PATCH 11/48] ARM: PL08x: prefix hex numbers with 0x Russell King - ARM Linux
2011-01-03 22:34 ` [PATCH 12/48] ARM: PL08x: remove unnecessary includes Russell King - ARM Linux
2011-01-03 22:34 ` [PATCH 13/48] ARM: PL08x: remove unnecessary NULL and BUG checks Russell King - ARM Linux
2011-01-03 22:34 ` [PATCH 14/48] ARM: PL08x: remove circular buffer support Russell King - ARM Linux
2011-01-03 22:35 ` [PATCH 15/48] ARM: PL08x: constify vendor data pointers Russell King - ARM Linux
2011-01-03 22:35 ` [PATCH 16/48] ARM: PL08x: avoid 'void *' struct fields when we can type them properly Russell King - ARM Linux
2011-01-03 22:35 ` [PATCH 17/48] ARM: PL08x: consolidate common txd initialization Russell King - ARM Linux
2011-01-03 22:36 ` [PATCH 18/48] ARM: PL08x: consolidate physical channel release code Russell King - ARM Linux
2011-01-03 22:36 ` [PATCH 19/48] ARM: PL08x: ensure loops use cpu_relax() Russell King - ARM Linux
2011-01-03 22:36 ` [PATCH 20/48] ARM: PL08x: don't assume that the LLI pointer has the bus bit clear Russell King - ARM Linux
2011-01-03 22:37 ` [PATCH 21/48] ARM: PL08x: don't try to use llis_bus as a pointer Russell King - ARM Linux
2011-01-03 22:37 ` [PATCH 22/48] ARM: PL08x: use 'size_t' for lengths Russell King - ARM Linux
2011-01-03 22:37 ` [PATCH 23/48] ARM: PL08x: use 'u32' for LLI structure members, not dma_addr_t Russell King - ARM Linux
2011-01-03 22:38 ` [PATCH 24/48] ARM: PL08x: rename lli.next to lli.lli Russell King - ARM Linux
2011-01-03 22:38 ` [PATCH 25/48] ARM: PL08x: clean up LLI lookup Russell King - ARM Linux
2011-01-03 22:38 ` [PATCH 26/48] ARM: PL08x: combine functions to start DMA into one function Russell King - ARM Linux
2011-01-03 22:39 ` [PATCH 27/48] ARM: PL08x: avoid duplicating registers in txd and phychan structures Russell King - ARM Linux
2011-01-15  1:35   ` Dan Williams
2011-01-15  9:23     ` Russell King - ARM Linux
2011-01-16  7:17       ` Dan Williams
2011-01-16 12:20         ` Shinya Kuribayashi
2011-01-16 12:36         ` Russell King - ARM Linux
2011-01-16 19:56           ` Dan Williams
2011-01-16 19:59             ` Russell King - ARM Linux
2011-01-16 20:03               ` Dan Williams
2011-01-16 20:18                 ` Russell King - ARM Linux
2011-01-17  1:36                   ` Dan Williams
2011-01-17  8:50                     ` Russell King - ARM Linux
2011-01-17 19:43                       ` Dan Williams
2011-01-03 22:39 ` [PATCH 28/48] ARM: PL08x: move ccfg into txd structure Russell King - ARM Linux
2011-01-03 22:39 ` [PATCH 29/48] ARM: PL08x: assign ccfg DMA request signal in prep_phy_channel() Russell King - ARM Linux
2011-01-03 22:40 ` [PATCH 30/48] ARM: PL08x: move default cctl into txd structure Russell King - ARM Linux
2011-01-03 22:40 ` [PATCH 31/48] ARM: PL08x: move cctl increment and protection setup to prep_slave_sg Russell King - ARM Linux
2011-01-03 22:40 ` [PATCH 32/48] ARM: PL08x: move AHB master port selection into prep_* functions Russell King - ARM Linux
2011-01-03 22:41 ` [PATCH 33/48] ARM: PL08x: allow AHB master port selection to be configured Russell King - ARM Linux
2011-01-03 22:41 ` [PATCH 34/48] ARM: PL08x: move callback outside spinlock'd region Russell King - ARM Linux
2011-01-03 22:41 ` [PATCH 35/48] ARM: PL08x: make pl08x_fill_lli_for_desc() return void Russell King - ARM Linux
2011-01-03 22:42 ` [PATCH 36/48] ARM: PL08x: ensure pl08x_pre_boundary() works for any value of addr Russell King - ARM Linux
2011-01-03 22:42 ` [PATCH 37/48] ARM: PL08x: use min() to calculate target_len Russell King - ARM Linux
2011-01-03 22:42 ` [PATCH 38/48] ARM: PL08x: fix fill_bytes calculation Russell King - ARM Linux
2011-01-03 22:43 ` [PATCH 39/48] ARM: PL08x: don't manipulate txd->srcbus or txd->dstbus during LLI fill Russell King - ARM Linux
2011-01-03 22:43 ` [PATCH 40/48] ARM: PL08x: shrink srcbus/dstbus in txd structure Russell King - ARM Linux
2011-01-03 22:43 ` [PATCH 41/48] ARM: PL08x: store prep_* flags in async_tx structure Russell King - ARM Linux
2011-01-03 22:44 ` [PATCH 42/48] ARM: PL08x: implement unmapping of memcpy buffers Russell King - ARM Linux
2011-01-03 22:44 ` [PATCH 43/48] ARM: PL08x: rename 'desc_list' as 'pend_list' Russell King - ARM Linux
2011-01-03 22:44 ` [PATCH 44/48] ARM: PL08x: put txd's on the pending list in pl08x_tx_submit() Russell King - ARM Linux
2011-01-03 22:45 ` [PATCH 45/48] ARM: PL08x: introduce 'phychan_hold' to hold on to physical channels Russell King - ARM Linux
2011-01-03 22:45 ` [PATCH 46/48] ARM: PL08x: fix locking between prepare function and submit function Russell King - ARM Linux
2011-01-03 22:45 ` [PATCH 47/48] ARM: PL08x: allow dma_set_runtime_config() to return errors Russell King - ARM Linux
2011-01-03 22:46 ` [PATCH 48/48] ARM: PL08x: prevent dma_set_runtime_config() reconfiguring memcpy channels Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1PZswf-0001OF-I1@rmk-PC.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).