linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	<linux-pm@vger.kernel.org>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Tony Lindgren <tony@atomide.com>,
	Axe Yang <axe.yang@mediatek.com>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PM: runtime: Extend support for wakeirq for force_suspend|resume
Date: Thu, 9 Jun 2022 11:16:17 +0800	[thread overview]
Message-ID: <086c0102b772bd86c23c4fdcb5b145854d76042d.camel@mediatek.com> (raw)
In-Reply-To: <20220608153120.303070-1-ulf.hansson@linaro.org>

On Wed, 2022-06-08 at 17:31 +0200, Ulf Hansson wrote:
> A driver that makes use of pm_runtime_force_suspend|resume() to
> support
> system suspend/resume, currently needs to manage the wakeirq support
> itself. To avoid the boilerplate code in the driver's system
> suspend/resume
> callbacks in particular, let's extend
> pm_runtime_force_suspend|resume() to
> deal with the wakeirq.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
> 
> Note that, the reason behind this patch came up while discussing an
> MMC patch
> for a Mediatek MMC host driver [1].
> 
> Kind regards
> Ulf Hansson
> 
> [1]
> https://lkml.org/lkml/2022/6/8/813
> 
> ---
>  drivers/base/power/runtime.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/base/power/runtime.c
> b/drivers/base/power/runtime.c
> index 676dc72d912d..445a724cbded 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -1876,10 +1876,13 @@ int pm_runtime_force_suspend(struct device
> *dev)
>  
>  	callback = RPM_GET_CALLBACK(dev, runtime_suspend);
>  
> +	dev_pm_enable_wake_irq_check(dev, true);
>  	ret = callback ? callback(dev) : 0;
>  	if (ret)
>  		goto err;
>  
> +	dev_pm_enable_wake_irq_complete(dev);
> +
>  	/*
>  	 * If the device can stay in suspend after the system-wide
> transition
>  	 * to the working state that will follow, drop the children
> counter of
> @@ -1896,6 +1899,7 @@ int pm_runtime_force_suspend(struct device
> *dev)
>  	return 0;
>  
>  err:
> +	dev_pm_disable_wake_irq_check(dev, true);
>  	pm_runtime_enable(dev);
>  	return ret;
>  }
> @@ -1929,9 +1933,11 @@ int pm_runtime_force_resume(struct device
> *dev)
>  
>  	callback = RPM_GET_CALLBACK(dev, runtime_resume);
>  
> +	dev_pm_disable_wake_irq_check(dev, false);
>  	ret = callback ? callback(dev) : 0;
>  	if (ret) {
>  		pm_runtime_set_suspended(dev);
> +		dev_pm_enable_wake_irq_check(dev, false);
>  		goto out;
>  	}
>  
Reviewed-by Chunfeng Yun <chunfeng.yun@mediatek.com>



  reply	other threads:[~2022-06-09  3:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 15:31 [PATCH] PM: runtime: Extend support for wakeirq for force_suspend|resume Ulf Hansson
2022-06-09  3:16 ` Chunfeng Yun [this message]
2022-06-14 11:16 ` Tony Lindgren
2022-07-08 19:37   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=086c0102b772bd86c23c4fdcb5b145854d76042d.camel@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=axe.yang@mediatek.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).