Skip to content

Commit

Permalink
watchdog: ath79_wdt: convert to use devm_clk_get
Browse files Browse the repository at this point in the history
Use the managed version of clk_get. This allows to
simplify the probe/remove functions a bit.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Gabor Juhos authored and Wim Van Sebroeck committed Mar 1, 2013
1 parent 41adafb commit 5071a88
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/watchdog/ath79_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ static int ath79_wdt_probe(struct platform_device *pdev)
u32 ctrl;
int err;

wdt_clk = clk_get(&pdev->dev, "wdt");
wdt_clk = devm_clk_get(&pdev->dev, "wdt");
if (IS_ERR(wdt_clk))
return PTR_ERR(wdt_clk);

err = clk_enable(wdt_clk);
if (err)
goto err_clk_put;
return err;

wdt_freq = clk_get_rate(wdt_clk);
if (!wdt_freq) {
Expand Down Expand Up @@ -265,16 +265,13 @@ static int ath79_wdt_probe(struct platform_device *pdev)

err_clk_disable:
clk_disable(wdt_clk);
err_clk_put:
clk_put(wdt_clk);
return err;
}

static int ath79_wdt_remove(struct platform_device *pdev)
{
misc_deregister(&ath79_wdt_miscdev);
clk_disable(wdt_clk);
clk_put(wdt_clk);
return 0;
}

Expand Down

0 comments on commit 5071a88

Please sign in to comment.