Message ID | 8734v6geok.wl-kuninori.morimoto.gx@renesas.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | ASoC: use devm_snd_soc_register_card() | expand |
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 > } >
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); }
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(-)