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] DMAEngine: sirf: add DMA pause/resume support
Date: Fri, 14 Dec 2012 09:54:02 +0000	[thread overview]
Message-ID: <20121214095402.GH14363@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1355478282-27908-1-git-send-email-Barry.Song@csr.com>

On Fri, Dec 14, 2012 at 05:44:42PM +0800, Barry Song wrote:
> diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
> index 212f69f..ffe05bb 100644
> --- a/drivers/dma/sirf-dma.c
> +++ b/drivers/dma/sirf-dma.c
> @@ -313,6 +313,38 @@ static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan)
>  	return 0;
>  }
>  
> +static int sirfsoc_dma_pause_chan(struct sirfsoc_dma_chan *schan)
> +{
> +	struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(&schan->chan);
> +	int cid = schan->chan.chan_id;
> +
> +	if (!sdma->is_marco)
> +		writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL)
> +			& ~((1 << cid) | 1 << (cid + 16)),
> +			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL);
> +	else
> +		writel_relaxed((1 << cid) | 1 << (cid + 16),
> +			sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL_CLR);

You're doing a read-modify-write to what looks like a shared register.
What makes this code safe in a preempt or SMP environment?

  reply	other threads:[~2012-12-14  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14  9:44 [PATCH] DMAEngine: sirf: add DMA pause/resume support Barry Song
2012-12-14  9:54 ` Russell King - ARM Linux [this message]
2012-12-14 10:47   ` Barry Song

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=20121214095402.GH14363@n2100.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).