summaryrefslogtreecommitdiffstats
path: root/drivers/pwm
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-14 10:32:26 +0100
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-19 11:04:14 +0100
commitef2092b5af05355e24fef83d0237cb450cd5f190 (patch)
treebe7824ae05f414b80e145989a1cb383887332e2f /drivers/pwm
parentpwm: samsung: Make use of pwmchip_parent() accessor (diff)
downloadlinux-ef2092b5af05355e24fef83d0237cb450cd5f190.tar.xz
linux-ef2092b5af05355e24fef83d0237cb450cd5f190.zip
pwm: samsung: Simplify by using devm functions in probe
With using devm_clk_get_enabled() and devm_pwmchip_add() the .remove_new() callback can be dropped and an error path in .probe() simplified. Link: https://lore.kernel.org/r/d46ec625c14c460039082f74ec8ca3084b7c8e3a.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-samsung.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index cabdcdf37ec9..81a2e66e927e 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -577,18 +577,12 @@ static int pwm_samsung_probe(struct platform_device *pdev)
if (IS_ERR(our_chip->base))
return PTR_ERR(our_chip->base);
- our_chip->base_clk = devm_clk_get(&pdev->dev, "timers");
+ our_chip->base_clk = devm_clk_get_enabled(&pdev->dev, "timers");
if (IS_ERR(our_chip->base_clk)) {
dev_err(dev, "failed to get timer base clk\n");
return PTR_ERR(our_chip->base_clk);
}
- ret = clk_prepare_enable(our_chip->base_clk);
- if (ret < 0) {
- dev_err(dev, "failed to enable base clock\n");
- return ret;
- }
-
for (chan = 0; chan < SAMSUNG_PWM_NUM; ++chan)
if (our_chip->variant.output_mask & BIT(chan))
pwm_samsung_set_invert(our_chip, chan, true);
@@ -599,10 +593,9 @@ static int pwm_samsung_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, chip);
- ret = pwmchip_add(chip);
+ ret = devm_pwmchip_add(&pdev->dev, chip);
if (ret < 0) {
dev_err(dev, "failed to register PWM chip\n");
- clk_disable_unprepare(our_chip->base_clk);
return ret;
}
@@ -614,16 +607,6 @@ static int pwm_samsung_probe(struct platform_device *pdev)
return 0;
}
-static void pwm_samsung_remove(struct platform_device *pdev)
-{
- struct pwm_chip *chip = platform_get_drvdata(pdev);
- struct samsung_pwm_chip *our_chip = to_samsung_pwm_chip(chip);
-
- pwmchip_remove(chip);
-
- clk_disable_unprepare(our_chip->base_clk);
-}
-
static int pwm_samsung_resume(struct device *dev)
{
struct pwm_chip *chip = dev_get_drvdata(dev);
@@ -666,7 +649,6 @@ static struct platform_driver pwm_samsung_driver = {
.of_match_table = of_match_ptr(samsung_pwm_matches),
},
.probe = pwm_samsung_probe,
- .remove_new = pwm_samsung_remove,
};
module_platform_driver(pwm_samsung_driver);