All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhaoxiao <zhaoxiao@uniontech.com>
To: krzysztof.kozlowski@canonical.com, thierry.reding@gmail.com,
	lee.jones@linaro.org
Cc: u.kleine-koenig@pengutronix.de,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-pwm@vger.kernel.org,
	linux-kernel@vger.kernel.org, zhaoxiao <zhaoxiao@uniontech.com>
Subject: [PATCH] pwm: samsung: Simplify using devm_pwmchip_add()
Date: Wed,  1 Sep 2021 13:42:30 +0800	[thread overview]
Message-ID: <20210901054230.29678-1-zhaoxiao@uniontech.com> (raw)

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 <zhaoxiao@uniontech.com>
---
 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

             reply	other threads:[~2021-09-01  5:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  5:42 zhaoxiao [this message]
2021-09-01  8:56 ` [PATCH] pwm: samsung: Simplify using devm_pwmchip_add() Krzysztof Kozlowski
2021-09-01  8:56   ` Krzysztof Kozlowski
2021-09-01  9:11   ` zhaoxiao
     [not found]   ` <612f43cc.1c69fb81.205fc.d94bSMTPIN_ADDED_BROKEN@mx.google.com>
2021-09-01  9:42     ` Krzysztof Kozlowski
2021-09-01  9:42       ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210901054230.29678-1-zhaoxiao@uniontech.com \
    --to=zhaoxiao@uniontech.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.