From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-pm@vger.kernel.org,
Geert Uytterhoeven <geert@linux-m68k.org>,
Kevin Hilman <khilman@kernel.org>
Subject: Re: [PATCH] PM / Domains: Convert to dev_to_genpd_safe() in genpd_syscore_switch()
Date: Wed, 13 Nov 2019 12:05:53 +0100 [thread overview]
Message-ID: <2599983.gEBnMgVu9Q@kreacher> (raw)
In-Reply-To: <20191016141649.18690-1-ulf.hansson@linaro.org>
On Wednesday, October 16, 2019 4:16:49 PM CET Ulf Hansson wrote:
> The intent with walking the gpd_list via calling genpd_present() from
> genpd_syscore_switch(), is to make sure the dev->pm_domain pointer belongs
> to a registered genpd. However, as a genpd can't be removed if there is a
> device attached to it, let's convert to use the quicker dev_to_genpd_safe()
> instead.
>
> Due to the above change, this allows us to cleanup genpd_present() and move
> it inside CONFIG_PM_GENERIC_DOMAINS_OF, so let's do that as well.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
> drivers/base/power/domain.c | 32 ++++++++++++--------------------
> 1 file changed, 12 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index cc85e87eaf05..600ea78d6b71 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -922,24 +922,6 @@ static int __init genpd_power_off_unused(void)
> }
> late_initcall(genpd_power_off_unused);
>
> -#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_GENERIC_DOMAINS_OF)
> -
> -static bool genpd_present(const struct generic_pm_domain *genpd)
> -{
> - const struct generic_pm_domain *gpd;
> -
> - if (IS_ERR_OR_NULL(genpd))
> - return false;
> -
> - list_for_each_entry(gpd, &gpd_list, gpd_list_node)
> - if (gpd == genpd)
> - return true;
> -
> - return false;
> -}
> -
> -#endif
> -
> #ifdef CONFIG_PM_SLEEP
>
> /**
> @@ -1354,8 +1336,8 @@ static void genpd_syscore_switch(struct device *dev, bool suspend)
> {
> struct generic_pm_domain *genpd;
>
> - genpd = dev_to_genpd(dev);
> - if (!genpd_present(genpd))
> + genpd = dev_to_genpd_safe(dev);
> + if (!genpd)
> return;
>
> if (suspend) {
> @@ -2020,6 +2002,16 @@ static int genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
> return 0;
> }
>
> +static bool genpd_present(const struct generic_pm_domain *genpd)
> +{
> + const struct generic_pm_domain *gpd;
> +
> + list_for_each_entry(gpd, &gpd_list, gpd_list_node)
> + if (gpd == genpd)
> + return true;
> + return false;
> +}
> +
> /**
> * of_genpd_add_provider_simple() - Register a simple PM domain provider
> * @np: Device node pointer associated with the PM domain provider.
>
Applying as 5.5 material, thanks!
prev parent reply other threads:[~2019-11-13 11:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 14:16 [PATCH] PM / Domains: Convert to dev_to_genpd_safe() in genpd_syscore_switch() Ulf Hansson
2019-11-13 11:05 ` Rafael J. Wysocki [this message]
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=2599983.gEBnMgVu9Q@kreacher \
--to=rjw@rjwysocki.net \
--cc=geert@linux-m68k.org \
--cc=khilman@kernel.org \
--cc=linux-pm@vger.kernel.org \
--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).