[PATCH 0/7] ASoc: Another series to convert to struct platform_driver:remove_new()
Hello,
this is another series to convert ASoC drivers to use struct platform_driver:remove_new(). The rockchip one was already send before but with a wrong subject prefix, the cs42l43 driver is newer than the last series. The remaining five patches are for driver combos that my coccinelle patch failed to detect before.
Best regards Uwe
Uwe Kleine-König (7): ASoC: rockchip: i2s_tdm: Convert to platform remove callback returning void ASoC: cs42l43: Convert to platform remove callback returning void ASoC: starfive/jh7110-pwmdac: Convert to platform remove callback returning void ASoC: simple-card-utils: Make simple_util_remove() return void ASoC: meson: Make meson_card_remove() return void ASoC: qcom: lpass: Make asoc_qcom_lpass_cpu_platform_remove() return void ASoC: uniphier: Make uniphier_aio_remove() return void
include/sound/simple_card_utils.h | 2 +- sound/soc/codecs/cs42l43.c | 6 ++---- sound/soc/generic/audio-graph-card.c | 2 +- sound/soc/generic/audio-graph-card2-custom-sample.c | 2 +- sound/soc/generic/audio-graph-card2.c | 2 +- sound/soc/generic/simple-card-utils.c | 4 +--- sound/soc/generic/simple-card.c | 2 +- sound/soc/meson/axg-card.c | 2 +- sound/soc/meson/gx-card.c | 2 +- sound/soc/meson/meson-card-utils.c | 4 +--- sound/soc/meson/meson-card.h | 2 +- sound/soc/qcom/lpass-apq8016.c | 2 +- sound/soc/qcom/lpass-cpu.c | 5 +---- sound/soc/qcom/lpass-ipq806x.c | 2 +- sound/soc/qcom/lpass-sc7180.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- sound/soc/qcom/lpass.h | 2 +- sound/soc/rockchip/rockchip_i2s_tdm.c | 6 ++---- sound/soc/starfive/jh7110_pwmdac.c | 5 ++--- sound/soc/tegra/tegra_audio_graph_card.c | 2 +- sound/soc/uniphier/aio-cpu.c | 4 +--- sound/soc/uniphier/aio-ld11.c | 2 +- sound/soc/uniphier/aio-pxs2.c | 2 +- sound/soc/uniphier/aio.h | 2 +- 24 files changed, 27 insertions(+), 41 deletions(-)
base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b
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 (mostly) ignored 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.
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/rockchip/rockchip_i2s_tdm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index 7e996550d1df..5c51dbef6e86 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -1714,14 +1714,12 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) return ret; }
-static int rockchip_i2s_tdm_remove(struct platform_device *pdev) +static void rockchip_i2s_tdm_remove(struct platform_device *pdev) { if (!pm_runtime_status_suspended(&pdev->dev)) i2s_tdm_runtime_suspend(&pdev->dev);
pm_runtime_disable(&pdev->dev); - - return 0; }
static int __maybe_unused rockchip_i2s_tdm_suspend(struct device *dev) @@ -1756,7 +1754,7 @@ static const struct dev_pm_ops rockchip_i2s_tdm_pm_ops = {
static struct platform_driver rockchip_i2s_tdm_driver = { .probe = rockchip_i2s_tdm_probe, - .remove = rockchip_i2s_tdm_remove, + .remove_new = rockchip_i2s_tdm_remove, .driver = { .name = DRV_NAME, .of_match_table = of_match_ptr(rockchip_i2s_tdm_match),
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() will be 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/codecs/cs42l43.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index 532183095818..d62c9f26c632 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -2232,13 +2232,11 @@ static int cs42l43_codec_probe(struct platform_device *pdev) return ret; }
-static int cs42l43_codec_remove(struct platform_device *pdev) +static void cs42l43_codec_remove(struct platform_device *pdev) { struct cs42l43_codec *priv = platform_get_drvdata(pdev);
clk_put(priv->mclk); - - return 0; }
static int cs42l43_codec_runtime_resume(struct device *dev) @@ -2269,7 +2267,7 @@ static struct platform_driver cs42l43_codec_driver = { },
.probe = cs42l43_codec_probe, - .remove = cs42l43_codec_remove, + .remove_new = cs42l43_codec_remove, .id_table = cs42l43_codec_id_table, }; module_platform_driver(cs42l43_codec_driver);
On Sat, Oct 14, 2023 at 12:19:48AM +0200, Uwe Kleine-König wrote:
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() will be 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
Acked-by: Charles Keepax ckeepax@opensource.cirrus.com
Thanks, Charles
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() will be 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_pwmdac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/starfive/jh7110_pwmdac.c b/sound/soc/starfive/jh7110_pwmdac.c index 65ee3e339494..4a4dd431b82b 100644 --- a/sound/soc/starfive/jh7110_pwmdac.c +++ b/sound/soc/starfive/jh7110_pwmdac.c @@ -498,10 +498,9 @@ static int jh7110_pwmdac_probe(struct platform_device *pdev) return ret; }
-static int jh7110_pwmdac_remove(struct platform_device *pdev) +static void jh7110_pwmdac_remove(struct platform_device *pdev) { pm_runtime_disable(&pdev->dev); - return 0; }
static const struct of_device_id jh7110_pwmdac_of_match[] = { @@ -517,7 +516,7 @@ static struct platform_driver jh7110_pwmdac_driver = { .pm = pm_ptr(&jh7110_pwmdac_pm_ops), }, .probe = jh7110_pwmdac_probe, - .remove = jh7110_pwmdac_remove, + .remove_new = jh7110_pwmdac_remove, }; module_platform_driver(jh7110_pwmdac_driver);
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 (mostly) ignored 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.
simple_util_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new().
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de --- include/sound/simple_card_utils.h | 2 +- sound/soc/generic/audio-graph-card.c | 2 +- sound/soc/generic/audio-graph-card2-custom-sample.c | 2 +- sound/soc/generic/audio-graph-card2.c | 2 +- sound/soc/generic/simple-card-utils.c | 4 +--- sound/soc/generic/simple-card.c | 2 +- sound/soc/tegra/tegra_audio_graph_card.c | 2 +- 7 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 18e7a0b89395..e5da10b4c43b 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -188,7 +188,7 @@ int simple_util_init_aux_jacks(struct simple_util_priv *priv, char *prefix); int simple_util_init_priv(struct simple_util_priv *priv, struct link_info *li); -int simple_util_remove(struct platform_device *pdev); +void simple_util_remove(struct platform_device *pdev);
int graph_util_card_probe(struct snd_soc_card *card); int graph_util_is_ports0(struct device_node *port); diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 704f32bda24d..76a9f1e8cdd5 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -644,7 +644,7 @@ static struct platform_driver graph_card = { .of_match_table = graph_of_match, }, .probe = graph_probe, - .remove = simple_util_remove, + .remove_new = simple_util_remove, }; module_platform_driver(graph_card);
diff --git a/sound/soc/generic/audio-graph-card2-custom-sample.c b/sound/soc/generic/audio-graph-card2-custom-sample.c index 4dc65e249ecb..1b6ccd2de964 100644 --- a/sound/soc/generic/audio-graph-card2-custom-sample.c +++ b/sound/soc/generic/audio-graph-card2-custom-sample.c @@ -176,7 +176,7 @@ static struct platform_driver custom_card = { .of_match_table = custom_of_match, }, .probe = custom_probe, - .remove = simple_util_remove, + .remove_new = simple_util_remove, }; module_platform_driver(custom_card);
diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 1344e1adfc67..7146611df730 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -1224,7 +1224,7 @@ static struct platform_driver graph_card = { .of_match_table = graph_of_match, }, .probe = graph_probe, - .remove = simple_util_remove, + .remove_new = simple_util_remove, }; module_platform_driver(graph_card);
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 11f186ea662a..cfa70a56ff0f 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -958,13 +958,11 @@ int simple_util_init_priv(struct simple_util_priv *priv, } EXPORT_SYMBOL_GPL(simple_util_init_priv);
-int simple_util_remove(struct platform_device *pdev) +void simple_util_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev);
simple_util_clean_reference(card); - - return 0; } EXPORT_SYMBOL_GPL(simple_util_remove);
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 048357ae7ae6..9c79ff6a568f 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -827,7 +827,7 @@ static struct platform_driver simple_card = { .of_match_table = simple_of_match, }, .probe = simple_probe, - .remove = simple_util_remove, + .remove_new = simple_util_remove, };
module_platform_driver(simple_card); diff --git a/sound/soc/tegra/tegra_audio_graph_card.c b/sound/soc/tegra/tegra_audio_graph_card.c index 8b48813c2c59..feba9d42bbc5 100644 --- a/sound/soc/tegra/tegra_audio_graph_card.c +++ b/sound/soc/tegra/tegra_audio_graph_card.c @@ -248,7 +248,7 @@ static struct platform_driver tegra_audio_graph_card = { .of_match_table = graph_of_tegra_match, }, .probe = tegra_audio_graph_probe, - .remove = simple_util_remove, + .remove_new = simple_util_remove, }; module_platform_driver(tegra_audio_graph_card);
On Sat, 14 Oct 2023 00:19:50 +0200 Uwe Kleine-König u.kleine-koenig@pengutronix.de wrote:
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 (mostly) ignored 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.
simple_util_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new().
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de
Reviewed-by: Herve Codina herve.codina@bootlin.com
Best regards, Hervé
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 (mostly) ignored 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.
meson_card_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new().
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de --- sound/soc/meson/axg-card.c | 2 +- sound/soc/meson/gx-card.c | 2 +- sound/soc/meson/meson-card-utils.c | 4 +--- sound/soc/meson/meson-card.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c index 18b16274449e..3180aa4d3a15 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -360,7 +360,7 @@ MODULE_DEVICE_TABLE(of, axg_card_of_match);
static struct platform_driver axg_card_pdrv = { .probe = meson_card_probe, - .remove = meson_card_remove, + .remove_new = meson_card_remove, .driver = { .name = "axg-sound-card", .of_match_table = axg_card_of_match, diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c index 01beac1d927f..f1539e542638 100644 --- a/sound/soc/meson/gx-card.c +++ b/sound/soc/meson/gx-card.c @@ -130,7 +130,7 @@ MODULE_DEVICE_TABLE(of, gx_card_of_match);
static struct platform_driver gx_card_pdrv = { .probe = meson_card_probe, - .remove = meson_card_remove, + .remove_new = meson_card_remove, .driver = { .name = "gx-sound-card", .of_match_table = gx_card_of_match, diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c index c81099218597..ed6c7e2f609c 100644 --- a/sound/soc/meson/meson-card-utils.c +++ b/sound/soc/meson/meson-card-utils.c @@ -327,13 +327,11 @@ int meson_card_probe(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(meson_card_probe);
-int meson_card_remove(struct platform_device *pdev) +void meson_card_remove(struct platform_device *pdev) { struct meson_card *priv = platform_get_drvdata(pdev);
meson_card_clean_references(priv); - - return 0; } EXPORT_SYMBOL_GPL(meson_card_remove);
diff --git a/sound/soc/meson/meson-card.h b/sound/soc/meson/meson-card.h index a5374324a189..a0d693e4f460 100644 --- a/sound/soc/meson/meson-card.h +++ b/sound/soc/meson/meson-card.h @@ -49,6 +49,6 @@ int meson_card_set_fe_link(struct snd_soc_card *card, bool is_playback);
int meson_card_probe(struct platform_device *pdev); -int meson_card_remove(struct platform_device *pdev); +void meson_card_remove(struct platform_device *pdev);
#endif /* _MESON_SND_CARD_H */
On Sat 14 Oct 2023 at 00:19, Uwe Kleine-König u.kleine-koenig@pengutronix.de wrote:
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 (mostly) ignored 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.
meson_card_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new().
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de
Reviewed-by: Jerome Brunet jbrunet@baylibre.com
sound/soc/meson/axg-card.c | 2 +- sound/soc/meson/gx-card.c | 2 +- sound/soc/meson/meson-card-utils.c | 4 +--- sound/soc/meson/meson-card.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c index 18b16274449e..3180aa4d3a15 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -360,7 +360,7 @@ MODULE_DEVICE_TABLE(of, axg_card_of_match);
static struct platform_driver axg_card_pdrv = { .probe = meson_card_probe,
- .remove = meson_card_remove,
- .remove_new = meson_card_remove, .driver = { .name = "axg-sound-card", .of_match_table = axg_card_of_match,
diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c index 01beac1d927f..f1539e542638 100644 --- a/sound/soc/meson/gx-card.c +++ b/sound/soc/meson/gx-card.c @@ -130,7 +130,7 @@ MODULE_DEVICE_TABLE(of, gx_card_of_match);
static struct platform_driver gx_card_pdrv = { .probe = meson_card_probe,
- .remove = meson_card_remove,
- .remove_new = meson_card_remove, .driver = { .name = "gx-sound-card", .of_match_table = gx_card_of_match,
diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c index c81099218597..ed6c7e2f609c 100644 --- a/sound/soc/meson/meson-card-utils.c +++ b/sound/soc/meson/meson-card-utils.c @@ -327,13 +327,11 @@ int meson_card_probe(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(meson_card_probe);
-int meson_card_remove(struct platform_device *pdev) +void meson_card_remove(struct platform_device *pdev) { struct meson_card *priv = platform_get_drvdata(pdev);
meson_card_clean_references(priv);
- return 0;
} EXPORT_SYMBOL_GPL(meson_card_remove);
diff --git a/sound/soc/meson/meson-card.h b/sound/soc/meson/meson-card.h index a5374324a189..a0d693e4f460 100644 --- a/sound/soc/meson/meson-card.h +++ b/sound/soc/meson/meson-card.h @@ -49,6 +49,6 @@ int meson_card_set_fe_link(struct snd_soc_card *card, bool is_playback);
int meson_card_probe(struct platform_device *pdev); -int meson_card_remove(struct platform_device *pdev); +void meson_card_remove(struct platform_device *pdev);
#endif /* _MESON_SND_CARD_H */
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 (mostly) ignored 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.
asoc_qcom_lpass_cpu_platform_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new().
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de --- sound/soc/qcom/lpass-apq8016.c | 2 +- sound/soc/qcom/lpass-cpu.c | 5 +---- sound/soc/qcom/lpass-ipq806x.c | 2 +- sound/soc/qcom/lpass-sc7180.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- sound/soc/qcom/lpass.h | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c index 8ce75b442b64..8e58e814a95f 100644 --- a/sound/soc/qcom/lpass-apq8016.c +++ b/sound/soc/qcom/lpass-apq8016.c @@ -300,7 +300,7 @@ static struct platform_driver apq8016_lpass_cpu_platform_driver = { .of_match_table = of_match_ptr(apq8016_lpass_cpu_device_id), }, .probe = asoc_qcom_lpass_cpu_platform_probe, - .remove = asoc_qcom_lpass_cpu_platform_remove, + .remove_new = asoc_qcom_lpass_cpu_platform_remove, }; module_platform_driver(apq8016_lpass_cpu_platform_driver);
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index ba8fa7919884..88b80ed45c66 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -1274,15 +1274,12 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_probe);
-int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev) +void asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev) { struct lpass_data *drvdata = platform_get_drvdata(pdev);
if (drvdata->variant->exit) drvdata->variant->exit(pdev); - - - return 0; } EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove);
diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c index bbe9f11d7780..e0e9ad35821c 100644 --- a/sound/soc/qcom/lpass-ipq806x.c +++ b/sound/soc/qcom/lpass-ipq806x.c @@ -172,7 +172,7 @@ static struct platform_driver ipq806x_lpass_cpu_platform_driver = { .of_match_table = of_match_ptr(ipq806x_lpass_cpu_device_id), }, .probe = asoc_qcom_lpass_cpu_platform_probe, - .remove = asoc_qcom_lpass_cpu_platform_remove, + .remove_new = asoc_qcom_lpass_cpu_platform_remove, }; module_platform_driver(ipq806x_lpass_cpu_platform_driver);
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c index 1b0c04b210ce..22063b834554 100644 --- a/sound/soc/qcom/lpass-sc7180.c +++ b/sound/soc/qcom/lpass-sc7180.c @@ -315,7 +315,7 @@ static struct platform_driver sc7180_lpass_cpu_platform_driver = { .pm = &sc7180_lpass_pm_ops, }, .probe = asoc_qcom_lpass_cpu_platform_probe, - .remove = asoc_qcom_lpass_cpu_platform_remove, + .remove_new = asoc_qcom_lpass_cpu_platform_remove, .shutdown = asoc_qcom_lpass_cpu_platform_shutdown, };
diff --git a/sound/soc/qcom/lpass-sc7280.c b/sound/soc/qcom/lpass-sc7280.c index 7cd3e291382a..47c622327a8d 100644 --- a/sound/soc/qcom/lpass-sc7280.c +++ b/sound/soc/qcom/lpass-sc7280.c @@ -445,7 +445,7 @@ static struct platform_driver sc7280_lpass_cpu_platform_driver = { .pm = &sc7280_lpass_pm_ops, }, .probe = asoc_qcom_lpass_cpu_platform_probe, - .remove = asoc_qcom_lpass_cpu_platform_remove, + .remove_new = asoc_qcom_lpass_cpu_platform_remove, .shutdown = asoc_qcom_lpass_cpu_platform_shutdown, };
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h index aab60540563a..2f222bd4ffcc 100644 --- a/sound/soc/qcom/lpass.h +++ b/sound/soc/qcom/lpass.h @@ -399,7 +399,7 @@ struct lpass_pcm_data {
/* register the platform driver from the CPU DAI driver */ int asoc_qcom_lpass_platform_register(struct platform_device *); -int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev); +void asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev); void asoc_qcom_lpass_cpu_platform_shutdown(struct platform_device *pdev); int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev); extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops;
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 (mostly) ignored 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.
uniphier_aio_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new().
Signed-off-by: Uwe Kleine-König u.kleine-koenig@pengutronix.de --- sound/soc/uniphier/aio-cpu.c | 4 +--- sound/soc/uniphier/aio-ld11.c | 2 +- sound/soc/uniphier/aio-pxs2.c | 2 +- sound/soc/uniphier/aio.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/uniphier/aio-cpu.c b/sound/soc/uniphier/aio-cpu.c index 7c5188477b7c..470f129166a4 100644 --- a/sound/soc/uniphier/aio-cpu.c +++ b/sound/soc/uniphier/aio-cpu.c @@ -822,14 +822,12 @@ int uniphier_aio_probe(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(uniphier_aio_probe);
-int uniphier_aio_remove(struct platform_device *pdev) +void uniphier_aio_remove(struct platform_device *pdev) { struct uniphier_aio_chip *chip = platform_get_drvdata(pdev);
reset_control_assert(chip->rst); clk_disable_unprepare(chip->clk); - - return 0; } EXPORT_SYMBOL_GPL(uniphier_aio_remove);
diff --git a/sound/soc/uniphier/aio-ld11.c b/sound/soc/uniphier/aio-ld11.c index 15dbded63804..01cc3b961999 100644 --- a/sound/soc/uniphier/aio-ld11.c +++ b/sound/soc/uniphier/aio-ld11.c @@ -347,7 +347,7 @@ static struct platform_driver uniphier_aio_driver = { .of_match_table = of_match_ptr(uniphier_aio_of_match), }, .probe = uniphier_aio_probe, - .remove = uniphier_aio_remove, + .remove_new = uniphier_aio_remove, }; module_platform_driver(uniphier_aio_driver);
diff --git a/sound/soc/uniphier/aio-pxs2.c b/sound/soc/uniphier/aio-pxs2.c index 305cb2a1253d..fba13a212bdb 100644 --- a/sound/soc/uniphier/aio-pxs2.c +++ b/sound/soc/uniphier/aio-pxs2.c @@ -256,7 +256,7 @@ static struct platform_driver uniphier_aio_driver = { .of_match_table = of_match_ptr(uniphier_aio_of_match), }, .probe = uniphier_aio_probe, - .remove = uniphier_aio_remove, + .remove_new = uniphier_aio_remove, }; module_platform_driver(uniphier_aio_driver);
diff --git a/sound/soc/uniphier/aio.h b/sound/soc/uniphier/aio.h index 09ccb47337fd..d9fd61dd976f 100644 --- a/sound/soc/uniphier/aio.h +++ b/sound/soc/uniphier/aio.h @@ -307,7 +307,7 @@ int uniphier_aiodma_soc_register_platform(struct platform_device *pdev); extern const struct snd_compress_ops uniphier_aio_compress_ops;
int uniphier_aio_probe(struct platform_device *pdev); -int uniphier_aio_remove(struct platform_device *pdev); +void uniphier_aio_remove(struct platform_device *pdev); extern const struct snd_soc_dai_ops uniphier_aio_i2s_ld11_ops; extern const struct snd_soc_dai_ops uniphier_aio_i2s_pxs2_ops; extern const struct snd_soc_dai_ops uniphier_aio_spdif_ld11_ops;
On Sat, 14 Oct 2023 00:19:46 +0200, Uwe Kleine-König wrote:
this is another series to convert ASoC drivers to use struct platform_driver:remove_new(). The rockchip one was already send before but with a wrong subject prefix, the cs42l43 driver is newer than the last series. The remaining five patches are for driver combos that my coccinelle patch failed to detect before.
Best regards Uwe
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/7] ASoC: rockchip: i2s_tdm: Convert to platform remove callback returning void commit: 46dd58bef32dea55b663141858ca1659a85a1505 [2/7] ASoC: cs42l43: Convert to platform remove callback returning void commit: 491a1132f5cb77c8f1abb44d9928f8f184fc3df7 [3/7] ASoC: starfive/jh7110-pwmdac: Convert to platform remove callback returning void commit: 6b02f5a6f1853c6d5f73b000afbc177f5ee59d9e [4/7] ASoC: simple-card-utils: Make simple_util_remove() return void commit: 393df6f321c757d164fa412b7eae527a8e2acb75 [5/7] ASoC: meson: Make meson_card_remove() return void commit: 8210f496c3e12410fa240c7fbc63f71ef78e253f [6/7] ASoC: qcom: lpass: Make asoc_qcom_lpass_cpu_platform_remove() return void commit: d0cc676c426d1958989fac2a0d45179fb9992f0a [7/7] ASoC: uniphier: Make uniphier_aio_remove() return void commit: 7242265213893e053457240f833d06ecd75b7ab3
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
participants (5)
-
Charles Keepax
-
Herve Codina
-
Jerome Brunet
-
Mark Brown
-
Uwe Kleine-König