Skip to content

Commit

Permalink
ARM: 7915/1: amba: Convert to clk_prepare_enable and clk_disable_unpr…
Browse files Browse the repository at this point in the history
…epare

To simplify code and error handling let's use clk_prepare_enable
and clk_disable_unprepare. No functional change.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Ulf Hansson authored and Russell King committed Dec 9, 2013
1 parent 26825cf commit 89a5c98
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions drivers/amba/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,36 +151,23 @@ postcore_initcall(amba_init);

static int amba_get_enable_pclk(struct amba_device *pcdev)
{
struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
int ret;

pcdev->pclk = pclk;
pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk");
if (IS_ERR(pcdev->pclk))
return PTR_ERR(pcdev->pclk);

if (IS_ERR(pclk))
return PTR_ERR(pclk);

ret = clk_prepare(pclk);
if (ret) {
clk_put(pclk);
return ret;
}

ret = clk_enable(pclk);
if (ret) {
clk_unprepare(pclk);
clk_put(pclk);
}
ret = clk_prepare_enable(pcdev->pclk);
if (ret)
clk_put(pcdev->pclk);

return ret;
}

static void amba_put_disable_pclk(struct amba_device *pcdev)
{
struct clk *pclk = pcdev->pclk;

clk_disable(pclk);
clk_unprepare(pclk);
clk_put(pclk);
clk_disable_unprepare(pcdev->pclk);
clk_put(pcdev->pclk);
}

/*
Expand Down

0 comments on commit 89a5c98

Please sign in to comment.