Skip to content

Commit

Permalink
clk: wm831x: Use devm_clk_register() to simplify code
Browse files Browse the repository at this point in the history
Move this driver to use devm_clk_register() to simplify some
error paths and reduce lines of code.

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
  • Loading branch information
Stephen Boyd authored and Mike Turquette committed Oct 29, 2012
1 parent 46c8773 commit 9be9d48
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions drivers/clk/clk-wm831x.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,43 +370,27 @@ static __devinit int wm831x_clk_probe(struct platform_device *pdev)
clkdata->xtal_ena = ret & WM831X_XTAL_ENA;

clkdata->xtal_hw.init = &wm831x_xtal_init;
clkdata->xtal = clk_register(&pdev->dev, &clkdata->xtal_hw);
clkdata->xtal = devm_clk_register(&pdev->dev, &clkdata->xtal_hw);
if (IS_ERR(clkdata->xtal))
return PTR_ERR(clkdata->xtal);

clkdata->fll_hw.init = &wm831x_fll_init;
clkdata->fll = clk_register(&pdev->dev, &clkdata->fll_hw);
if (IS_ERR(clkdata->fll)) {
ret = PTR_ERR(clkdata->fll);
goto err_xtal;
}
clkdata->fll = devm_clk_register(&pdev->dev, &clkdata->fll_hw);
if (IS_ERR(clkdata->fll))
return PTR_ERR(clkdata->fll);

clkdata->clkout_hw.init = &wm831x_clkout_init;
clkdata->clkout = clk_register(&pdev->dev, &clkdata->clkout_hw);
if (IS_ERR(clkdata->clkout)) {
ret = PTR_ERR(clkdata->clkout);
goto err_fll;
}
clkdata->clkout = devm_clk_register(&pdev->dev, &clkdata->clkout_hw);
if (IS_ERR(clkdata->clkout))
return PTR_ERR(clkdata->clkout);

dev_set_drvdata(&pdev->dev, clkdata);

return 0;

err_fll:
clk_unregister(clkdata->fll);
err_xtal:
clk_unregister(clkdata->xtal);
return ret;
}

static int __devexit wm831x_clk_remove(struct platform_device *pdev)
{
struct wm831x_clk *clkdata = dev_get_drvdata(&pdev->dev);

clk_unregister(clkdata->clkout);
clk_unregister(clkdata->fll);
clk_unregister(clkdata->xtal);

return 0;
}

Expand Down

0 comments on commit 9be9d48

Please sign in to comment.