diff mbox series

[02/16] ASoC: au1x: ac97c: use devm_snd_soc_register_component()

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

Commit Message

Kuninori Morimoto Sept. 7, 2018, 1 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/au1x/ac97c.c    | 4 +---
 sound/soc/au1x/i2sc.c     | 4 +---
 sound/soc/au1x/psc-ac97.c | 4 +---
 sound/soc/au1x/psc-i2s.c  | 4 +---
 4 files changed, 4 insertions(+), 12 deletions(-)

Comments

Mark Brown Sept. 10, 2018, 1:59 p.m. UTC | #1
On Fri, Sep 07, 2018 at 01:00:32AM +0000, Kuninori Morimoto wrote:

> @@ -288,8 +288,6 @@ static int au1xac97c_drvremove(struct platform_device *pdev)
>  {
>  	struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
>  
> -	snd_soc_unregister_component(&pdev->dev);
> -
>  	WR(ctx, AC97_ENABLE, EN_D);	/* clock off, disable */
>  
>  	ac97c_workdata = NULL;	/* MDEV */

This will mean that instead of unregistering the component so nothing
can use the hardware then disabling the hardware we'll do things the
other way around so there's a race where we may break anything that
tries to use the driver just as we're unregistring, possibly causing the
system to hang or something depending on what happens if you try to
access the disabled IPs.
diff mbox series

Patch

diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index 66d6c52..f1ddca2 100644
--- a/sound/soc/au1x/ac97c.c
+++ b/sound/soc/au1x/ac97c.c
@@ -275,7 +275,7 @@  static int au1xac97c_drvprobe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = snd_soc_register_component(&pdev->dev, &au1xac97c_component,
+	ret = devm_snd_soc_register_component(&pdev->dev, &au1xac97c_component,
 					 &au1xac97c_dai_driver, 1);
 	if (ret)
 		return ret;
@@ -288,8 +288,6 @@  static int au1xac97c_drvremove(struct platform_device *pdev)
 {
 	struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
 
-	snd_soc_unregister_component(&pdev->dev);
-
 	WR(ctx, AC97_ENABLE, EN_D);	/* clock off, disable */
 
 	ac97c_workdata = NULL;	/* MDEV */
diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c
index 450c842..b35b079 100644
--- a/sound/soc/au1x/i2sc.c
+++ b/sound/soc/au1x/i2sc.c
@@ -264,7 +264,7 @@  static int au1xi2s_drvprobe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ctx);
 
-	return snd_soc_register_component(&pdev->dev, &au1xi2s_component,
+	return devm_snd_soc_register_component(&pdev->dev, &au1xi2s_component,
 					  &au1xi2s_dai_driver, 1);
 }
 
@@ -272,8 +272,6 @@  static int au1xi2s_drvremove(struct platform_device *pdev)
 {
 	struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
 
-	snd_soc_unregister_component(&pdev->dev);
-
 	WR(ctx, I2S_ENABLE, EN_D);	/* clock off, disable */
 
 	return 0;
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index a2050ae..712c386 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -417,7 +417,7 @@  static int au1xpsc_ac97_drvprobe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = snd_soc_register_component(&pdev->dev, &au1xpsc_ac97_component,
+	ret = devm_snd_soc_register_component(&pdev->dev, &au1xpsc_ac97_component,
 					 &wd->dai_drv, 1);
 	if (ret)
 		return ret;
@@ -430,8 +430,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 */
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index e6eec08..33d90aa 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -343,7 +343,7 @@  static int au1xpsc_i2s_drvprobe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, wd);
 
-	return snd_soc_register_component(&pdev->dev, &au1xpsc_i2s_component,
+	return devm_snd_soc_register_component(&pdev->dev, &au1xpsc_i2s_component,
 					  &wd->dai_drv, 1);
 }
 
@@ -351,8 +351,6 @@  static int au1xpsc_i2s_drvremove(struct platform_device *pdev)
 {
 	struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
 
-	snd_soc_unregister_component(&pdev->dev);
-
 	__raw_writel(0, I2S_CFG(wd));
 	wmb(); /* drain writebuffer */
 	__raw_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));