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

index 990e790..23dc1fb 100644 (file)
@@ -245,16 +245,7 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
        jz4740->chip.ops = &jz4740_pwm_ops;
        jz4740->chip.npwm = info->num_pwms;
 
-       platform_set_drvdata(pdev, jz4740);
-
-       return pwmchip_add(&jz4740->chip);
-}
-
-static int jz4740_pwm_remove(struct platform_device *pdev)
-{
-       struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev);
-
-       return pwmchip_remove(&jz4740->chip);
+       return devm_pwmchip_add(dev, &jz4740->chip);
 }
 
 static const struct soc_info __maybe_unused jz4740_soc_info = {
@@ -280,7 +271,6 @@ static struct platform_driver jz4740_pwm_driver = {
                .of_match_table = of_match_ptr(jz4740_pwm_dt_ids),
        },
        .probe = jz4740_pwm_probe,
-       .remove = jz4740_pwm_remove,
 };
 module_platform_driver(jz4740_pwm_driver);