diff mbox series

[v2,07/23] ASoC: au1x: psc-ac97.c: use devm_snd_soc_register_component()

Message ID 871rzetkuo.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: use devm_xxx | expand

Commit Message

Kuninori Morimoto June 28, 2019, 4:08 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We have devm_xxx version of snd_soc_register_component,
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

	- no change

 sound/soc/au1x/psc-ac97.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Mark Brown July 2, 2019, 12:39 p.m. UTC | #1
On Fri, Jun 28, 2019 at 01:08:34PM +0900, Kuninori Morimoto wrote:

> @@ -426,8 +426,6 @@ static int au1xpsc_ac97_drvremove(struct platform_device *pdev)
>  {
>  	struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
>  
> -	snd_soc_unregister_component(&pdev->dev);
> -
>  	/* disable PSC completely */
>  	__raw_writel(0, AC97_CFG(wd));
>  	wmb(); /* drain writebuffer */

I don't think this is 100% safe - with this change we will turn
off the hardware block before we unregister the component which
means that we might try to interact with it.  If we're converting
to devm then we need to be careful the ordering of the removal
won't be affected.
Kuninori Morimoto July 3, 2019, 12:36 a.m. UTC | #2
Hi Mark

> > @@ -426,8 +426,6 @@ static int au1xpsc_ac97_drvremove(struct platform_device *pdev)
> >  {
> >  	struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
> >  
> > -	snd_soc_unregister_component(&pdev->dev);
> > -
> >  	/* disable PSC completely */
> >  	__raw_writel(0, AC97_CFG(wd));
> >  	wmb(); /* drain writebuffer */
> 
> I don't think this is 100% safe - with this change we will turn
> off the hardware block before we unregister the component which
> means that we might try to interact with it.  If we're converting
> to devm then we need to be careful the ordering of the removal
> won't be affected.

Hmm indeed.
Thank you for your review.

Thank you for your help !!
Best regards
---
Kuninori Morimoto
diff mbox series

Patch

diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index 21e5f6a..0fd5478 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -413,8 +413,8 @@  static int au1xpsc_ac97_drvprobe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = snd_soc_register_component(&pdev->dev, &au1xpsc_ac97_component,
-					 &wd->dai_drv, 1);
+	ret = devm_snd_soc_register_component(&pdev->dev,
+				&au1xpsc_ac97_component, &wd->dai_drv, 1);
 	if (ret)
 		return ret;
 
@@ -426,8 +426,6 @@  static int au1xpsc_ac97_drvremove(struct platform_device *pdev)
 {
 	struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
 
-	snd_soc_unregister_component(&pdev->dev);
-
 	/* disable PSC completely */
 	__raw_writel(0, AC97_CFG(wd));
 	wmb(); /* drain writebuffer */