Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] pwm: Some random cleanups
@ 2023-09-29 16:19 Uwe Kleine-König
  2023-09-29 16:19 ` [PATCH 05/11] pwm: mtk-disp: Simplify using devm_pwmchip_add() Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2023-09-29 16:19 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Ray Jui, Scott Branden, Broadcom internal kernel review list,
	linux-pwm, linux-arm-kernel, kernel, Florian Fainelli,
	linux-rpi-kernel, Shawn Guo, Sascha Hauer, Fabio Estevam,
	NXP Linux Team, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-mediatek, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Krzysztof Kozlowski, Alim Akhtar, linux-samsung-soc, Benson Leung,
	Guenter Roeck, chrome-platform

Hello,

this is a set of patches I based my efforts for closing a race condition
in the pwm core on. I thought I already sent them out, but it seems I
didn't. So here they come!

Best regards
Uwe

Uwe Kleine-König (11):
  pwm: bcm-iproc: Simplify using devm functions
  pwm: bcm2835: Simplify using devm functions
  pwm: brcmstb: Simplify using devm functions
  pwm: imx-tpm: Simplify using devm functions
  pwm: mtk-disp: Simplify using devm_pwmchip_add()
  pwm: spear: Simplify using devm functions
  pwm: sprd: Provide a helper to cast a chip to driver data
  pwm: sprd: Simplify using devm_pwmchip_add() and dev_err_probe()
  pwm: vt8500: Simplify using devm functions
  pwm: samsung: Consistently use the same name for driver data
  pwm: cros-ec: Simplify using devm_pwmchip_add() and dev_err_probe()

 drivers/pwm/pwm-bcm-iproc.c |  37 +++-------
 drivers/pwm/pwm-bcm2835.c   |  27 ++------
 drivers/pwm/pwm-brcmstb.c   |  42 +++---------
 drivers/pwm/pwm-cros-ec.c   |  33 +++------
 drivers/pwm/pwm-imx-tpm.c   |  29 ++------
 drivers/pwm/pwm-mtk-disp.c  |  24 ++-----
 drivers/pwm/pwm-samsung.c   | 130 ++++++++++++++++++------------------
 drivers/pwm/pwm-spear.c     |  40 +++--------
 drivers/pwm/pwm-sprd.c      |  28 +++-----
 drivers/pwm/pwm-vt8500.c    |  42 +++---------
 10 files changed, 137 insertions(+), 295 deletions(-)

base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
-- 
2.40.1



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

* [PATCH 05/11] pwm: mtk-disp: Simplify using devm_pwmchip_add()
  2023-09-29 16:19 [PATCH 00/11] pwm: Some random cleanups Uwe Kleine-König
@ 2023-09-29 16:19 ` Uwe Kleine-König
  2023-10-02 10:44   ` AngeloGioacchino Del Regno
  2023-11-13  3:23 ` [PATCH 00/11] pwm: Some random cleanups patchwork-bot+chrome-platform
  2023-11-13  3:42 ` patchwork-bot+chrome-platform
  2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2023-09-29 16:19 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-pwm, kernel,
	linux-arm-kernel, linux-mediatek

With devm_pwmchip_add() pwmchip_remove() can be dropped from the remove
callback. Then the remove callback is empty and can go away, too. With
mtk_disp_pwm_remove() the last user of platform_get_drvdata() is gone and
so platform_set_drvdata() can be dropped, too.

Also use dev_err_probe() for simplified (and improved) error reporting.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-mtk-disp.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index a83bd6e18b07..e34fb4409695 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -247,34 +247,25 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
 
 	mdp->clk_main = devm_clk_get(&pdev->dev, "main");
 	if (IS_ERR(mdp->clk_main))
-		return PTR_ERR(mdp->clk_main);
+		return dev_err_probe(&pdev->dev, PTR_ERR(mdp->clk_main),
+				     "Failed to get main clock\n");
 
 	mdp->clk_mm = devm_clk_get(&pdev->dev, "mm");
 	if (IS_ERR(mdp->clk_mm))
-		return PTR_ERR(mdp->clk_mm);
+		return dev_err_probe(&pdev->dev, PTR_ERR(mdp->clk_mm),
+				     "Failed to get mm clock\n");
 
 	mdp->chip.dev = &pdev->dev;
 	mdp->chip.ops = &mtk_disp_pwm_ops;
 	mdp->chip.npwm = 1;
 
-	ret = pwmchip_add(&mdp->chip);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "pwmchip_add() failed: %pe\n", ERR_PTR(ret));
-		return ret;
-	}
-
-	platform_set_drvdata(pdev, mdp);
+	ret = devm_pwmchip_add(&pdev->dev, &mdp->chip);
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret, "pwmchip_add() failed\n");
 
 	return 0;
 }
 
-static void mtk_disp_pwm_remove(struct platform_device *pdev)
-{
-	struct mtk_disp_pwm *mdp = platform_get_drvdata(pdev);
-
-	pwmchip_remove(&mdp->chip);
-}
-
 static const struct mtk_pwm_data mt2701_pwm_data = {
 	.enable_mask = BIT(16),
 	.con0 = 0xa8,
@@ -320,7 +311,6 @@ static struct platform_driver mtk_disp_pwm_driver = {
 		.of_match_table = mtk_disp_pwm_of_match,
 	},
 	.probe = mtk_disp_pwm_probe,
-	.remove_new = mtk_disp_pwm_remove,
 };
 module_platform_driver(mtk_disp_pwm_driver);
 
-- 
2.40.1



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

* Re: [PATCH 05/11] pwm: mtk-disp: Simplify using devm_pwmchip_add()
  2023-09-29 16:19 ` [PATCH 05/11] pwm: mtk-disp: Simplify using devm_pwmchip_add() Uwe Kleine-König
@ 2023-10-02 10:44   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-10-02 10:44 UTC (permalink / raw)
  To: Uwe Kleine-König, Thierry Reding
  Cc: Matthias Brugger, linux-pwm, kernel, linux-arm-kernel,
	linux-mediatek

Il 29/09/23 18:19, Uwe Kleine-König ha scritto:
> With devm_pwmchip_add() pwmchip_remove() can be dropped from the remove
> callback. Then the remove callback is empty and can go away, too. With
> mtk_disp_pwm_remove() the last user of platform_get_drvdata() is gone and
> so platform_set_drvdata() can be dropped, too.
> 
> Also use dev_err_probe() for simplified (and improved) error reporting.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

I actually wanted to do that myself, but I see you came in first. :-)

Looks good to me!

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>




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

* Re: [PATCH 00/11] pwm: Some random cleanups
  2023-09-29 16:19 [PATCH 00/11] pwm: Some random cleanups Uwe Kleine-König
  2023-09-29 16:19 ` [PATCH 05/11] pwm: mtk-disp: Simplify using devm_pwmchip_add() Uwe Kleine-König
@ 2023-11-13  3:23 ` patchwork-bot+chrome-platform
  2023-11-13  3:42 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-11-13  3:23 UTC (permalink / raw)
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: thierry.reding, rjui, sbranden, bcm-kernel-feedback-list,
	linux-pwm, linux-arm-kernel, kernel, florian.fainelli,
	linux-rpi-kernel, shawnguo, s.hauer, festevam, linux-imx,
	matthias.bgg, angelogioacchino.delregno, linux-mediatek,
	orsonzhai, baolin.wang, zhang.lyra, krzysztof.kozlowski,
	alim.akhtar, linux-samsung-soc, bleung, groeck, chrome-platform

Hello:

This patch was applied to chrome-platform/linux.git (for-kernelci)
by Thierry Reding <thierry.reding@gmail.com>:

On Fri, 29 Sep 2023 18:19:07 +0200 you wrote:
> Hello,
> 
> this is a set of patches I based my efforts for closing a race condition
> in the pwm core on. I thought I already sent them out, but it seems I
> didn't. So here they come!
> 
> Best regards
> Uwe
> 
> [...]

Here is the summary with links:
  - [11/11] pwm: cros-ec: Simplify using devm_pwmchip_add() and dev_err_probe()
    https://git.kernel.org/chrome-platform/c/896c450960f5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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

* Re: [PATCH 00/11] pwm: Some random cleanups
  2023-09-29 16:19 [PATCH 00/11] pwm: Some random cleanups Uwe Kleine-König
  2023-09-29 16:19 ` [PATCH 05/11] pwm: mtk-disp: Simplify using devm_pwmchip_add() Uwe Kleine-König
  2023-11-13  3:23 ` [PATCH 00/11] pwm: Some random cleanups patchwork-bot+chrome-platform
@ 2023-11-13  3:42 ` patchwork-bot+chrome-platform
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-11-13  3:42 UTC (permalink / raw)
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: thierry.reding, rjui, sbranden, bcm-kernel-feedback-list,
	linux-pwm, linux-arm-kernel, kernel, florian.fainelli,
	linux-rpi-kernel, shawnguo, s.hauer, festevam, linux-imx,
	matthias.bgg, angelogioacchino.delregno, linux-mediatek,
	orsonzhai, baolin.wang, zhang.lyra, krzysztof.kozlowski,
	alim.akhtar, linux-samsung-soc, bleung, groeck, chrome-platform

Hello:

This patch was applied to chrome-platform/linux.git (for-next)
by Thierry Reding <thierry.reding@gmail.com>:

On Fri, 29 Sep 2023 18:19:07 +0200 you wrote:
> Hello,
> 
> this is a set of patches I based my efforts for closing a race condition
> in the pwm core on. I thought I already sent them out, but it seems I
> didn't. So here they come!
> 
> Best regards
> Uwe
> 
> [...]

Here is the summary with links:
  - [11/11] pwm: cros-ec: Simplify using devm_pwmchip_add() and dev_err_probe()
    https://git.kernel.org/chrome-platform/c/896c450960f5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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

end of thread, other threads:[~2023-11-13  3:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-29 16:19 [PATCH 00/11] pwm: Some random cleanups Uwe Kleine-König
2023-09-29 16:19 ` [PATCH 05/11] pwm: mtk-disp: Simplify using devm_pwmchip_add() Uwe Kleine-König
2023-10-02 10:44   ` AngeloGioacchino Del Regno
2023-11-13  3:23 ` [PATCH 00/11] pwm: Some random cleanups patchwork-bot+chrome-platform
2023-11-13  3:42 ` patchwork-bot+chrome-platform

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox