public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: "Lothar Waßmann" <LW@KARO-electronics.de>
Cc: Vinod Koul <vinod.koul@intel.com>,
	Wolfram Sang <w.sang@pengutronix.de>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/4] dma: mxs-dma: make mxs_dma_prep_slave_sg() multi user safe
Date: Thu, 8 Dec 2011 16:22:52 +0800	[thread overview]
Message-ID: <4EE073DC.7050803@freescale.com> (raw)
In-Reply-To: <fd785eed4c58e0ee591084aa5334cafcc8cfe082.1323176362.git.LW@KARO-electronics.de>

于 2011年12月08日 16:15, Lothar Waßmann 写道:
> Using a static variable for counting the number of CCWs attached to
> a DMA channel when appending a new descriptor is not multi user safe.
>
> Signed-off-by: Lothar Waßmann<LW@KARO-electronics.de>
> ---
>   drivers/dma/mxs-dma.c |    5 ++++-
>   1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> index c7574e8..78336b0 100644
> --- a/drivers/dma/mxs-dma.c
> +++ b/drivers/dma/mxs-dma.c
> @@ -111,6 +111,7 @@ struct mxs_dma_chan {
>   	int				chan_irq;
>   	struct mxs_dma_ccw		*ccw;
>   	dma_addr_t			ccw_phys;
> +	int				desc_count;
>   	dma_cookie_t			last_completed;
>   	enum dma_status			status;
>   	unsigned int			flags;
> @@ -386,7 +387,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
>   	struct scatterlist *sg;
>   	int i, j;
>   	u32 *pio;
> -	static int idx;
> +	int idx = append ? mxs_chan->desc_count : 0;
>
>   	if (mxs_chan->status == DMA_IN_PROGRESS&&  !append)
>   		return NULL;
> @@ -462,6 +463,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
>   			}
>   		}
>   	}
> +	mxs_chan->desc_count = idx;
>
>   	return&mxs_chan->desc;
>
> @@ -523,6 +525,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
>
>   		i++;
>   	}
> +	mxs_chan->desc_count = i;
>
>   	return&mxs_chan->desc;
>
I like this patch.


  reply	other threads:[~2011-12-08  8:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08  8:15 [PATCH 0/4] dma: mxs-dma: several bugfixes for the MXS DMA driver Lothar Waßmann
2011-12-08  8:15 ` [PATCH 1/4] dma: mxs-dma: fix a typo in comment Lothar Waßmann
2011-12-08  8:15 ` [PATCH 2/4] dma: mxs-dma: Always leave mxs_dma_init() with the clock disabled Lothar Waßmann
2011-12-08  8:15 ` [PATCH 3/4] dma: mxs-dma: make mxs_dma_prep_slave_sg() multi user safe Lothar Waßmann
2011-12-08  8:22   ` Huang Shijie [this message]
2011-12-08  8:15 ` [PATCH 4/4] dma: mxs-dma: Don't use CLKGATE bits in CTRL0 to disable DMA channels Lothar Waßmann
2011-12-08  8:29   ` Huang Shijie
2011-12-08 10:52   ` Huang Shijie
2011-12-23 15:21 ` [PATCH 0/4] dma: mxs-dma: several bugfixes for the MXS DMA driver Vinod Koul

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=4EE073DC.7050803@freescale.com \
    --to=b32955@freescale.com \
    --cc=LW@KARO-electronics.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinod.koul@intel.com \
    --cc=w.sang@pengutronix.de \
    /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