public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: fix balance of privatecnt inc/dec operations
@ 2015-08-07 10:26 Robert Baldyga
  2015-08-10  0:14 ` Krzysztof Kozlowski
  2015-08-17 17:18 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Robert Baldyga @ 2015-08-07 10:26 UTC (permalink / raw)
  To: vinod.koul
  Cc: dan.j.williams, dmaengine, linux-kernel, m.szyprowski,
	k.kozlowski, Robert Baldyga

This patch increments privatecnt value and set DMA_PRIVATE in device
caps in dma_request_slave_channel() function. This is needed to keep
privatecnt increment/decrement balance.

As function dma_release_channel() decrements privatecnt counter, we need
to increment it when channel is requested. Otherwise privatecnt drops
into negatives after few dma_release_channel() calls.

Reported-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
 drivers/dma/dmaengine.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 4a4cce1..3ff284c 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -689,6 +689,10 @@ struct dma_chan *dma_request_slave_channel(struct device *dev,
 	struct dma_chan *ch = dma_request_slave_channel_reason(dev, name);
 	if (IS_ERR(ch))
 		return NULL;
+
+	dma_cap_set(DMA_PRIVATE, ch->device->cap_mask);
+	ch->device->privatecnt++;
+
 	return ch;
 }
 EXPORT_SYMBOL_GPL(dma_request_slave_channel);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: fix balance of privatecnt inc/dec operations
  2015-08-07 10:26 [PATCH] dmaengine: fix balance of privatecnt inc/dec operations Robert Baldyga
@ 2015-08-10  0:14 ` Krzysztof Kozlowski
  2015-08-17 17:18 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2015-08-10  0:14 UTC (permalink / raw)
  To: Robert Baldyga, vinod.koul
  Cc: dan.j.williams, dmaengine, linux-kernel, m.szyprowski

On 07.08.2015 19:26, Robert Baldyga wrote:
> This patch increments privatecnt value and set DMA_PRIVATE in device
> caps in dma_request_slave_channel() function. This is needed to keep
> privatecnt increment/decrement balance.
> 
> As function dma_release_channel() decrements privatecnt counter, we need
> to increment it when channel is requested. Otherwise privatecnt drops
> into negatives after few dma_release_channel() calls.
> 
> Reported-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> ---
>  drivers/dma/dmaengine.c | 4 ++++
>  1 file changed, 4 insertions(+)

Fixes issue [0] (reported after applying [1]).

Tested on Trats2 board (Exynos4412, pl330, serial with DMA)

Best regards,
Krzysztof

[0] http://www.spinics.net/lists/linux-serial/msg18369.html
[1] http://www.spinics.net/lists/linux-samsung-soc/msg45700.html


> 
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 4a4cce1..3ff284c 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -689,6 +689,10 @@ struct dma_chan *dma_request_slave_channel(struct device *dev,
>  	struct dma_chan *ch = dma_request_slave_channel_reason(dev, name);
>  	if (IS_ERR(ch))
>  		return NULL;
> +
> +	dma_cap_set(DMA_PRIVATE, ch->device->cap_mask);
> +	ch->device->privatecnt++;
> +
>  	return ch;
>  }
>  EXPORT_SYMBOL_GPL(dma_request_slave_channel);
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: fix balance of privatecnt inc/dec operations
  2015-08-07 10:26 [PATCH] dmaengine: fix balance of privatecnt inc/dec operations Robert Baldyga
  2015-08-10  0:14 ` Krzysztof Kozlowski
@ 2015-08-17 17:18 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2015-08-17 17:18 UTC (permalink / raw)
  To: Robert Baldyga
  Cc: dan.j.williams, dmaengine, linux-kernel, m.szyprowski,
	k.kozlowski

On Fri, Aug 07, 2015 at 12:26:47PM +0200, Robert Baldyga wrote:
> This patch increments privatecnt value and set DMA_PRIVATE in device
> caps in dma_request_slave_channel() function. This is needed to keep
> privatecnt increment/decrement balance.
> 
> As function dma_release_channel() decrements privatecnt counter, we need
> to increment it when channel is requested. Otherwise privatecnt drops
> into negatives after few dma_release_channel() calls.

Applied, thanks

-- 
~Vinod


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-17 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-07 10:26 [PATCH] dmaengine: fix balance of privatecnt inc/dec operations Robert Baldyga
2015-08-10  0:14 ` Krzysztof Kozlowski
2015-08-17 17:18 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox