From: Lina Iyer <lina.iyer@linaro.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Kevin Hilman <khilman@kernel.org>,
linux-pm@vger.kernel.org, Len Brown <len.brown@intel.com>,
Pavel Machek <pavel@ucw.cz>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Jon Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH 1/4] PM / Domains: Simplify detaching a device from its genpd
Date: Thu, 22 Sep 2016 15:38:29 -0600 [thread overview]
Message-ID: <20160922213829.GA1537@linaro.org> (raw)
In-Reply-To: <1474465133-14865-2-git-send-email-ulf.hansson@linaro.org>
On Wed, Sep 21 2016 at 07:39 -0600, Ulf Hansson wrote:
>There's no need to validate the PM domain by using genpd_lookup_dev() when
>removing the device via genpd's genpd_dev_pm_detach() function. That's
>because this function can't be called, unless there is a valid PM domain
>for the device.
>
>To simplify the behaviour, let's move code from pm_genpd_remove_device()
>into a new internal function, genpd_remove_device(), which is called from
>pm_genpd_remove_device() and genpd_dev_pm_detach().
>
>Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lina Iyer <lina.iyer@linaro.org>
>---
> drivers/base/power/domain.c | 33 +++++++++++++++++++--------------
> 1 file changed, 19 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>index 83ae3d7..63f0f8b 100644
>--- a/drivers/base/power/domain.c
>+++ b/drivers/base/power/domain.c
>@@ -1121,13 +1121,8 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
> }
> EXPORT_SYMBOL_GPL(__pm_genpd_add_device);
>
>-/**
>- * pm_genpd_remove_device - Remove a device from an I/O PM domain.
>- * @genpd: PM domain to remove the device from.
>- * @dev: Device to be removed.
>- */
>-int pm_genpd_remove_device(struct generic_pm_domain *genpd,
>- struct device *dev)
>+static int genpd_remove_device(struct generic_pm_domain *genpd,
>+ struct device *dev)
> {
> struct generic_pm_domain_data *gpd_data;
> struct pm_domain_data *pdd;
>@@ -1135,10 +1130,6 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
>
> dev_dbg(dev, "%s()\n", __func__);
>
>- if (!genpd || genpd != genpd_lookup_dev(dev))
>- return -EINVAL;
>-
>- /* The above validation also means we have existing domain_data. */
> pdd = dev->power.subsys_data->domain_data;
> gpd_data = to_gpd_data(pdd);
> dev_pm_qos_remove_notifier(dev, &gpd_data->nb);
>@@ -1170,6 +1161,20 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
>
> return ret;
> }
>+
>+/**
>+ * pm_genpd_remove_device - Remove a device from an I/O PM domain.
>+ * @genpd: PM domain to remove the device from.
>+ * @dev: Device to be removed.
>+ */
>+int pm_genpd_remove_device(struct generic_pm_domain *genpd,
>+ struct device *dev)
>+{
>+ if (!genpd || genpd != genpd_lookup_dev(dev))
>+ return -EINVAL;
>+
>+ return genpd_remove_device(genpd, dev);
>+}
> EXPORT_SYMBOL_GPL(pm_genpd_remove_device);
>
> static int genpd_add_subdomain(struct generic_pm_domain *genpd,
>@@ -1797,14 +1802,14 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
> unsigned int i;
> int ret = 0;
>
>- pd = genpd_lookup_dev(dev);
>- if (!pd)
>+ pd = dev_to_genpd(dev);
>+ if (IS_ERR(pd))
> return;
>
> dev_dbg(dev, "removing from PM domain %s\n", pd->name);
>
> for (i = 1; i < GENPD_RETRY_MAX_MS; i <<= 1) {
>- ret = pm_genpd_remove_device(pd, dev);
>+ ret = genpd_remove_device(pd, dev);
> if (ret != -EAGAIN)
> break;
>
>--
>1.9.1
>
next prev parent reply other threads:[~2016-09-22 21:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-21 13:38 [PATCH 0/4] PM / Domains: Some simplifications/clean-ups for genpd Ulf Hansson
2016-09-21 13:38 ` [PATCH 1/4] PM / Domains: Simplify detaching a device from its genpd Ulf Hansson
2016-09-22 21:38 ` Lina Iyer [this message]
2016-09-21 13:38 ` [PATCH 2/4] PM / Domains: Remove redundant system PM callbacks Ulf Hansson
2016-09-21 13:38 ` [PATCH 3/4] PM / Domains: Don't measure latency of ->power_on|off() during system PM Ulf Hansson
2016-09-21 13:38 ` [PATCH 4/4] PM / Domains: Rename pm_genpd_sync_poweron|poweroff() Ulf Hansson
2016-09-23 12:54 ` [PATCH 0/4] PM / Domains: Some simplifications/clean-ups for genpd Rafael J. Wysocki
2016-09-30 8:31 ` Kevin Hilman
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=20160922213829.GA1537@linaro.org \
--to=lina.iyer@linaro.org \
--cc=geert+renesas@glider.be \
--cc=jonathanh@nvidia.com \
--cc=khilman@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--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 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.