Commit 2b8e30b1 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Thierry Reding

pwm: clk: Use the devm_clk_get_prepared() helper function

Use the devm_clk_get_prepared() helper function instead of hand-writing it.
It saves some line of codes.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent ac9a7868
...@@ -89,7 +89,7 @@ static int pwm_clk_probe(struct platform_device *pdev) ...@@ -89,7 +89,7 @@ static int pwm_clk_probe(struct platform_device *pdev)
if (!pcchip) if (!pcchip)
return -ENOMEM; return -ENOMEM;
pcchip->clk = devm_clk_get(&pdev->dev, NULL); pcchip->clk = devm_clk_get_prepared(&pdev->dev, NULL);
if (IS_ERR(pcchip->clk)) if (IS_ERR(pcchip->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(pcchip->clk), return dev_err_probe(&pdev->dev, PTR_ERR(pcchip->clk),
"Failed to get clock\n"); "Failed to get clock\n");
...@@ -98,15 +98,9 @@ static int pwm_clk_probe(struct platform_device *pdev) ...@@ -98,15 +98,9 @@ static int pwm_clk_probe(struct platform_device *pdev)
pcchip->chip.ops = &pwm_clk_ops; pcchip->chip.ops = &pwm_clk_ops;
pcchip->chip.npwm = 1; pcchip->chip.npwm = 1;
ret = clk_prepare(pcchip->clk);
if (ret < 0)
return dev_err_probe(&pdev->dev, ret, "Failed to prepare clock\n");
ret = pwmchip_add(&pcchip->chip); ret = pwmchip_add(&pcchip->chip);
if (ret < 0) { if (ret < 0)
clk_unprepare(pcchip->clk);
return dev_err_probe(&pdev->dev, ret, "Failed to add pwm chip\n"); return dev_err_probe(&pdev->dev, ret, "Failed to add pwm chip\n");
}
platform_set_drvdata(pdev, pcchip); platform_set_drvdata(pdev, pcchip);
return 0; return 0;
...@@ -120,8 +114,6 @@ static void pwm_clk_remove(struct platform_device *pdev) ...@@ -120,8 +114,6 @@ static void pwm_clk_remove(struct platform_device *pdev)
if (pcchip->clk_enabled) if (pcchip->clk_enabled)
clk_disable(pcchip->clk); clk_disable(pcchip->clk);
clk_unprepare(pcchip->clk);
} }
static const struct of_device_id pwm_clk_dt_ids[] = { static const struct of_device_id pwm_clk_dt_ids[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment