2020-10-29 09:04:28

by Coiby Xu

[permalink] [raw]
Subject: [PATCH 01/25] ALSA: core: pcm: remove unnecessary CONFIG_PM_SLEEP

SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu <[email protected]>
---
sound/core/pcm.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index be5714f1bb58..5a281ac92958 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -599,7 +599,6 @@ static const struct attribute_group *pcm_dev_attr_groups[];
* PM callbacks: we need to deal only with suspend here, as the resume is
* triggered either from user-space or the driver's resume callback
*/
-#ifdef CONFIG_PM_SLEEP
static int do_pcm_suspend(struct device *dev)
{
struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev);
@@ -608,7 +607,6 @@ static int do_pcm_suspend(struct device *dev)
snd_pcm_suspend_all(pstr->pcm);
return 0;
}
-#endif

static const struct dev_pm_ops pcm_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(do_pcm_suspend, NULL)
--
2.28.0


2020-10-29 09:04:48

by Coiby Xu

[permalink] [raw]
Subject: [PATCH 15/25] ASoC: stm32: sai: remove unnecessary CONFIG_PM_SLEEP

SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu <[email protected]>
---
sound/soc/stm/stm32_sai.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/soc/stm/stm32_sai.c b/sound/soc/stm/stm32_sai.c
index 058757c721f0..40c9e554a3d7 100644
--- a/sound/soc/stm/stm32_sai.c
+++ b/sound/soc/stm/stm32_sai.c
@@ -245,7 +245,6 @@ static int stm32_sai_probe(struct platform_device *pdev)
return devm_of_platform_populate(&pdev->dev);
}

-#ifdef CONFIG_PM_SLEEP
/*
* When pins are shared by two sai sub instances, pins have to be defined
* in sai parent node. In this case, pins state is not managed by alsa fw.
@@ -280,7 +279,6 @@ static int stm32_sai_resume(struct device *dev)

return pinctrl_pm_select_default_state(dev);
}
-#endif /* CONFIG_PM_SLEEP */

static const struct dev_pm_ops stm32_sai_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(stm32_sai_suspend, stm32_sai_resume)
--
2.28.0

2020-10-29 09:05:06

by Coiby Xu

[permalink] [raw]
Subject: [PATCH 25/25] ALSA: aoa: remove unnecessary CONFIG_PM_SLEEP

SIMPLE_DEV_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu <[email protected]>
---
sound/aoa/fabrics/layout.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index d2e85b83f7ed..197d13f23141 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -1126,7 +1126,6 @@ static int aoa_fabric_layout_remove(struct soundbus_dev *sdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
static int aoa_fabric_layout_suspend(struct device *dev)
{
struct layout_dev *ldev = dev_get_drvdata(dev);
@@ -1150,7 +1149,6 @@ static int aoa_fabric_layout_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(aoa_fabric_layout_pm_ops,
aoa_fabric_layout_suspend, aoa_fabric_layout_resume);

-#endif

static struct soundbus_driver aoa_soundbus_driver = {
.name = "snd_aoa_soundbus_drv",
@@ -1159,9 +1157,7 @@ static struct soundbus_driver aoa_soundbus_driver = {
.remove = aoa_fabric_layout_remove,
.driver = {
.owner = THIS_MODULE,
-#ifdef CONFIG_PM_SLEEP
.pm = &aoa_fabric_layout_pm_ops,
-#endif
}
};

--
2.28.0

2020-10-29 09:05:08

by Coiby Xu

[permalink] [raw]
Subject: [PATCH 24/25] ASoC: wm8994: remove unnecessary CONFIG_PM_SLEEP

SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu <[email protected]>
---
sound/soc/codecs/wm8994.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index fc9ea198ac79..9294ad06f76d 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4656,7 +4656,6 @@ static int wm8994_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
static int wm8994_suspend(struct device *dev)
{
struct wm8994_priv *wm8994 = dev_get_drvdata(dev);
@@ -4681,7 +4680,6 @@ static int wm8994_resume(struct device *dev)

return 0;
}
-#endif

static const struct dev_pm_ops wm8994_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(wm8994_suspend, wm8994_resume)
--
2.28.0

2020-10-29 09:05:23

by Coiby Xu

[permalink] [raw]
Subject: [PATCH 18/25] ASoC: codecs: max98373: remove unnecessary CONFIG_PM_SLEEP

SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu <[email protected]>
---
sound/soc/codecs/max98373-i2c.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c
index 92921e34f948..f847e7e76635 100644
--- a/sound/soc/codecs/max98373-i2c.c
+++ b/sound/soc/codecs/max98373-i2c.c
@@ -468,7 +468,6 @@ static struct snd_soc_dai_driver max98373_dai[] = {
}
};

-#ifdef CONFIG_PM_SLEEP
static int max98373_suspend(struct device *dev)
{
struct max98373_priv *max98373 = dev_get_drvdata(dev);
@@ -487,7 +486,6 @@ static int max98373_resume(struct device *dev)
regcache_sync(max98373->regmap);
return 0;
}
-#endif

static const struct dev_pm_ops max98373_pm = {
SET_SYSTEM_SLEEP_PM_OPS(max98373_suspend, max98373_resume)
--
2.28.0

2020-10-29 09:05:34

by Coiby Xu

[permalink] [raw]
Subject: [PATCH 03/25] ASoC: fsl: remove unnecessary CONFIG_PM_SLEEP

SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu <[email protected]>
---
sound/soc/fsl/imx-audmux.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index 25c18b9e348f..6d77188a4eab 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -349,7 +349,6 @@ static int imx_audmux_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
static int imx_audmux_suspend(struct device *dev)
{
int i;
@@ -377,7 +376,6 @@ static int imx_audmux_resume(struct device *dev)

return 0;
}
-#endif /* CONFIG_PM_SLEEP */

static const struct dev_pm_ops imx_audmux_pm = {
SET_SYSTEM_SLEEP_PM_OPS(imx_audmux_suspend, imx_audmux_resume)
--
2.28.0

2020-10-29 09:05:59

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH 01/25] ALSA: core: pcm: remove unnecessary CONFIG_PM_SLEEP

On Thu, 29 Oct 2020 08:42:37 +0100,
Coiby Xu wrote:
>
> SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.
>
> Signed-off-by: Coiby Xu <[email protected]>

It caused compile warnings. Was it already addressed in general?

Or we may use __maybe_unused attribute instead, but it's just a matter
of taste.


thanks,

Takashi

> ---
> sound/core/pcm.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index be5714f1bb58..5a281ac92958 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -599,7 +599,6 @@ static const struct attribute_group *pcm_dev_attr_groups[];
> * PM callbacks: we need to deal only with suspend here, as the resume is
> * triggered either from user-space or the driver's resume callback
> */
> -#ifdef CONFIG_PM_SLEEP
> static int do_pcm_suspend(struct device *dev)
> {
> struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev);
> @@ -608,7 +607,6 @@ static int do_pcm_suspend(struct device *dev)
> snd_pcm_suspend_all(pstr->pcm);
> return 0;
> }
> -#endif
>
> static const struct dev_pm_ops pcm_dev_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(do_pcm_suspend, NULL)
> --
> 2.28.0
>

2020-10-29 09:06:26

by Coiby Xu

[permalink] [raw]
Subject: [PATCH 02/25] ASoC: fsl: fsl_ssi: remove unnecessary CONFIG_PM_SLEEP

SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.

Signed-off-by: Coiby Xu <[email protected]>
---
sound/soc/fsl/fsl_ssi.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 404be27c15fe..065500a4cbc1 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1669,7 +1669,6 @@ static int fsl_ssi_remove(struct platform_device *pdev)
return 0;
}

-#ifdef CONFIG_PM_SLEEP
static int fsl_ssi_suspend(struct device *dev)
{
struct fsl_ssi *ssi = dev_get_drvdata(dev);
@@ -1699,7 +1698,6 @@ static int fsl_ssi_resume(struct device *dev)

return regcache_sync(regs);
}
-#endif /* CONFIG_PM_SLEEP */

static const struct dev_pm_ops fsl_ssi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(fsl_ssi_suspend, fsl_ssi_resume)
--
2.28.0

2020-10-29 14:39:52

by Coiby Xu

[permalink] [raw]
Subject: Re: [PATCH 01/25] ALSA: core: pcm: remove unnecessary CONFIG_PM_SLEEP

On Thu, Oct 29, 2020 at 08:48:55AM +0100, Takashi Iwai wrote:
>On Thu, 29 Oct 2020 08:42:37 +0100,
>Coiby Xu wrote:
>>
>> SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.
>>
>> Signed-off-by: Coiby Xu <[email protected]>
>
>It caused compile warnings. Was it already addressed in general?
>
It hasn't been addressed in general. Thank you for the reminding!

>Or we may use __maybe_unused attribute instead, but it's just a matter
>of taste.
>
I'll add __maybe_unused in v2 since __maybe_unused should be preferred over
CONFIG_PM_SLEEP according to Arnd Bergmann [1],

> > By and large, drivers handle this by using a CONFIG_PM_SLEEP ifdef.
> >
> > Unless you can make an extremely convincing argument why not to do
> > so here, I'd like you to handle it that way instead.
>
> [adding linux-pm to Cc]
>
> The main reason is that everyone gets the #ifdef wrong, I run into
> half a dozen new build regressions with linux-next every week on
> average, the typical problems being:
>
> - testing CONFIG_PM_SLEEP instead of CONFIG_PM, leading to an unused
> function warning
> - testing CONFIG_PM instead of CONFIG_PM_SLEEP, leading to a build
> failure
> - calling a function outside of the #ifdef only from inside an
> otherwise correct #ifdef, again leading to an unused function
> warning
> - causing a warning inside of the #ifdef but only testing if that
> is disabled, leading to a problem if the macro is set (this is
> rare these days for CONFIG_PM as that is normally enabled)
>
> Using __maybe_unused avoids all of the above.

[1] https://lore.kernel.org/patchwork/comment/919944/
>
>thanks,
>
>Takashi
>
>> ---
>> sound/core/pcm.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
>> index be5714f1bb58..5a281ac92958 100644
>> --- a/sound/core/pcm.c
>> +++ b/sound/core/pcm.c
>> @@ -599,7 +599,6 @@ static const struct attribute_group *pcm_dev_attr_groups[];
>> * PM callbacks: we need to deal only with suspend here, as the resume is
>> * triggered either from user-space or the driver's resume callback
>> */
>> -#ifdef CONFIG_PM_SLEEP
>> static int do_pcm_suspend(struct device *dev)
>> {
>> struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev);
>> @@ -608,7 +607,6 @@ static int do_pcm_suspend(struct device *dev)
>> snd_pcm_suspend_all(pstr->pcm);
>> return 0;
>> }
>> -#endif
>>
>> static const struct dev_pm_ops pcm_dev_pm_ops = {
>> SET_SYSTEM_SLEEP_PM_OPS(do_pcm_suspend, NULL)
>> --
>> 2.28.0
>>

--
Best regards,
Coiby

2020-10-29 16:00:14

by Charles Keepax

[permalink] [raw]
Subject: Re: [PATCH 24/25] ASoC: wm8994: remove unnecessary CONFIG_PM_SLEEP

On Thu, Oct 29, 2020 at 03:43:00PM +0800, Coiby Xu wrote:
> SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG.
>
> Signed-off-by: Coiby Xu <[email protected]>
> ---
> sound/soc/codecs/wm8994.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
> index fc9ea198ac79..9294ad06f76d 100644
> --- a/sound/soc/codecs/wm8994.c
> +++ b/sound/soc/codecs/wm8994.c
> @@ -4656,7 +4656,6 @@ static int wm8994_remove(struct platform_device *pdev)
> return 0;
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int wm8994_suspend(struct device *dev)
> {
> struct wm8994_priv *wm8994 = dev_get_drvdata(dev);
> @@ -4681,7 +4680,6 @@ static int wm8994_resume(struct device *dev)
>
> return 0;
> }
> -#endif
>
> static const struct dev_pm_ops wm8994_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(wm8994_suspend, wm8994_resume)

Not sure this really makes sense, what is going to stop the
unused function warning if PM isn't configured?

Thanks,
Charles