pwm: bcm-kona: Simplify using devm_pwmchip_add()
This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
14ac9e17f9
commit
ccc2df6f80
@ -267,8 +267,6 @@ static int kona_pwmc_probe(struct platform_device *pdev)
|
||||
if (kp == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, kp);
|
||||
|
||||
kp->chip.dev = &pdev->dev;
|
||||
kp->chip.ops = &kona_pwm_ops;
|
||||
kp->chip.npwm = 6;
|
||||
@ -298,20 +296,13 @@ static int kona_pwmc_probe(struct platform_device *pdev)
|
||||
|
||||
clk_disable_unprepare(kp->clk);
|
||||
|
||||
ret = pwmchip_add(&kp->chip);
|
||||
ret = devm_pwmchip_add(&pdev->dev, &kp->chip);
|
||||
if (ret < 0)
|
||||
dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int kona_pwmc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct kona_pwmc *kp = platform_get_drvdata(pdev);
|
||||
|
||||
return pwmchip_remove(&kp->chip);
|
||||
}
|
||||
|
||||
static const struct of_device_id bcm_kona_pwmc_dt[] = {
|
||||
{ .compatible = "brcm,kona-pwm" },
|
||||
{ },
|
||||
@ -324,7 +315,6 @@ static struct platform_driver kona_pwmc_driver = {
|
||||
.of_match_table = bcm_kona_pwmc_dt,
|
||||
},
|
||||
.probe = kona_pwmc_probe,
|
||||
.remove = kona_pwmc_remove,
|
||||
};
|
||||
module_platform_driver(kona_pwmc_driver);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user