From: Maulik Shah <quic_mkshah@quicinc.com>
To: <andersson@kernel.org>, <ulf.hansson@linaro.org>,
<dianders@chromium.org>, <swboyd@chromium.org>,
<wingers@google.com>, <daniel.lezcano@linaro.org>,
<rafael@kernel.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-pm@vger.kernel.org>, <sudeep.holla@arm.com>,
<jwerner@chromium.org>, <quic_lsrao@quicinc.com>,
<quic_rjendra@quicinc.com>, Maulik Shah <quic_mkshah@quicinc.com>,
<stable@vger.kernel.org>
Subject: [RESEND v4 1/3] cpuidle: dt_idle_genpd: Add helper function to remove genpd topology
Date: Mon, 3 Jul 2023 14:25:53 +0530 [thread overview]
Message-ID: <20230703085555.30285-2-quic_mkshah@quicinc.com> (raw)
In-Reply-To: <20230703085555.30285-1-quic_mkshah@quicinc.com>
Genpd parent and child domain topology created using dt_idle_pd_init_topology()
needs to be removed during error cases.
Add new helper function dt_idle_pd_remove_topology() for same.
Cc: stable@vger.kernel.org
Reviewed-by: Ulf Hanssson <ulf.hansson@linaro.org>
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
---
drivers/cpuidle/dt_idle_genpd.c | 24 ++++++++++++++++++++++++
drivers/cpuidle/dt_idle_genpd.h | 7 +++++++
2 files changed, 31 insertions(+)
diff --git a/drivers/cpuidle/dt_idle_genpd.c b/drivers/cpuidle/dt_idle_genpd.c
index b37165514d4e..1af63c189039 100644
--- a/drivers/cpuidle/dt_idle_genpd.c
+++ b/drivers/cpuidle/dt_idle_genpd.c
@@ -152,6 +152,30 @@ int dt_idle_pd_init_topology(struct device_node *np)
return 0;
}
+int dt_idle_pd_remove_topology(struct device_node *np)
+{
+ struct device_node *node;
+ struct of_phandle_args child, parent;
+ int ret;
+
+ for_each_child_of_node(np, node) {
+ if (of_parse_phandle_with_args(node, "power-domains",
+ "#power-domain-cells", 0, &parent))
+ continue;
+
+ child.np = node;
+ child.args_count = 0;
+ ret = of_genpd_remove_subdomain(&parent, &child);
+ of_node_put(parent.np);
+ if (ret) {
+ of_node_put(node);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
struct device *dt_idle_attach_cpu(int cpu, const char *name)
{
struct device *dev;
diff --git a/drivers/cpuidle/dt_idle_genpd.h b/drivers/cpuidle/dt_idle_genpd.h
index a95483d08a02..3be1f70f55b5 100644
--- a/drivers/cpuidle/dt_idle_genpd.h
+++ b/drivers/cpuidle/dt_idle_genpd.h
@@ -14,6 +14,8 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
int dt_idle_pd_init_topology(struct device_node *np);
+int dt_idle_pd_remove_topology(struct device_node *np);
+
struct device *dt_idle_attach_cpu(int cpu, const char *name);
void dt_idle_detach_cpu(struct device *dev);
@@ -36,6 +38,11 @@ static inline int dt_idle_pd_init_topology(struct device_node *np)
return 0;
}
+static inline int dt_idle_pd_remove_topology(struct device_node *np)
+{
+ return 0;
+}
+
static inline struct device *dt_idle_attach_cpu(int cpu, const char *name)
{
return NULL;
--
2.17.1
next prev parent reply other threads:[~2023-07-03 8:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 8:55 [RESEND v4 0/3] Use PSCI OS initiated mode for sc7280 Maulik Shah
2023-07-03 8:55 ` Maulik Shah [this message]
2023-07-03 8:55 ` [RESEND v4 2/3] cpuidle: psci: Move enabling OSI mode after power domains creation Maulik Shah
2023-07-03 8:55 ` [RESEND v4 3/3] arm64: dts: qcom: sc7280: Add power-domains for cpuidle states Maulik Shah
2024-03-14 23:20 ` Doug Anderson
2024-03-14 23:39 ` Abhinav Kumar
2024-03-15 15:07 ` Doug Anderson
2024-03-15 15:24 ` Sudeep Holla
2024-03-15 17:12 ` Doug Anderson
2024-03-15 17:26 ` Sudeep Holla
2024-03-15 17:31 ` Doug Anderson
2023-08-08 14:17 ` [RESEND v4 0/3] Use PSCI OS initiated mode for sc7280 Ulf Hansson
2023-09-14 16:04 ` (subset) " Bjorn Andersson
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=20230703085555.30285-2-quic_mkshah@quicinc.com \
--to=quic_mkshah@quicinc.com \
--cc=andersson@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=dianders@chromium.org \
--cc=jwerner@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=quic_lsrao@quicinc.com \
--cc=quic_rjendra@quicinc.com \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=swboyd@chromium.org \
--cc=ulf.hansson@linaro.org \
--cc=wingers@google.com \
/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
all inboxes | Powered by JetHome®