[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210902101634.827187-3-ulf.hansson@linaro.org>
Date: Thu, 2 Sep 2021 12:16:33 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: "Rafael J . Wysocki" <rjw@...ysocki.net>,
Viresh Kumar <viresh.kumar@...aro.org>,
Dmitry Osipenko <digetx@...il.com>, linux-pm@...r.kernel.org
Cc: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Jonathan Hunter <jonathanh@...dia.com>,
Thierry Reding <thierry.reding@...il.com>,
Rajendra Nayak <rnayak@...eaurora.org>,
Stephan Gerhold <stephan@...hold.net>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Ulf Hansson <ulf.hansson@...aro.org>
Subject: [PATCH 2/3] PM: domains: Restructure some code in __genpd_dev_pm_attach()
To slightly improve readability of the code, but also to prepare for a
subsequent change on top, let's move the code that calls
of_get_required_opp_performance_state() into a new separate function.
Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>
---
drivers/base/power/domain.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 278e040f607f..800adf831cae 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2640,6 +2640,17 @@ static void genpd_dev_pm_sync(struct device *dev)
genpd_queue_power_off_work(pd);
}
+static int genpd_get_default_performance_state(struct device *dev,
+ unsigned int index)
+{
+ int pstate = of_get_required_opp_performance_state(dev->of_node, index);
+
+ if (pstate == -ENODEV || pstate == -EOPNOTSUPP)
+ return 0;
+
+ return pstate;
+}
+
static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
unsigned int index, bool power_on)
{
@@ -2690,8 +2701,8 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
}
/* Set the default performance state */
- pstate = of_get_required_opp_performance_state(dev->of_node, index);
- if (pstate < 0 && pstate != -ENODEV && pstate != -EOPNOTSUPP) {
+ pstate = genpd_get_default_performance_state(dev, index);
+ if (pstate < 0) {
ret = pstate;
goto err;
} else if (pstate > 0) {
--
2.25.1
Powered by blists - more mailing lists