All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: Another set of platform remove conversions
@ 2023-07-07  7:28 Uwe Kleine-König
  2023-07-07  7:28 ` [PATCH 1/2] ASoC: amd: ps-sdw-dma: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-07-07  7:28 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Jaroslav Kysela, Takashi Iwai, Vijendar Mukunda, alsa-devel,
	kernel, Walker Chen

Hello,

two more drivers were added during the current merge window that
are users of the original .remove callback that I plan to get rid of.
Convert them to .remove_new.

Best regards
Uwe

Uwe Kleine-König (2):
  ASoC: amd: ps-sdw-dma: Convert to platform remove callback returning
    void
  ASoC: starfive: jh7110_tdm: Convert to platform remove callback
    returning void

 sound/soc/amd/ps/ps-sdw-dma.c   | 5 ++---
 sound/soc/starfive/jh7110_tdm.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)


base-commit: 5133c9e51de41bfa902153888e11add3342ede18
-- 
2.39.2


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

* [PATCH 1/2] ASoC: amd: ps-sdw-dma: Convert to platform remove callback returning void
  2023-07-07  7:28 [PATCH 0/2] ASoC: Another set of platform remove conversions Uwe Kleine-König
@ 2023-07-07  7:28 ` Uwe Kleine-König
  2023-07-07  7:28 ` [PATCH 2/2] ASoC: starfive: jh7110_tdm: " Uwe Kleine-König
  2023-07-12 11:47 ` [PATCH 0/2] ASoC: Another set of platform remove conversions Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-07-07  7:28 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Jaroslav Kysela, Takashi Iwai, Vijendar Mukunda, alsa-devel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 sound/soc/amd/ps/ps-sdw-dma.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c
index ade130a8062a..29ceb52061af 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -476,10 +476,9 @@ static int acp63_sdw_platform_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int acp63_sdw_platform_remove(struct platform_device *pdev)
+static void acp63_sdw_platform_remove(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
-	return 0;
 }
 
 static int acp_restore_sdw_dma_config(struct sdw_dma_dev_data *sdw_data)
@@ -540,7 +539,7 @@ static const struct dev_pm_ops acp63_pm_ops = {
 
 static struct platform_driver acp63_sdw_dma_driver = {
 	.probe = acp63_sdw_platform_probe,
-	.remove = acp63_sdw_platform_remove,
+	.remove_new = acp63_sdw_platform_remove,
 	.driver = {
 		.name = "amd_ps_sdw_dma",
 		.pm = &acp63_pm_ops,
-- 
2.39.2


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

* [PATCH 2/2] ASoC: starfive: jh7110_tdm: Convert to platform remove callback returning void
  2023-07-07  7:28 [PATCH 0/2] ASoC: Another set of platform remove conversions Uwe Kleine-König
  2023-07-07  7:28 ` [PATCH 1/2] ASoC: amd: ps-sdw-dma: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-07-07  7:28 ` Uwe Kleine-König
  2023-07-12 11:47 ` [PATCH 0/2] ASoC: Another set of platform remove conversions Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2023-07-07  7:28 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Walker Chen, Jaroslav Kysela, Takashi Iwai, alsa-devel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 sound/soc/starfive/jh7110_tdm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c
index 5f5a6ca7dbda..705f1420097b 100644
--- a/sound/soc/starfive/jh7110_tdm.c
+++ b/sound/soc/starfive/jh7110_tdm.c
@@ -634,10 +634,9 @@ static int jh7110_tdm_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int jh7110_tdm_dev_remove(struct platform_device *pdev)
+static void jh7110_tdm_dev_remove(struct platform_device *pdev)
 {
 	pm_runtime_disable(&pdev->dev);
-	return 0;
 }
 
 static const struct of_device_id jh7110_tdm_of_match[] = {
@@ -661,7 +660,7 @@ static struct platform_driver jh7110_tdm_driver = {
 		.pm = pm_ptr(&jh7110_tdm_pm_ops),
 	},
 	.probe = jh7110_tdm_probe,
-	.remove = jh7110_tdm_dev_remove,
+	.remove_new = jh7110_tdm_dev_remove,
 };
 module_platform_driver(jh7110_tdm_driver);
 
-- 
2.39.2


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

* Re: [PATCH 0/2] ASoC: Another set of platform remove conversions
  2023-07-07  7:28 [PATCH 0/2] ASoC: Another set of platform remove conversions Uwe Kleine-König
  2023-07-07  7:28 ` [PATCH 1/2] ASoC: amd: ps-sdw-dma: Convert to platform remove callback returning void Uwe Kleine-König
  2023-07-07  7:28 ` [PATCH 2/2] ASoC: starfive: jh7110_tdm: " Uwe Kleine-König
@ 2023-07-12 11:47 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-07-12 11:47 UTC (permalink / raw)
  To: Liam Girdwood, Uwe Kleine-König
  Cc: Jaroslav Kysela, Takashi Iwai, Vijendar Mukunda, alsa-devel,
	kernel, Walker Chen

On Fri, 07 Jul 2023 09:28:28 +0200, Uwe Kleine-König wrote:
> two more drivers were added during the current merge window that
> are users of the original .remove callback that I plan to get rid of.
> Convert them to .remove_new.
> 
> Best regards
> Uwe
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: amd: ps-sdw-dma: Convert to platform remove callback returning void
      commit: acb5c0b14b761df258e480cc721676073f6d953a
[2/2] ASoC: starfive: jh7110_tdm: Convert to platform remove callback returning void
      commit: 50a91c513fb7da5c48b1cffdaa30c1f98f403801

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2023-07-12 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07  7:28 [PATCH 0/2] ASoC: Another set of platform remove conversions Uwe Kleine-König
2023-07-07  7:28 ` [PATCH 1/2] ASoC: amd: ps-sdw-dma: Convert to platform remove callback returning void Uwe Kleine-König
2023-07-07  7:28 ` [PATCH 2/2] ASoC: starfive: jh7110_tdm: " Uwe Kleine-König
2023-07-12 11:47 ` [PATCH 0/2] ASoC: Another set of platform remove conversions Mark Brown

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.