[PATCH] pwm: samsung: Simplify using devm_pwmchip_add()
From: zhaoxiao <hidden>
Date: 2021-09-01 05:45:14
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 <redacted> --- drivers/pwm/pwm-samsung.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index f6c528f02d43..b860a7b8bbdf 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c@@ -560,9 +560,7 @@ static int pwm_samsung_probe(struct platform_device *pdev) chip->tclk0 = devm_clk_get(&pdev->dev, "pwm-tclk0"); chip->tclk1 = devm_clk_get(&pdev->dev, "pwm-tclk1"); - platform_set_drvdata(pdev, chip); - - ret = pwmchip_add(&chip->chip); + ret = devm_pwmchip_add(&pdev->dev, &chip->chip); if (ret < 0) { dev_err(dev, "failed to register PWM chip\n"); clk_disable_unprepare(chip->base_clk);
@@ -577,19 +575,6 @@ static int pwm_samsung_probe(struct platform_device *pdev) return 0; } -static int pwm_samsung_remove(struct platform_device *pdev) -{ - struct samsung_pwm_chip *chip = platform_get_drvdata(pdev); - int ret; - - ret = pwmchip_remove(&chip->chip); - if (ret < 0) - return ret; - - clk_disable_unprepare(chip->base_clk); - - return 0; -} #ifdef CONFIG_PM_SLEEP static int pwm_samsung_resume(struct device *dev)
@@ -635,7 +620,6 @@ static struct platform_driver pwm_samsung_driver = { .of_match_table = of_match_ptr(samsung_pwm_matches), }, .probe = pwm_samsung_probe, - .remove = pwm_samsung_remove, }; module_platform_driver(pwm_samsung_driver);
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel