From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>, linux-pm@vger.kernel.org
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jon Hunter <jonathanh@nvidia.com>,
Rajendra Nayak <rnayak@codeaurora.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Niklas Cassel <niklas.cassel@linaro.org>,
Kevin Hilman <khilman@kernel.org>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain
Date: Thu, 18 Apr 2019 12:27:57 +0200 [thread overview]
Message-ID: <20190418102757.1246-4-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20190418102757.1246-1-ulf.hansson@linaro.org>
If a call to dev_pm_domain_attach() succeeds to attach a device to its
single PM domain, the important point is to prevent following calls to
dev_pm_domain_attach_by_name|id() to fail. This is managed by checking the
dev->pm_domain pointer and then return -EEXIST, rather than continue
calling genpd_dev_pm_attach_by_id|name().
For this reason, let's enable genpd_dev_pm_attach_by_id|name() to be used
for also single PM domains. This simplifies for future users to solely make
use of dev_pm_domain_attach_by_id|name() rather than having to combine it
with dev_pm_domain_attach().
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/base/power/domain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 801f31c87d16..1b026704a8fc 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2512,10 +2512,10 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
if (!dev->of_node)
return NULL;
- /* Deal only with devices using multiple PM domains. */
+ /* Verify that the index is within a valid range. */
num_domains = of_count_phandle_with_args(dev->of_node, "power-domains",
"#power-domain-cells");
- if (num_domains < 2 || index >= num_domains)
+ if (index >= num_domains)
return NULL;
/* Allocate and register device on the genpd bus. */
--
2.17.1
next prev parent reply other threads:[~2019-04-18 10:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 10:27 [PATCH 0/3] PM / Domains: Improve support for multi PM domains Ulf Hansson
2019-04-18 10:27 ` Ulf Hansson
2019-04-18 10:27 ` [PATCH 1/3] PM / Domains: Don't kfree() the virtual device in the error path Ulf Hansson
2019-04-18 10:27 ` Ulf Hansson
2019-04-22 8:27 ` Viresh Kumar
2019-04-22 8:27 ` Viresh Kumar
2019-04-24 11:28 ` Niklas Cassel
2019-04-24 11:28 ` Niklas Cassel
2019-04-18 10:27 ` [PATCH 2/3] PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev() Ulf Hansson
2019-04-18 10:27 ` Ulf Hansson
2019-04-22 8:29 ` Viresh Kumar
2019-04-22 8:29 ` Viresh Kumar
2019-04-24 11:28 ` Niklas Cassel
2019-04-24 11:28 ` Niklas Cassel
2019-04-18 10:27 ` Ulf Hansson [this message]
2019-04-18 10:27 ` [PATCH 3/3] PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain Ulf Hansson
2019-04-22 8:31 ` Viresh Kumar
2019-04-22 8:31 ` Viresh Kumar
2019-04-24 11:28 ` Niklas Cassel
2019-04-24 11:28 ` Niklas Cassel
2019-05-01 10:25 ` [PATCH 0/3] PM / Domains: Improve support for multi PM domains Rafael J. Wysocki
2019-05-01 10:25 ` 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=20190418102757.1246-4-ulf.hansson@linaro.org \
--to=ulf.hansson@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=niklas.cassel@linaro.org \
--cc=rjw@rjwysocki.net \
--cc=rnayak@codeaurora.org \
--cc=viresh.kumar@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