Skip to contentSkip to conversation

pwm: visconti: Simplify using devm_pwmchip_add()

PATCH In review zhaoxiao 2 participants 2 messages Sep 13, 2021

Subsystems (2)
lore
Share & tools
lore

zhaoxiao

author
#0 lore raw

PATCH 1/1 pwm: visconti: 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.

---
 drivers/pwm/pwm-visconti.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/pwm/pwm-visconti.c +1 -13
index af4e37d3e3a6..927c4cbb1daf 100644
@@ -144,28 +144,17 @@ static int visconti_pwm_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->base))
 		return PTR_ERR(priv->base);
 
-	platform_set_drvdata(pdev, priv);
-
 	priv->chip.dev = dev;
 	priv->chip.ops = &visconti_pwm_ops;
 	priv->chip.npwm = 4;
 
-	ret = pwmchip_add(&priv->chip);
+	ret = devm_pwmchip_add(&pdev->dev, &priv->chip);
 	if (ret < 0)
 		return dev_err_probe(&pdev->dev, ret, "Cannot register visconti PWM\n");
 
 	return 0;
 }
 
-static int visconti_pwm_remove(struct platform_device *pdev)
-{
-	struct visconti_pwm_chip *priv = platform_get_drvdata(pdev);
-
-	pwmchip_remove(&priv->chip);
-
-	return 0;
-}
-
 static const struct of_device_id visconti_pwm_of_match[] = {
 	{ .compatible = "toshiba,visconti-pwm", },
 	{ }
@@ -178,7 +167,6 @@ static struct platform_driver visconti_pwm_driver = {
 		.of_match_table = visconti_pwm_of_match,
 	},
 	.probe = visconti_pwm_probe,
-	.remove = visconti_pwm_remove,
 };
 module_platform_driver(visconti_pwm_driver);
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · zhaoxiao

This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too.

Oh, it seems I missed that one when I converted the PWM drivers to use devm_pwmchip_add(). Probably because the driver is new and wasn't in my tree when I started the conversion. Thanks

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |