* [PATCH 0/6] ASoC: use devm_snd_soc_register_card()
@ 2024-01-10 1:27 Kuninori Morimoto
2024-01-10 1:27 ` [PATCH 1/6] ASoC: ti: " Kuninori Morimoto
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-10 1:27 UTC (permalink / raw)
To: Alexandre Belloni, Chen-Yu Tsai, Claudiu Beznea, Jarkko Nikula,
Jaroslav Kysela, Jernej Skrabec, Liam Girdwood, Mark Brown,
Nicolas Ferre, Peter Rosin, Peter Ujfalusi, Samuel Holland,
Takashi Iwai
Cc: alsa-devel, linux-sound
Hi Mark
We can use devm_snd_soc_register_card()
instead of snd_soc_register_card(), and is possible
to ignore snd_soc_unregister_card().
Kuninori Morimoto (6):
ASoC: ti: use devm_snd_soc_register_card()
ASoC: fsl: use devm_snd_soc_register_card()
ASoC: atmel: use devm_snd_soc_register_card()
ASoC: sunxi: use devm_snd_soc_register_card()
ASoC: ux500: use devm_snd_soc_register_card()
ASoC: cirrus: use devm_snd_soc_register_card()
sound/soc/atmel/atmel_wm8904.c | 4 +---
sound/soc/atmel/mikroe-proto.c | 8 +-------
sound/soc/atmel/sam9g20_wm8731.c | 5 +----
sound/soc/atmel/tse850-pcm5142.c | 3 +--
sound/soc/cirrus/edb93xx.c | 5 +----
sound/soc/fsl/eukrea-tlv320.c | 8 +-------
sound/soc/fsl/p1022_ds.c | 3 +--
sound/soc/fsl/p1022_rdk.c | 3 +--
sound/soc/fsl/pcm030-audio-fabric.c | 3 +--
sound/soc/sunxi/sun4i-codec.c | 3 +--
sound/soc/ti/ams-delta.c | 7 +------
sound/soc/ti/omap-hdmi.c | 10 +---------
sound/soc/ux500/mop500.c | 3 +--
13 files changed, 13 insertions(+), 52 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/6] ASoC: ti: use devm_snd_soc_register_card()
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
@ 2024-01-10 1:27 ` Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 2/6] ASoC: fsl: " Kuninori Morimoto
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-10 1:27 UTC (permalink / raw)
To: Jarkko Nikula, Jaroslav Kysela, Liam Girdwood, Mark Brown,
Peter Ujfalusi, Takashi Iwai
Cc: alsa-devel, linux-sound
Let's use devm_snd_soc_register_card() instead of snd_soc_register_card()
and ignore snd_soc_unregister_card()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/ti/ams-delta.c | 7 +------
sound/soc/ti/omap-hdmi.c | 10 +---------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/sound/soc/ti/ams-delta.c b/sound/soc/ti/ams-delta.c
index 76bda188e992..509a13cc265b 100644
--- a/sound/soc/ti/ams-delta.c
+++ b/sound/soc/ti/ams-delta.c
@@ -569,7 +569,7 @@ static int ams_delta_probe(struct platform_device *pdev)
if (IS_ERR(handsfree_mute))
return PTR_ERR(handsfree_mute);
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
card->dev = NULL;
@@ -580,12 +580,7 @@ static int ams_delta_probe(struct platform_device *pdev)
static void ams_delta_remove(struct platform_device *pdev)
{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
-
tty_unregister_ldisc(&cx81801_ops);
-
- snd_soc_unregister_card(card);
- card->dev = NULL;
}
#define DRV_NAME "ams-delta-audio"
diff --git a/sound/soc/ti/omap-hdmi.c b/sound/soc/ti/omap-hdmi.c
index 29bff9e6337b..4513b527ab97 100644
--- a/sound/soc/ti/omap-hdmi.c
+++ b/sound/soc/ti/omap-hdmi.c
@@ -379,7 +379,7 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
card->num_links = 1;
card->dev = dev;
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(dev, card);
if (ret) {
dev_err(dev, "snd_soc_register_card failed (%d)\n", ret);
return ret;
@@ -393,19 +393,11 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
return 0;
}
-static void omap_hdmi_audio_remove(struct platform_device *pdev)
-{
- struct hdmi_audio_data *ad = platform_get_drvdata(pdev);
-
- snd_soc_unregister_card(ad->card);
-}
-
static struct platform_driver hdmi_audio_driver = {
.driver = {
.name = DRV_NAME,
},
.probe = omap_hdmi_audio_probe,
- .remove_new = omap_hdmi_audio_remove,
};
module_platform_driver(hdmi_audio_driver);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/6] ASoC: fsl: use devm_snd_soc_register_card()
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
2024-01-10 1:27 ` [PATCH 1/6] ASoC: ti: " Kuninori Morimoto
@ 2024-01-10 1:28 ` Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 3/6] ASoC: atmel: " Kuninori Morimoto
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-10 1:28 UTC (permalink / raw)
To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
Cc: alsa-devel, linux-sound
Let's use devm_snd_soc_register_card() instead of snd_soc_register_card()
and ignore snd_soc_unregister_card()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/fsl/eukrea-tlv320.c | 8 +-------
sound/soc/fsl/p1022_ds.c | 3 +--
sound/soc/fsl/p1022_rdk.c | 3 +--
sound/soc/fsl/pcm030-audio-fabric.c | 3 +--
4 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
index 63f1f05da947..6be074ea0b3f 100644
--- a/sound/soc/fsl/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -196,7 +196,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)
}
}
- ret = snd_soc_register_card(&eukrea_tlv320);
+ ret = devm_snd_soc_register_card(&pdev->dev, &eukrea_tlv320);
err:
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
@@ -205,11 +205,6 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)
return ret;
}
-static void eukrea_tlv320_remove(struct platform_device *pdev)
-{
- snd_soc_unregister_card(&eukrea_tlv320);
-}
-
static const struct of_device_id imx_tlv320_dt_ids[] = {
{ .compatible = "eukrea,asoc-tlv320"},
{ /* sentinel */ }
@@ -222,7 +217,6 @@ static struct platform_driver eukrea_tlv320_driver = {
.of_match_table = imx_tlv320_dt_ids,
},
.probe = eukrea_tlv320_probe,
- .remove_new = eukrea_tlv320_remove,
};
module_platform_driver(eukrea_tlv320_driver);
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 6f5eecf6d88c..da247dc705e0 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -374,7 +374,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
mdata->card.dai_link = mdata->dai;
/* Register with ASoC */
- ret = snd_soc_register_card(&mdata->card);
+ ret = devm_snd_soc_register_card(&pdev->dev, &mdata->card);
if (ret) {
dev_err(&pdev->dev, "could not register card\n");
goto error;
@@ -402,7 +402,6 @@ static void p1022_ds_remove(struct platform_device *pdev)
struct machine_data *mdata =
container_of(card, struct machine_data, card);
- snd_soc_unregister_card(card);
kfree(mdata);
}
diff --git a/sound/soc/fsl/p1022_rdk.c b/sound/soc/fsl/p1022_rdk.c
index 18d129c21648..67ae8a335fd1 100644
--- a/sound/soc/fsl/p1022_rdk.c
+++ b/sound/soc/fsl/p1022_rdk.c
@@ -325,7 +325,7 @@ static int p1022_rdk_probe(struct platform_device *pdev)
mdata->card.dai_link = mdata->dai;
/* Register with ASoC */
- ret = snd_soc_register_card(&mdata->card);
+ ret = devm_snd_soc_register_card(&pdev->dev, &mdata->card);
if (ret) {
dev_err(&pdev->dev, "could not register card (ret=%i)\n", ret);
goto error;
@@ -351,7 +351,6 @@ static void p1022_rdk_remove(struct platform_device *pdev)
struct machine_data *mdata =
container_of(card, struct machine_data, card);
- snd_soc_unregister_card(card);
kfree(mdata);
}
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 2bab0fc1de59..edef8ee8d8b0 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -97,7 +97,7 @@ static int pcm030_fabric_probe(struct platform_device *op)
platform_device_put(pdata->codec_device);
}
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(&op->dev, card);
if (ret) {
dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
platform_device_unregister(pdata->codec_device);
@@ -112,7 +112,6 @@ static void pcm030_fabric_remove(struct platform_device *op)
{
struct pcm030_audio_data *pdata = platform_get_drvdata(op);
- snd_soc_unregister_card(pdata->card);
platform_device_unregister(pdata->codec_device);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] ASoC: atmel: use devm_snd_soc_register_card()
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
2024-01-10 1:27 ` [PATCH 1/6] ASoC: ti: " Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 2/6] ASoC: fsl: " Kuninori Morimoto
@ 2024-01-10 1:28 ` Kuninori Morimoto
2024-01-10 9:55 ` Peter Rosin
2024-01-10 1:28 ` [PATCH 4/6] ASoC: sunxi: " Kuninori Morimoto
` (3 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-10 1:28 UTC (permalink / raw)
To: Alexandre Belloni, Claudiu Beznea, Jaroslav Kysela, Liam Girdwood,
Mark Brown, Nicolas Ferre, Peter Rosin, Takashi Iwai
Cc: alsa-devel, linux-sound
Let's use devm_snd_soc_register_card() instead of snd_soc_register_card()
and ignore snd_soc_unregister_card()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/atmel/atmel_wm8904.c | 4 +---
sound/soc/atmel/mikroe-proto.c | 8 +-------
sound/soc/atmel/sam9g20_wm8731.c | 5 +----
sound/soc/atmel/tse850-pcm5142.c | 3 +--
4 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/sound/soc/atmel/atmel_wm8904.c b/sound/soc/atmel/atmel_wm8904.c
index b7f16ea0cdfc..d4339145e6ca 100644
--- a/sound/soc/atmel/atmel_wm8904.c
+++ b/sound/soc/atmel/atmel_wm8904.c
@@ -147,7 +147,7 @@ static int atmel_asoc_wm8904_probe(struct platform_device *pdev)
return ret;
}
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed\n");
goto err_set_audio;
@@ -162,13 +162,11 @@ static int atmel_asoc_wm8904_probe(struct platform_device *pdev)
static void atmel_asoc_wm8904_remove(struct platform_device *pdev)
{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
struct snd_soc_dai_link *dailink = &atmel_asoc_wm8904_dailink;
int id;
id = of_alias_get_id((struct device_node *)dailink->cpus->of_node, "ssc");
- snd_soc_unregister_card(card);
atmel_ssc_put_audio(id);
}
diff --git a/sound/soc/atmel/mikroe-proto.c b/sound/soc/atmel/mikroe-proto.c
index 18a8760443ae..8341a6e06493 100644
--- a/sound/soc/atmel/mikroe-proto.c
+++ b/sound/soc/atmel/mikroe-proto.c
@@ -140,7 +140,7 @@ static int snd_proto_probe(struct platform_device *pdev)
dai->dai_fmt = dai_fmt;
- ret = snd_soc_register_card(&snd_proto);
+ ret = devm_snd_soc_register_card(&pdev->dev, &snd_proto);
if (ret)
dev_err_probe(&pdev->dev, ret,
"snd_soc_register_card() failed\n");
@@ -155,11 +155,6 @@ static int snd_proto_probe(struct platform_device *pdev)
return ret;
}
-static void snd_proto_remove(struct platform_device *pdev)
-{
- snd_soc_unregister_card(&snd_proto);
-}
-
static const struct of_device_id snd_proto_of_match[] = {
{ .compatible = "mikroe,mikroe-proto", },
{},
@@ -172,7 +167,6 @@ static struct platform_driver snd_proto_driver = {
.of_match_table = snd_proto_of_match,
},
.probe = snd_proto_probe,
- .remove_new = snd_proto_remove,
};
module_platform_driver(snd_proto_driver);
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index d3ec9826d505..8046f7a977f6 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -171,7 +171,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
of_node_put(codec_np);
of_node_put(cpu_np);
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
dev_err_probe(&pdev->dev, ret,
"snd_soc_register_card() failed\n");
@@ -187,9 +187,6 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
static void at91sam9g20ek_audio_remove(struct platform_device *pdev)
{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
-
- snd_soc_unregister_card(card);
atmel_ssc_put_audio(0);
}
diff --git a/sound/soc/atmel/tse850-pcm5142.c b/sound/soc/atmel/tse850-pcm5142.c
index 611da23325d3..f280ec597a08 100644
--- a/sound/soc/atmel/tse850-pcm5142.c
+++ b/sound/soc/atmel/tse850-pcm5142.c
@@ -398,7 +398,7 @@ static int tse850_probe(struct platform_device *pdev)
return ret;
}
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(dev, card);
if (ret) {
dev_err(dev, "snd_soc_register_card failed\n");
goto err_disable_ana;
@@ -416,7 +416,6 @@ static void tse850_remove(struct platform_device *pdev)
struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
- snd_soc_unregister_card(card);
regulator_disable(tse850->ana);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/6] ASoC: sunxi: use devm_snd_soc_register_card()
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
` (2 preceding siblings ...)
2024-01-10 1:28 ` [PATCH 3/6] ASoC: atmel: " Kuninori Morimoto
@ 2024-01-10 1:28 ` Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 5/6] ASoC: ux500: " Kuninori Morimoto
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-10 1:28 UTC (permalink / raw)
To: Chen-Yu Tsai, Jaroslav Kysela, Jernej Skrabec, Liam Girdwood,
Mark Brown, Samuel Holland, Takashi Iwai
Cc: alsa-devel, linux-sound
Let's use devm_snd_soc_register_card() instead of snd_soc_register_card()
and ignore snd_soc_unregister_card()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/sunxi/sun4i-codec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
index a2618ed650b0..f278f51ff68f 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -1805,7 +1805,7 @@ static int sun4i_codec_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, scodec);
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
dev_err_probe(&pdev->dev, ret, "Failed to register our card\n");
goto err_assert_reset;
@@ -1826,7 +1826,6 @@ static void sun4i_codec_remove(struct platform_device *pdev)
struct snd_soc_card *card = platform_get_drvdata(pdev);
struct sun4i_codec *scodec = snd_soc_card_get_drvdata(card);
- snd_soc_unregister_card(card);
if (scodec->rst)
reset_control_assert(scodec->rst);
clk_disable_unprepare(scodec->clk_apb);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/6] ASoC: ux500: use devm_snd_soc_register_card()
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
` (3 preceding siblings ...)
2024-01-10 1:28 ` [PATCH 4/6] ASoC: sunxi: " Kuninori Morimoto
@ 2024-01-10 1:28 ` Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 6/6] ASoC: cirrus: " Kuninori Morimoto
2024-01-10 8:33 ` [PATCH 0/6] ASoC: " Takashi Iwai
6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-10 1:28 UTC (permalink / raw)
To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
Cc: alsa-devel, linux-sound
Let's use devm_snd_soc_register_card() instead of snd_soc_register_card()
and ignore snd_soc_unregister_card()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/ux500/mop500.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
index e0ab4534fe3e..1696fa80b11b 100644
--- a/sound/soc/ux500/mop500.c
+++ b/sound/soc/ux500/mop500.c
@@ -126,7 +126,7 @@ static int mop500_probe(struct platform_device *pdev)
__func__, mop500_card.name,
mop500_card.dai_link[0].stream_name);
- ret = snd_soc_register_card(&mop500_card);
+ ret = devm_snd_soc_register_card(&pdev->dev, &mop500_card);
if (ret)
dev_err(&pdev->dev,
"Error: snd_soc_register_card failed (%d)!\n", ret);
@@ -140,7 +140,6 @@ static void mop500_remove(struct platform_device *pdev)
pr_debug("%s: Enter.\n", __func__);
- snd_soc_unregister_card(card);
mop500_ab8500_remove(card);
mop500_of_node_put();
}
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] ASoC: cirrus: use devm_snd_soc_register_card()
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
` (4 preceding siblings ...)
2024-01-10 1:28 ` [PATCH 5/6] ASoC: ux500: " Kuninori Morimoto
@ 2024-01-10 1:28 ` Kuninori Morimoto
2024-01-10 8:33 ` [PATCH 0/6] ASoC: " Takashi Iwai
6 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-10 1:28 UTC (permalink / raw)
To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
Cc: alsa-devel, linux-sound
Let's use devm_snd_soc_register_card() instead of snd_soc_register_card()
and ignore snd_soc_unregister_card()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/cirrus/edb93xx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/sound/soc/cirrus/edb93xx.c b/sound/soc/cirrus/edb93xx.c
index 8bb67d7d2b4b..146ca2468bad 100644
--- a/sound/soc/cirrus/edb93xx.c
+++ b/sound/soc/cirrus/edb93xx.c
@@ -82,7 +82,7 @@ static int edb93xx_probe(struct platform_device *pdev)
card->dev = &pdev->dev;
- ret = snd_soc_register_card(card);
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
@@ -94,9 +94,6 @@ static int edb93xx_probe(struct platform_device *pdev)
static void edb93xx_remove(struct platform_device *pdev)
{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
-
- snd_soc_unregister_card(card);
ep93xx_i2s_release();
}
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] ASoC: use devm_snd_soc_register_card()
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
` (5 preceding siblings ...)
2024-01-10 1:28 ` [PATCH 6/6] ASoC: cirrus: " Kuninori Morimoto
@ 2024-01-10 8:33 ` Takashi Iwai
2024-01-11 0:02 ` Kuninori Morimoto
6 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2024-01-10 8:33 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Alexandre Belloni, Chen-Yu Tsai, Claudiu Beznea, Jarkko Nikula,
Jaroslav Kysela, Jernej Skrabec, Liam Girdwood, Mark Brown,
Nicolas Ferre, Peter Rosin, Peter Ujfalusi, Samuel Holland,
Takashi Iwai, alsa-devel, linux-sound
On Wed, 10 Jan 2024 02:27:39 +0100,
Kuninori Morimoto wrote:
>
>
> Hi Mark
>
> We can use devm_snd_soc_register_card()
> instead of snd_soc_register_card(), and is possible
> to ignore snd_soc_unregister_card().
I haven't looked through all code changes, but in general, be careful
when the driver is releasing something else than the devres-managed
stuff. Namely, the devres stuff is released *after* the call of
remove callback.
For example, in your patch for cirrus driver:
static void edb93xx_remove(struct platform_device *pdev)
{
- struct snd_soc_card *card = platform_get_drvdata(pdev);
-
- snd_soc_unregister_card(card);
ep93xx_i2s_release();
}
This will end up with different call orders of soc-unregister and
ep93xx_i2s_release(). This kind of changes may easily be a hidden
source of UAF.
Takashi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/6] ASoC: atmel: use devm_snd_soc_register_card()
2024-01-10 1:28 ` [PATCH 3/6] ASoC: atmel: " Kuninori Morimoto
@ 2024-01-10 9:55 ` Peter Rosin
0 siblings, 0 replies; 10+ messages in thread
From: Peter Rosin @ 2024-01-10 9:55 UTC (permalink / raw)
To: Kuninori Morimoto, Alexandre Belloni, Claudiu Beznea,
Jaroslav Kysela, Liam Girdwood, Mark Brown, Nicolas Ferre,
Takashi Iwai
Cc: alsa-devel, linux-sound
Hi!
2024-01-10 at 02:28, Kuninori Morimoto wrote:
*snip*
> diff --git a/sound/soc/atmel/tse850-pcm5142.c b/sound/soc/atmel/tse850-pcm5142.c
> index 611da23325d3..f280ec597a08 100644
> --- a/sound/soc/atmel/tse850-pcm5142.c
> +++ b/sound/soc/atmel/tse850-pcm5142.c
> @@ -398,7 +398,7 @@ static int tse850_probe(struct platform_device *pdev)
> return ret;
> }
>
> - ret = snd_soc_register_card(card);
> + ret = devm_snd_soc_register_card(dev, card);
> if (ret) {
> dev_err(dev, "snd_soc_register_card failed\n");
> goto err_disable_ana;
> @@ -416,7 +416,6 @@ static void tse850_remove(struct platform_device *pdev)
> struct snd_soc_card *card = platform_get_drvdata(pdev);
> struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
>
> - snd_soc_unregister_card(card);
> regulator_disable(tse850->ana);
Along the lines of what Takashi hinted at, I'm not comfortable with
disabling the ana regulator early. If you want to proceed with these
changes, then please also change from
tse850->ana = devm_regulator_get(dev, "axentia,ana");
if (IS_ERR(tse850->ana)) {
if (PTR_ERR(tse850->ana) != -EPROBE_DEFER)
dev_err(dev, "failed to get 'ana' regulator\n");
return PTR_ERR(tse850->ana);
}
ret = regulator_enable(tse850->ana);
if (ret < 0) {
dev_err(dev, "failed to enable the 'ana' regulator\n");
return ret;
}
to
tse850->ana = devm_regulator_get_enable(dev, "axentia,ana");
if (IS_ERR(tse850->ana)) {
if (PTR_ERR(tse850->ana) != -EPROBE_DEFER)
dev_err(dev, "failed to get 'ana' regulator\n");
return PTR_ERR(tse850->ana);
}
and zap the explicit regulator_disable() from tse850_remove(), which
of course makes tse850_remove() empty and removable too when combined
with the removal of snd_soc_unregister_card().
Cheers,
Peter
> }
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] ASoC: use devm_snd_soc_register_card()
2024-01-10 8:33 ` [PATCH 0/6] ASoC: " Takashi Iwai
@ 2024-01-11 0:02 ` Kuninori Morimoto
0 siblings, 0 replies; 10+ messages in thread
From: Kuninori Morimoto @ 2024-01-11 0:02 UTC (permalink / raw)
To: Takashi Iwai
Cc: Alexandre Belloni, Chen-Yu Tsai, Claudiu Beznea, Jarkko Nikula,
Jaroslav Kysela, Jernej Skrabec, Liam Girdwood, Mark Brown,
Nicolas Ferre, Peter Rosin, Peter Ujfalusi, Samuel Holland,
Takashi Iwai, alsa-devel, linux-sound
Hi Takashi, Peter
> I haven't looked through all code changes, but in general, be careful
> when the driver is releasing something else than the devres-managed
> stuff. Namely, the devres stuff is released *after* the call of
> remove callback.
Thank you for pointing it. Indeed it should be cared.
I will fix it and do it on simple unregister case only in v2
Thank you for your help !!
Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-01-11 0:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 1:27 [PATCH 0/6] ASoC: use devm_snd_soc_register_card() Kuninori Morimoto
2024-01-10 1:27 ` [PATCH 1/6] ASoC: ti: " Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 2/6] ASoC: fsl: " Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 3/6] ASoC: atmel: " Kuninori Morimoto
2024-01-10 9:55 ` Peter Rosin
2024-01-10 1:28 ` [PATCH 4/6] ASoC: sunxi: " Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 5/6] ASoC: ux500: " Kuninori Morimoto
2024-01-10 1:28 ` [PATCH 6/6] ASoC: cirrus: " Kuninori Morimoto
2024-01-10 8:33 ` [PATCH 0/6] ASoC: " Takashi Iwai
2024-01-11 0:02 ` Kuninori Morimoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox