All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix PM disable depth imbalance on error
@ 2020-11-11  4:13 Zhang Qilong
  2020-11-11  4:13 ` [PATCH 1/3] ASoC: wm8994: " Zhang Qilong
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Zhang Qilong @ 2020-11-11  4:13 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context. This series of patches
fixed it.

Zhang Qilong (3):
  ASoC: wm8994: Fix PM disable depth imbalance on error
  ASoC: wm8997: Fix PM disable depth imbalance on error
  ASoC: wm8998: Fix PM disable depth imbalance on error

 sound/soc/codecs/wm8994.c | 6 +++++-
 sound/soc/codecs/wm8997.c | 9 +++++++--
 sound/soc/codecs/wm8998.c | 4 +++-
 3 files changed, 15 insertions(+), 4 deletions(-)

-- 
2.25.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] ASoC: wm8994: Fix PM disable depth imbalance on error
  2020-11-11  4:13 [PATCH 0/3] Fix PM disable depth imbalance on error Zhang Qilong
@ 2020-11-11  4:13 ` Zhang Qilong
  2020-11-11  9:57   ` Richard Fitzgerald
  2020-11-11  4:13 ` [PATCH 2/3] ASoC: wm8997: " Zhang Qilong
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Zhang Qilong @ 2020-11-11  4:13 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context.

Fixes: 57e265c8d71fb ("ASoC: wm8994: Move runtime PM init to platform device init")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/codecs/wm8994.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index fc9ea198ac79..f57884113406 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4645,8 +4645,12 @@ static int wm8994_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_idle(&pdev->dev);
 
-	return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8994,
+	ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8994,
 			wm8994_dai, ARRAY_SIZE(wm8994_dai));
+	if (ret < 0)
+		pm_runtime_disable(&pdev->dev);
+
+	return ret;
 }
 
 static int wm8994_remove(struct platform_device *pdev)
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] ASoC: wm8997: Fix PM disable depth imbalance on error
  2020-11-11  4:13 [PATCH 0/3] Fix PM disable depth imbalance on error Zhang Qilong
  2020-11-11  4:13 ` [PATCH 1/3] ASoC: wm8994: " Zhang Qilong
@ 2020-11-11  4:13 ` Zhang Qilong
  2020-11-11  9:56   ` Richard Fitzgerald
  2020-11-11  4:13 ` [PATCH 3/3] ASoC: wm8998: " Zhang Qilong
  2020-11-11 15:47 ` [PATCH 0/3] " Mark Brown
  3 siblings, 1 reply; 9+ messages in thread
From: Zhang Qilong @ 2020-11-11  4:13 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context.

Fixes: 31833ead95c2c ("ASoC: arizona: Move request of speaker IRQs into bus probe")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/codecs/wm8997.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
index 37e4bb3dbd8a..744104edb2eb 100644
--- a/sound/soc/codecs/wm8997.c
+++ b/sound/soc/codecs/wm8997.c
@@ -1163,10 +1163,10 @@ static int wm8997_probe(struct platform_device *pdev)
 
 	ret = arizona_init_vol_limit(arizona);
 	if (ret < 0)
-		return ret;
+		goto err_pm_disable;
 	ret = arizona_init_spk_irqs(arizona);
 	if (ret < 0)
-		return ret;
+		goto err_pm_disable;
 
 	ret = devm_snd_soc_register_component(&pdev->dev,
 					      &soc_component_dev_wm8997,
@@ -1176,9 +1176,14 @@ static int wm8997_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
 		goto err_spk_irqs;
 	}
+	arizona_free_spk_irqs(arizona);
+
+	return ret;
 
 err_spk_irqs:
 	arizona_free_spk_irqs(arizona);
+err_pm_disable:
+	pm_runtime_disable(&pdev->dev);
 
 	return ret;
 }
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] ASoC: wm8998: Fix PM disable depth imbalance on error
  2020-11-11  4:13 [PATCH 0/3] Fix PM disable depth imbalance on error Zhang Qilong
  2020-11-11  4:13 ` [PATCH 1/3] ASoC: wm8994: " Zhang Qilong
  2020-11-11  4:13 ` [PATCH 2/3] ASoC: wm8997: " Zhang Qilong
@ 2020-11-11  4:13 ` Zhang Qilong
  2020-11-11  9:50   ` Richard Fitzgerald
  2020-11-11 15:47 ` [PATCH 0/3] " Mark Brown
  3 siblings, 1 reply; 9+ messages in thread
From: Zhang Qilong @ 2020-11-11  4:13 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context.

Fixes: 31833ead95c2c ("ASoC: arizona: Move request of speaker IRQs into bus probe")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 sound/soc/codecs/wm8998.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c
index f6c5cc80c970..5413254295b7 100644
--- a/sound/soc/codecs/wm8998.c
+++ b/sound/soc/codecs/wm8998.c
@@ -1375,7 +1375,7 @@ static int wm8998_probe(struct platform_device *pdev)
 
 	ret = arizona_init_spk_irqs(arizona);
 	if (ret < 0)
-		return ret;
+		goto err_pm_disable;
 
 	ret = devm_snd_soc_register_component(&pdev->dev,
 					      &soc_component_dev_wm8998,
@@ -1390,6 +1390,8 @@ static int wm8998_probe(struct platform_device *pdev)
 
 err_spk_irqs:
 	arizona_free_spk_irqs(arizona);
+err_pm_disable:
+	pm_runtime_disable(&pdev->dev);
 
 	return ret;
 }
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] ASoC: wm8998: Fix PM disable depth imbalance on error
  2020-11-11  4:13 ` [PATCH 3/3] ASoC: wm8998: " Zhang Qilong
@ 2020-11-11  9:50   ` Richard Fitzgerald
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Fitzgerald @ 2020-11-11  9:50 UTC (permalink / raw)
  To: Zhang Qilong, lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

On 11/11/2020 04:13, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context.
> 
> Fixes: 31833ead95c2c ("ASoC: arizona: Move request of speaker IRQs into bus probe")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>   sound/soc/codecs/wm8998.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c
> index f6c5cc80c970..5413254295b7 100644
> --- a/sound/soc/codecs/wm8998.c
> +++ b/sound/soc/codecs/wm8998.c
> @@ -1375,7 +1375,7 @@ static int wm8998_probe(struct platform_device *pdev)
>   
>   	ret = arizona_init_spk_irqs(arizona);
>   	if (ret < 0)
> -		return ret;
> +		goto err_pm_disable;
>   
>   	ret = devm_snd_soc_register_component(&pdev->dev,
>   					      &soc_component_dev_wm8998,
> @@ -1390,6 +1390,8 @@ static int wm8998_probe(struct platform_device *pdev)
>   
>   err_spk_irqs:
>   	arizona_free_spk_irqs(arizona);
> +err_pm_disable:
> +	pm_runtime_disable(&pdev->dev);
>   
>   	return ret;
>   }
> 

Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] ASoC: wm8997: Fix PM disable depth imbalance on error
  2020-11-11  4:13 ` [PATCH 2/3] ASoC: wm8997: " Zhang Qilong
@ 2020-11-11  9:56   ` Richard Fitzgerald
  2020-11-11 10:15     ` 答复: " zhangqilong
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Fitzgerald @ 2020-11-11  9:56 UTC (permalink / raw)
  To: Zhang Qilong, lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

On 11/11/2020 04:13, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context.
> 
> Fixes: 31833ead95c2c ("ASoC: arizona: Move request of speaker IRQs into bus probe")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>   sound/soc/codecs/wm8997.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
> index 37e4bb3dbd8a..744104edb2eb 100644
> --- a/sound/soc/codecs/wm8997.c
> +++ b/sound/soc/codecs/wm8997.c
> @@ -1163,10 +1163,10 @@ static int wm8997_probe(struct platform_device *pdev)
>   
>   	ret = arizona_init_vol_limit(arizona);
>   	if (ret < 0)
> -		return ret;
> +		goto err_pm_disable;
>   	ret = arizona_init_spk_irqs(arizona);
>   	if (ret < 0)
> -		return ret;
> +		goto err_pm_disable;
>   
>   	ret = devm_snd_soc_register_component(&pdev->dev,
>   					      &soc_component_dev_wm8997,
> @@ -1176,9 +1176,14 @@ static int wm8997_probe(struct platform_device *pdev)
>   		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
>   		goto err_spk_irqs;
>   	}
> +	arizona_free_spk_irqs(arizona);

Should not be freeing speaker irqs on successful probe.
This looks like an existing bug in the driver where the return 0 was
missing so it would always exit through the error path.

> +
> +	return ret;
>   
>   err_spk_irqs:
>   	arizona_free_spk_irqs(arizona);
> +err_pm_disable:
> +	pm_runtime_disable(&pdev->dev);
>   
>   	return ret;
>   }
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] ASoC: wm8994: Fix PM disable depth imbalance on error
  2020-11-11  4:13 ` [PATCH 1/3] ASoC: wm8994: " Zhang Qilong
@ 2020-11-11  9:57   ` Richard Fitzgerald
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Fitzgerald @ 2020-11-11  9:57 UTC (permalink / raw)
  To: Zhang Qilong, lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

On 11/11/2020 04:13, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context.
> 
> Fixes: 57e265c8d71fb ("ASoC: wm8994: Move runtime PM init to platform device init")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
>   sound/soc/codecs/wm8994.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
> index fc9ea198ac79..f57884113406 100644
> --- a/sound/soc/codecs/wm8994.c
> +++ b/sound/soc/codecs/wm8994.c
> @@ -4645,8 +4645,12 @@ static int wm8994_probe(struct platform_device *pdev)
>   	pm_runtime_enable(&pdev->dev);
>   	pm_runtime_idle(&pdev->dev);
>   
> -	return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8994,
> +	ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8994,
>   			wm8994_dai, ARRAY_SIZE(wm8994_dai));
> +	if (ret < 0)
> +		pm_runtime_disable(&pdev->dev);
> +
> +	return ret;
>   }
>   
>   static int wm8994_remove(struct platform_device *pdev)
> 

Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* 答复: [PATCH 2/3] ASoC: wm8997: Fix PM disable depth imbalance on error
  2020-11-11  9:56   ` Richard Fitzgerald
@ 2020-11-11 10:15     ` zhangqilong
  0 siblings, 0 replies; 9+ messages in thread
From: zhangqilong @ 2020-11-11 10:15 UTC (permalink / raw)
  To: Richard Fitzgerald, lgirdwood, broonie, perex, tiwai; +Cc: patches, alsa-devel

> 
> On 11/11/2020 04:13, Zhang Qilong wrote:
> > The pm_runtime_enable will increase power disable depth. Thus a
> > pairing decrement is needed on the error handling path to keep it
> > balanced according to context.
> >
> > Fixes: 31833ead95c2c ("ASoC: arizona: Move request of speaker IRQs
> > into bus probe")
> > Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> > ---
> >   sound/soc/codecs/wm8997.c | 9 +++++++--
> >   1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
> > index 37e4bb3dbd8a..744104edb2eb 100644
> > --- a/sound/soc/codecs/wm8997.c
> > +++ b/sound/soc/codecs/wm8997.c
> > @@ -1163,10 +1163,10 @@ static int wm8997_probe(struct
> platform_device
> > *pdev)
> >
> >   	ret = arizona_init_vol_limit(arizona);
> >   	if (ret < 0)
> > -		return ret;
> > +		goto err_pm_disable;
> >   	ret = arizona_init_spk_irqs(arizona);
> >   	if (ret < 0)
> > -		return ret;
> > +		goto err_pm_disable;
> >
> >   	ret = devm_snd_soc_register_component(&pdev->dev,
> >   					      &soc_component_dev_wm8997, @@
> -1176,9 +1176,14 @@ static
> > int wm8997_probe(struct platform_device *pdev)
> >   		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
> >   		goto err_spk_irqs;
> >   	}
> > +	arizona_free_spk_irqs(arizona);
> 
> Should not be freeing speaker irqs on successful probe.
> This looks like an existing bug in the driver where the return 0 was missing so it
> would always exit through the error path.

Yes, You are right, I had a little doubts here before, it should be freed when it is be removed. I will fix it next version.

Thans,
Zhang


> 
> > +
> > +	return ret;
> >
> >   err_spk_irqs:
> >   	arizona_free_spk_irqs(arizona);
> > +err_pm_disable:
> > +	pm_runtime_disable(&pdev->dev);
> >
> >   	return ret;
> >   }
> >

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] Fix PM disable depth imbalance on error
  2020-11-11  4:13 [PATCH 0/3] Fix PM disable depth imbalance on error Zhang Qilong
                   ` (2 preceding siblings ...)
  2020-11-11  4:13 ` [PATCH 3/3] ASoC: wm8998: " Zhang Qilong
@ 2020-11-11 15:47 ` Mark Brown
  3 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2020-11-11 15:47 UTC (permalink / raw)
  To: Zhang Qilong, perex, tiwai, lgirdwood; +Cc: patches, alsa-devel

On Wed, 11 Nov 2020 12:13:23 +0800, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context. This series of patches
> fixed it.
> 
> Zhang Qilong (3):
>   ASoC: wm8994: Fix PM disable depth imbalance on error
>   ASoC: wm8997: Fix PM disable depth imbalance on error
>   ASoC: wm8998: Fix PM disable depth imbalance on error
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: wm8994: Fix PM disable depth imbalance on error
      commit: b8161cbe55a1892a19a318eaebbda92438fa708c
[2/2] ASoC: wm8998: Fix PM disable depth imbalance on error
      commit: 193aa0a043645220d2a2f783ba06ae13d4601078

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-11 15:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11  4:13 [PATCH 0/3] Fix PM disable depth imbalance on error Zhang Qilong
2020-11-11  4:13 ` [PATCH 1/3] ASoC: wm8994: " Zhang Qilong
2020-11-11  9:57   ` Richard Fitzgerald
2020-11-11  4:13 ` [PATCH 2/3] ASoC: wm8997: " Zhang Qilong
2020-11-11  9:56   ` Richard Fitzgerald
2020-11-11 10:15     ` 答复: " zhangqilong
2020-11-11  4:13 ` [PATCH 3/3] ASoC: wm8998: " Zhang Qilong
2020-11-11  9:50   ` Richard Fitzgerald
2020-11-11 15:47 ` [PATCH 0/3] " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.