pwm: bcm-kona: Simplify using devm_pwmchip_add()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 7 Jul 2021 16:28:01 +0000 (18:28 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 2 Sep 2021 19:38:40 +0000 (21:38 +0200)
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>
drivers/pwm/pwm-bcm-kona.c

index 8c85c66ea5c9eac9c0c2eb5de0f73d61045855fd..64148f5f81d08b6091e1fdbecc081e5f256e4372 100644 (file)
@@ -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);