LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] pwm: twl: Simplify using devm_pwmchip_add()
@ 2021-09-07 11:15 zhaoxiao
  2021-09-07 13:37 ` Uwe Kleine-König
  0 siblings, 1 reply; 2+ messages in thread
From: zhaoxiao @ 2021-09-07 11:15 UTC (permalink / raw)
  To: thierry.reding, lee.jones
  Cc: u.kleine-koenig, linux-pwm, linux-kernel, zhaoxiao

With devm_pwmchip_add() we can drop pwmchip_remove() from the device
remove callback. The latter can then go away, too and as this is the
only user of platform_get_drvdata(), the respective call to
platform_set_drvdata() can go, too.

Signed-off-by: zhaoxiao <long870912@gmail.com>
---
 drivers/pwm/pwm-twl-led.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-twl-led.c b/drivers/pwm/pwm-twl-led.c
index 6c8df5f4e87d..1b4494581274 100644
--- a/drivers/pwm/pwm-twl-led.c
+++ b/drivers/pwm/pwm-twl-led.c
@@ -294,22 +294,13 @@ static int twl_pwmled_probe(struct platform_device *pdev)
 
 	mutex_init(&twl->mutex);
 
-	ret = pwmchip_add(&twl->chip);
+	ret = devm_pwmchip_add(&pdev->dev, &twl->chip);
 	if (ret < 0)
 		return ret;
 
-	platform_set_drvdata(pdev, twl);
-
 	return 0;
 }
 
-static int twl_pwmled_remove(struct platform_device *pdev)
-{
-	struct twl_pwmled_chip *twl = platform_get_drvdata(pdev);
-
-	return pwmchip_remove(&twl->chip);
-}
-
 #ifdef CONFIG_OF
 static const struct of_device_id twl_pwmled_of_match[] = {
 	{ .compatible = "ti,twl4030-pwmled" },
@@ -325,7 +316,6 @@ static struct platform_driver twl_pwmled_driver = {
 		.of_match_table = of_match_ptr(twl_pwmled_of_match),
 	},
 	.probe = twl_pwmled_probe,
-	.remove = twl_pwmled_remove,
 };
 module_platform_driver(twl_pwmled_driver);
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pwm: twl: Simplify using devm_pwmchip_add()
  2021-09-07 11:15 [PATCH] pwm: twl: Simplify using devm_pwmchip_add() zhaoxiao
@ 2021-09-07 13:37 ` Uwe Kleine-König
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2021-09-07 13:37 UTC (permalink / raw)
  To: zhaoxiao; +Cc: thierry.reding, lee.jones, linux-pwm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

On Tue, Sep 07, 2021 at 07:15:18PM +0800, zhaoxiao wrote:
> With devm_pwmchip_add() we can drop pwmchip_remove() from the device
> remove callback. The latter can then go away, too and as this is the
> only user of platform_get_drvdata(), the respective call to
> platform_set_drvdata() can go, too.
> 
> Signed-off-by: zhaoxiao <long870912@gmail.com>

A similar patch is already in next as c9bb1c9e5460f6e84e95b65fe4c5bb09d5dff10a

Best regards
Uwe

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-07 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 11:15 [PATCH] pwm: twl: Simplify using devm_pwmchip_add() zhaoxiao
2021-09-07 13:37 ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).