diff mbox

dmaengine: altera: Use IRQ-safe spinlock calls in the error paths as well

Message ID 20171016061353.12934-1-sr@denx.de (mailing list archive)
State Accepted
Headers show

Commit Message

Stefan Roese Oct. 16, 2017, 6:13 a.m. UTC
The patch edf10919 [dmaengine: altera: fix spinlock usage] missed to
change 2 occurances of spin_unlock_bh() to spin_unlock_irqrestore().
This patch fixes this by moving to the IRQ-safe call in the error
paths as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Sylvain Lesne <lesne@alse-fr.com>
Cc: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/altera-msgdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sylvain Lesne Oct. 16, 2017, 8:25 a.m. UTC | #1
Hi Stefan,

On 10/16/2017 08:13 AM, Stefan Roese wrote:
> The patch edf10919 [dmaengine: altera: fix spinlock usage] missed to
> change 2 occurances of spin_unlock_bh() to spin_unlock_irqrestore().
> This patch fixes this by moving to the IRQ-safe call in the error
> paths as well.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Sylvain Lesne <lesne@alse-fr.com>
> Cc: Vinod Koul <vinod.koul@intel.com>
> ---
>  drivers/dma/altera-msgdma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
> index 339186f25a2a..55f9c62ee54b 100644
> --- a/drivers/dma/altera-msgdma.c
> +++ b/drivers/dma/altera-msgdma.c
> @@ -344,7 +344,7 @@ msgdma_prep_memcpy(struct dma_chan *dchan, dma_addr_t dma_dst,
>  
>  	spin_lock_irqsave(&mdev->lock, irqflags);
>  	if (desc_cnt > mdev->desc_free_cnt) {
> -		spin_unlock_bh(&mdev->lock);
> +		spin_unlock_irqrestore(&mdev->lock, irqflags);
>  		dev_dbg(mdev->dev, "mdev %p descs are not available\n", mdev);
>  		return NULL;
>  	}
> @@ -407,7 +407,7 @@ msgdma_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
>  
>  	spin_lock_irqsave(&mdev->lock, irqflags);
>  	if (desc_cnt > mdev->desc_free_cnt) {
> -		spin_unlock_bh(&mdev->lock);
> +		spin_unlock_irqrestore(&mdev->lock, irqflags);
>  		dev_dbg(mdev->dev, "mdev %p descs are not available\n", mdev);
>  		return NULL;
>  	}
> 

Thanks for the fix! Sorry about this oversight.

Reviewed-by: Sylvain Lesne <lesne@alse-fr.com>

Thanks,
Sylvain
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul Oct. 20, 2017, 6:23 a.m. UTC | #2
On Mon, Oct 16, 2017 at 08:13:53AM +0200, Stefan Roese wrote:
> The patch edf10919 [dmaengine: altera: fix spinlock usage] missed to
> change 2 occurances of spin_unlock_bh() to spin_unlock_irqrestore().
> This patch fixes this by moving to the IRQ-safe call in the error
> paths as well.

Added Fixes tag, fixed s/occurances/occurrences

Applied, thanks
diff mbox

Patch

diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
index 339186f25a2a..55f9c62ee54b 100644
--- a/drivers/dma/altera-msgdma.c
+++ b/drivers/dma/altera-msgdma.c
@@ -344,7 +344,7 @@  msgdma_prep_memcpy(struct dma_chan *dchan, dma_addr_t dma_dst,
 
 	spin_lock_irqsave(&mdev->lock, irqflags);
 	if (desc_cnt > mdev->desc_free_cnt) {
-		spin_unlock_bh(&mdev->lock);
+		spin_unlock_irqrestore(&mdev->lock, irqflags);
 		dev_dbg(mdev->dev, "mdev %p descs are not available\n", mdev);
 		return NULL;
 	}
@@ -407,7 +407,7 @@  msgdma_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
 
 	spin_lock_irqsave(&mdev->lock, irqflags);
 	if (desc_cnt > mdev->desc_free_cnt) {
-		spin_unlock_bh(&mdev->lock);
+		spin_unlock_irqrestore(&mdev->lock, irqflags);
 		dev_dbg(mdev->dev, "mdev %p descs are not available\n", mdev);
 		return NULL;
 	}