All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
@ 2022-04-20  3:03 ` cgel.zte
  0 siblings, 0 replies; 10+ messages in thread
From: cgel.zte @ 2022-04-20  3:03 UTC (permalink / raw)
  To: pierre-louis.bossart
  Cc: lgirdwood, ranjani.sridharan, kai.vehmanen, daniel.baluta,
	broonie, sound-open-firmware, alsa-devel, linux-kernel,
	Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. This change is just to simplify the code, no
actual functional changes.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 sound/soc/sof/sof-client-probes.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c
index 797dedb26163..c4c6e03c8133 100644
--- a/sound/soc/sof/sof-client-probes.c
+++ b/sound/soc/sof/sof-client-probes.c
@@ -503,10 +503,9 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
 	if (!buf)
 		return -ENOMEM;
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0 && ret != -EACCES) {
 		dev_err_ratelimited(dev, "debugfs read failed to resume %d\n", ret);
-		pm_runtime_put_noidle(dev);
 		goto exit;
 	}
 
@@ -568,10 +567,9 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,
 
 	desc = (struct sof_probe_point_desc *)tkns;
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0 && ret != -EACCES) {
 		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
-		pm_runtime_put_noidle(dev);
 		goto exit;
 	}
 
@@ -621,10 +619,9 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,
 		goto exit;
 	}
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0) {
 		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
-		pm_runtime_put_noidle(dev);
 		goto exit;
 	}
 
-- 
2.25.1



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

* [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
@ 2022-04-20  3:03 ` cgel.zte
  0 siblings, 0 replies; 10+ messages in thread
From: cgel.zte @ 2022-04-20  3:03 UTC (permalink / raw)
  To: pierre-louis.bossart
  Cc: alsa-devel, kai.vehmanen, linux-kernel, Zeal Robot, lgirdwood,
	Minghao Chi, ranjani.sridharan, broonie, daniel.baluta,
	sound-open-firmware

From: Minghao Chi <chi.minghao@zte.com.cn>

Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. This change is just to simplify the code, no
actual functional changes.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 sound/soc/sof/sof-client-probes.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c
index 797dedb26163..c4c6e03c8133 100644
--- a/sound/soc/sof/sof-client-probes.c
+++ b/sound/soc/sof/sof-client-probes.c
@@ -503,10 +503,9 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
 	if (!buf)
 		return -ENOMEM;
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0 && ret != -EACCES) {
 		dev_err_ratelimited(dev, "debugfs read failed to resume %d\n", ret);
-		pm_runtime_put_noidle(dev);
 		goto exit;
 	}
 
@@ -568,10 +567,9 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,
 
 	desc = (struct sof_probe_point_desc *)tkns;
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0 && ret != -EACCES) {
 		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
-		pm_runtime_put_noidle(dev);
 		goto exit;
 	}
 
@@ -621,10 +619,9 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,
 		goto exit;
 	}
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0) {
 		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
-		pm_runtime_put_noidle(dev);
 		goto exit;
 	}
 
-- 
2.25.1



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

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
  2022-04-20  3:03 ` cgel.zte
@ 2022-04-20 13:28   ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-20 13:28 UTC (permalink / raw)
  To: cgel.zte
  Cc: lgirdwood, ranjani.sridharan, kai.vehmanen, daniel.baluta,
	broonie, sound-open-firmware, alsa-devel, linux-kernel,
	Minghao Chi, Zeal Robot



On 4/19/22 22:03, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. This change is just to simplify the code, no
> actual functional changes.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

Well, maybe that's a simplification, but we've been using the same pattern for years now.

Is there really a clear direction to use this new function?

the overwhelming majority of drivers in sound/soc still rely on the pm_runtime_get_sync (111 v. 7).


> ---
>  sound/soc/sof/sof-client-probes.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c
> index 797dedb26163..c4c6e03c8133 100644
> --- a/sound/soc/sof/sof-client-probes.c
> +++ b/sound/soc/sof/sof-client-probes.c
> @@ -503,10 +503,9 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
>  	if (!buf)
>  		return -ENOMEM;
>  
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>  	if (ret < 0 && ret != -EACCES) {
>  		dev_err_ratelimited(dev, "debugfs read failed to resume %d\n", ret);
> -		pm_runtime_put_noidle(dev);
>  		goto exit;
>  	}
>  
> @@ -568,10 +567,9 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,
>  
>  	desc = (struct sof_probe_point_desc *)tkns;
>  
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>  	if (ret < 0 && ret != -EACCES) {
>  		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
> -		pm_runtime_put_noidle(dev);
>  		goto exit;
>  	}
>  
> @@ -621,10 +619,9 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,
>  		goto exit;
>  	}
>  
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>  	if (ret < 0) {
>  		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
> -		pm_runtime_put_noidle(dev);
>  		goto exit;
>  	}
>  

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

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
@ 2022-04-20 13:28   ` Pierre-Louis Bossart
  0 siblings, 0 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-20 13:28 UTC (permalink / raw)
  To: cgel.zte
  Cc: alsa-devel, kai.vehmanen, linux-kernel, Zeal Robot, lgirdwood,
	Minghao Chi, ranjani.sridharan, broonie, daniel.baluta,
	sound-open-firmware



On 4/19/22 22:03, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. This change is just to simplify the code, no
> actual functional changes.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

Well, maybe that's a simplification, but we've been using the same pattern for years now.

Is there really a clear direction to use this new function?

the overwhelming majority of drivers in sound/soc still rely on the pm_runtime_get_sync (111 v. 7).


> ---
>  sound/soc/sof/sof-client-probes.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c
> index 797dedb26163..c4c6e03c8133 100644
> --- a/sound/soc/sof/sof-client-probes.c
> +++ b/sound/soc/sof/sof-client-probes.c
> @@ -503,10 +503,9 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
>  	if (!buf)
>  		return -ENOMEM;
>  
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>  	if (ret < 0 && ret != -EACCES) {
>  		dev_err_ratelimited(dev, "debugfs read failed to resume %d\n", ret);
> -		pm_runtime_put_noidle(dev);
>  		goto exit;
>  	}
>  
> @@ -568,10 +567,9 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,
>  
>  	desc = (struct sof_probe_point_desc *)tkns;
>  
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>  	if (ret < 0 && ret != -EACCES) {
>  		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
> -		pm_runtime_put_noidle(dev);
>  		goto exit;
>  	}
>  
> @@ -621,10 +619,9 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,
>  		goto exit;
>  	}
>  
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>  	if (ret < 0) {
>  		dev_err_ratelimited(dev, "debugfs write failed to resume %d\n", ret);
> -		pm_runtime_put_noidle(dev);
>  		goto exit;
>  	}
>  

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

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
  2022-04-20 13:28   ` Pierre-Louis Bossart
@ 2022-04-20 15:23     ` Mark Brown
  -1 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-04-20 15:23 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: cgel.zte, lgirdwood, ranjani.sridharan, kai.vehmanen,
	daniel.baluta, sound-open-firmware, alsa-devel, linux-kernel,
	Minghao Chi, Zeal Robot

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

On Wed, Apr 20, 2022 at 08:28:31AM -0500, Pierre-Louis Bossart wrote:
> On 4/19/22 22:03, cgel.zte@gmail.com wrote:
> > From: Minghao Chi <chi.minghao@zte.com.cn>

> > Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> > pm_runtime_put_noidle. This change is just to simplify the code, no
> > actual functional changes.

> Well, maybe that's a simplification, but we've been using the same pattern for years now.

> Is there really a clear direction to use this new function?

It seems like a much better pattern and there's been a steady stream of
conversion patches.  The whole get/idle thing is pretty much just sharp
edges.

> the overwhelming majority of drivers in sound/soc still rely on the pm_runtime_get_sync (111 v. 7).

We'll get there I'm sure.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
@ 2022-04-20 15:23     ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-04-20 15:23 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, kai.vehmanen, cgel.zte, Zeal Robot, lgirdwood,
	Minghao Chi, ranjani.sridharan, daniel.baluta, linux-kernel,
	sound-open-firmware

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

On Wed, Apr 20, 2022 at 08:28:31AM -0500, Pierre-Louis Bossart wrote:
> On 4/19/22 22:03, cgel.zte@gmail.com wrote:
> > From: Minghao Chi <chi.minghao@zte.com.cn>

> > Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> > pm_runtime_put_noidle. This change is just to simplify the code, no
> > actual functional changes.

> Well, maybe that's a simplification, but we've been using the same pattern for years now.

> Is there really a clear direction to use this new function?

It seems like a much better pattern and there's been a steady stream of
conversion patches.  The whole get/idle thing is pretty much just sharp
edges.

> the overwhelming majority of drivers in sound/soc still rely on the pm_runtime_get_sync (111 v. 7).

We'll get there I'm sure.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
  2022-04-20 15:23     ` Mark Brown
  (?)
@ 2022-04-20 16:11     ` Pierre-Louis Bossart
  2022-04-20 16:23       ` Mark Brown
  -1 siblings, 1 reply; 10+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-20 16:11 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, kai.vehmanen, cgel.zte, Zeal Robot, lgirdwood,
	Minghao Chi, ranjani.sridharan, daniel.baluta, linux-kernel,
	sound-open-firmware



On 4/20/22 10:23, Mark Brown wrote:
> On Wed, Apr 20, 2022 at 08:28:31AM -0500, Pierre-Louis Bossart wrote:
>> On 4/19/22 22:03, cgel.zte@gmail.com wrote:
>>> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
>>> Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
>>> pm_runtime_put_noidle. This change is just to simplify the code, no
>>> actual functional changes.
> 
>> Well, maybe that's a simplification, but we've been using the same pattern for years now.
> 
>> Is there really a clear direction to use this new function?
> 
> It seems like a much better pattern and there's been a steady stream of
> conversion patches.  The whole get/idle thing is pretty much just sharp
> edges.
> 
>> the overwhelming majority of drivers in sound/soc still rely on the pm_runtime_get_sync (111 v. 7).
> 
> We'll get there I'm sure.

ok, I'll send follow-up patches for the remaining code.

For this patch: 

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
  2022-04-20 16:11     ` Pierre-Louis Bossart
@ 2022-04-20 16:23       ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-04-20 16:23 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, kai.vehmanen, cgel.zte, Zeal Robot, lgirdwood,
	Minghao Chi, ranjani.sridharan, daniel.baluta, linux-kernel,
	sound-open-firmware

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

On Wed, Apr 20, 2022 at 11:11:03AM -0500, Pierre-Louis Bossart wrote:

> ok, I'll send follow-up patches for the remaining code.

Thanks, like you say there's a lot to get through here!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
  2022-04-20  3:03 ` cgel.zte
@ 2022-04-20 21:41   ` Mark Brown
  -1 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-04-20 21:41 UTC (permalink / raw)
  To: pierre-louis.bossart, cgel.zte
  Cc: zealci, ranjani.sridharan, chi.minghao, kai.vehmanen,
	daniel.baluta, lgirdwood, alsa-devel, sound-open-firmware,
	linux-kernel

On Wed, 20 Apr 2022 03:03:15 +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. This change is just to simplify the code, no
> actual functional changes.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
      commit: b3598fe6d009b2f2144115dfc381615c8b534aec

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] 10+ messages in thread

* Re: [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
@ 2022-04-20 21:41   ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-04-20 21:41 UTC (permalink / raw)
  To: pierre-louis.bossart, cgel.zte
  Cc: alsa-devel, kai.vehmanen, linux-kernel, zealci,
	ranjani.sridharan, chi.minghao, lgirdwood, daniel.baluta,
	sound-open-firmware

On Wed, 20 Apr 2022 03:03:15 +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. This change is just to simplify the code, no
> actual functional changes.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code
      commit: b3598fe6d009b2f2144115dfc381615c8b534aec

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] 10+ messages in thread

end of thread, other threads:[~2022-04-20 21:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  3:03 [PATCH] ASoC: SOF: using pm_runtime_resume_and_get to simplify the code cgel.zte
2022-04-20  3:03 ` cgel.zte
2022-04-20 13:28 ` Pierre-Louis Bossart
2022-04-20 13:28   ` Pierre-Louis Bossart
2022-04-20 15:23   ` Mark Brown
2022-04-20 15:23     ` Mark Brown
2022-04-20 16:11     ` Pierre-Louis Bossart
2022-04-20 16:23       ` Mark Brown
2022-04-20 21:41 ` Mark Brown
2022-04-20 21:41   ` 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.