diff mbox

[2/8] at_hdmac: prepare clk before calling enable

Message ID 1371640494-9472-1-git-send-email-b.brezillon@overkiz.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris BREZILLON June 19, 2013, 11:14 a.m. UTC
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
 drivers/dma/at_hdmac.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Nicolas Ferre June 20, 2013, 7:43 a.m. UTC | #1
On 19/06/2013 13:14, Boris BREZILLON :
> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
> avoid common clk framework warnings.
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

BTW Vinod, it seems that we have several slave-dma patches pending: do 
you want me to collect them and send you a pull-request for 3.11?

Best regards,

> ---
>   drivers/dma/at_hdmac.c |   17 +++++++++++------
>   1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e923cda..19a484a 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1374,7 +1374,9 @@ static int __init at_dma_probe(struct platform_device *pdev)
>   		err = PTR_ERR(atdma->clk);
>   		goto err_clk;
>   	}
> -	clk_enable(atdma->clk);
> +	err = clk_prepare_enable(atdma->clk);
> +	if (err)
> +		goto err_clk_prepare;
>
>   	/* force dma off, just in case */
>   	at_dma_off(atdma);
> @@ -1475,7 +1477,8 @@ err_pool_create:
>   	platform_set_drvdata(pdev, NULL);
>   	free_irq(platform_get_irq(pdev, 0), atdma);
>   err_irq:
> -	clk_disable(atdma->clk);
> +	clk_disable_unprepare(atdma->clk);
> +err_clk_prepare:
>   	clk_put(atdma->clk);
>   err_clk:
>   	iounmap(atdma->regs);
> @@ -1512,7 +1515,7 @@ static int at_dma_remove(struct platform_device *pdev)
>   		list_del(&chan->device_node);
>   	}
>
> -	clk_disable(atdma->clk);
> +	clk_disable_unprepare(atdma->clk);
>   	clk_put(atdma->clk);
>
>   	iounmap(atdma->regs);
> @@ -1531,7 +1534,7 @@ static void at_dma_shutdown(struct platform_device *pdev)
>   	struct at_dma	*atdma = platform_get_drvdata(pdev);
>
>   	at_dma_off(platform_get_drvdata(pdev));
> -	clk_disable(atdma->clk);
> +	clk_disable_unprepare(atdma->clk);
>   }
>
>   static int at_dma_prepare(struct device *dev)
> @@ -1588,7 +1591,7 @@ static int at_dma_suspend_noirq(struct device *dev)
>
>   	/* disable DMA controller */
>   	at_dma_off(atdma);
> -	clk_disable(atdma->clk);
> +	clk_disable_unprepare(atdma->clk);
>   	return 0;
>   }
>
> @@ -1618,7 +1621,9 @@ static int at_dma_resume_noirq(struct device *dev)
>   	struct dma_chan *chan, *_chan;
>
>   	/* bring back DMA controller */
> -	clk_enable(atdma->clk);
> +	err = clk_prepare_enable(atdma->clk);
> +	if (err)
> +		return err;
>   	dma_writel(atdma, EN, AT_DMA_ENABLE);
>
>   	/* clear any pending interrupt */
>
Vinod Koul June 21, 2013, 2:40 a.m. UTC | #2
On Thu, Jun 20, 2013 at 09:43:52AM +0200, Nicolas Ferre wrote:
> On 19/06/2013 13:14, Boris BREZILLON :
> >Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
> >avoid common clk framework warnings.
> >
> >Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
> 
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> BTW Vinod, it seems that we have several slave-dma patches pending:
> do you want me to collect them and send you a pull-request for 3.11?
I think those are the DT binding one, right? Sorry have been quite busy and
travelling. I could use the help right now...

--
~Vinod
Nicolas Ferre June 24, 2013, 5:40 p.m. UTC | #3
On 21/06/2013 04:40, Vinod Koul :
> On Thu, Jun 20, 2013 at 09:43:52AM +0200, Nicolas Ferre wrote:
>> On 19/06/2013 13:14, Boris BREZILLON :
>>> Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
>>> avoid common clk framework warnings.
>>>
>>> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
>>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>
>> BTW Vinod, it seems that we have several slave-dma patches pending:
>> do you want me to collect them and send you a pull-request for 3.11?
> I think those are the DT binding one, right? Sorry have been quite busy and
> travelling. I could use the help right now...

Vinod,

I have just sent the pull-request with all patches that you may take for 
3.11 ([GIT PULL] dmaengine: at_hdmac: updates for 3.11). It is a signed 
tag "at91-sdma" on our github space.

I hope that it will be easy for you to take it in your slave-dma git 
tree. If you have any question, please let me know.

Best regards,
diff mbox

Patch

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e923cda..19a484a 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1374,7 +1374,9 @@  static int __init at_dma_probe(struct platform_device *pdev)
 		err = PTR_ERR(atdma->clk);
 		goto err_clk;
 	}
-	clk_enable(atdma->clk);
+	err = clk_prepare_enable(atdma->clk);
+	if (err)
+		goto err_clk_prepare;
 
 	/* force dma off, just in case */
 	at_dma_off(atdma);
@@ -1475,7 +1477,8 @@  err_pool_create:
 	platform_set_drvdata(pdev, NULL);
 	free_irq(platform_get_irq(pdev, 0), atdma);
 err_irq:
-	clk_disable(atdma->clk);
+	clk_disable_unprepare(atdma->clk);
+err_clk_prepare:
 	clk_put(atdma->clk);
 err_clk:
 	iounmap(atdma->regs);
@@ -1512,7 +1515,7 @@  static int at_dma_remove(struct platform_device *pdev)
 		list_del(&chan->device_node);
 	}
 
-	clk_disable(atdma->clk);
+	clk_disable_unprepare(atdma->clk);
 	clk_put(atdma->clk);
 
 	iounmap(atdma->regs);
@@ -1531,7 +1534,7 @@  static void at_dma_shutdown(struct platform_device *pdev)
 	struct at_dma	*atdma = platform_get_drvdata(pdev);
 
 	at_dma_off(platform_get_drvdata(pdev));
-	clk_disable(atdma->clk);
+	clk_disable_unprepare(atdma->clk);
 }
 
 static int at_dma_prepare(struct device *dev)
@@ -1588,7 +1591,7 @@  static int at_dma_suspend_noirq(struct device *dev)
 
 	/* disable DMA controller */
 	at_dma_off(atdma);
-	clk_disable(atdma->clk);
+	clk_disable_unprepare(atdma->clk);
 	return 0;
 }
 
@@ -1618,7 +1621,9 @@  static int at_dma_resume_noirq(struct device *dev)
 	struct dma_chan *chan, *_chan;
 
 	/* bring back DMA controller */
-	clk_enable(atdma->clk);
+	err = clk_prepare_enable(atdma->clk);
+	if (err)
+		return err;
 	dma_writel(atdma, EN, AT_DMA_ENABLE);
 
 	/* clear any pending interrupt */