linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma/ste_dma40: Fixup clock usage during probe
@ 2012-08-23 11:41 Ulf Hansson
  2012-08-31  0:36 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Ulf Hansson @ 2012-08-23 11:41 UTC (permalink / raw)
  To: Vinod Koul
  Cc: linux-kernel, Dan Williams, Lee Jones, Srinidhi Kasagar, Ulf Hansson

From: Ulf Hansson <ulf.hansson@linaro.org>

Fixup some errorhandling for clocks during probe and make sure
to use clk_prepare as well as clk_enable.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/dma/ste_dma40.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 000d309..826d0d5 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2920,19 +2920,23 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 	struct d40_base *base = NULL;
 	int num_log_chans = 0;
 	int num_phy_chans;
+	int clk_ret = -EINVAL;
 	int i;
 	u32 pid;
 	u32 cid;
 	u8 rev;
 
 	clk = clk_get(&pdev->dev, NULL);
-
 	if (IS_ERR(clk)) {
 		d40_err(&pdev->dev, "No matching clock found\n");
 		goto failure;
 	}
 
-	clk_enable(clk);
+	clk_ret = clk_prepare_enable(clk);
+	if (clk_ret) {
+		d40_err(&pdev->dev, "Failed to prepare/enable clock\n");
+		goto failure;
+	}
 
 	/* Get IO for DMAC base address */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "base");
@@ -3062,10 +3066,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
 	return base;
 
 failure:
-	if (!IS_ERR(clk)) {
-		clk_disable(clk);
+	if (!clk_ret)
+		clk_disable_unprepare(clk);
+	if (!IS_ERR(clk))
 		clk_put(clk);
-	}
 	if (virtbase)
 		iounmap(virtbase);
 	if (res)
-- 
1.7.10


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

* Re: [PATCH] dma/ste_dma40: Fixup clock usage during probe
  2012-08-23 11:41 [PATCH] dma/ste_dma40: Fixup clock usage during probe Ulf Hansson
@ 2012-08-31  0:36 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2012-08-31  0:36 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: vinod.koul, linux-kernel, djbw, Lee Jones, Srinidhi Kasagar, Ulf Hansson

On Thu, 2012-08-23 at 13:41 +0200, Ulf Hansson wrote:
> From: Ulf Hansson <ulf.hansson@linaro.org>
> 
> Fixup some errorhandling for clocks during probe and make sure
> to use clk_prepare as well as clk_enable.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Applied, thanks

-- 
~Vinod Koul
Intel Corp.


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

end of thread, other threads:[~2012-08-31  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23 11:41 [PATCH] dma/ste_dma40: Fixup clock usage during probe Ulf Hansson
2012-08-31  0:36 ` Vinod Koul

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).