All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lina Iyer <ilina@codeaurora.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Saravana Kannan <saravanak@google.com>,
	linux-pm@vger.kernel.org,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Benjamin Gaignard <benjamin.gaignard@st.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/5] cpuidle: psci: Convert PM domain to platform driver
Date: Tue, 23 Jun 2020 11:21:56 -0600	[thread overview]
Message-ID: <20200623172156.GA16960@codeaurora.org> (raw)
In-Reply-To: <20200615152054.6819-5-ulf.hansson@linaro.org>

On Mon, Jun 15 2020 at 09:21 -0600, Ulf Hansson wrote:
>To enable support for deferred probing and to allow implementation of the
>->sync_state() callback from subsequent changes, let's convert into a
>platform driver.
>
>Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lina Iyer <ilina@codeaurora.org>

>---
> drivers/cpuidle/cpuidle-psci-domain.c | 45 +++++++++++++++++----------
> 1 file changed, 28 insertions(+), 17 deletions(-)
>
>diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
>index e48e578aaa7d..bf527d2bb4b6 100644
>--- a/drivers/cpuidle/cpuidle-psci-domain.c
>+++ b/drivers/cpuidle/cpuidle-psci-domain.c
>@@ -12,6 +12,7 @@
> #include <linux/cpu.h>
> #include <linux/device.h>
> #include <linux/kernel.h>
>+#include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> #include <linux/pm_runtime.h>
> #include <linux/psci.h>
>@@ -42,8 +43,8 @@ static int psci_pd_power_off(struct generic_pm_domain *pd)
> 	return 0;
> }
>
>-static int __init psci_pd_parse_state_nodes(struct genpd_power_state *states,
>-					int state_count)
>+static int psci_pd_parse_state_nodes(struct genpd_power_state *states,
>+				     int state_count)
> {
> 	int i, ret;
> 	u32 psci_state, *psci_state_buf;
>@@ -72,7 +73,7 @@ static int __init psci_pd_parse_state_nodes(struct genpd_power_state *states,
> 	return ret;
> }
>
>-static int __init psci_pd_parse_states(struct device_node *np,
>+static int psci_pd_parse_states(struct device_node *np,
> 			struct genpd_power_state **states, int *state_count)
> {
> 	int ret;
>@@ -100,7 +101,7 @@ static void psci_pd_free_states(struct genpd_power_state *states,
> 	kfree(states);
> }
>
>-static int __init psci_pd_init(struct device_node *np)
>+static int psci_pd_init(struct device_node *np)
> {
> 	struct generic_pm_domain *pd;
> 	struct psci_pd_provider *pd_provider;
>@@ -167,7 +168,7 @@ static int __init psci_pd_init(struct device_node *np)
> 	return ret;
> }
>
>-static void __init psci_pd_remove(void)
>+static void psci_pd_remove(void)
> {
> 	struct psci_pd_provider *pd_provider, *it;
> 	struct generic_pm_domain *genpd;
>@@ -185,7 +186,7 @@ static void __init psci_pd_remove(void)
> 	}
> }
>
>-static int __init psci_pd_init_topology(struct device_node *np, bool add)
>+static int psci_pd_init_topology(struct device_node *np, bool add)
> {
> 	struct device_node *node;
> 	struct of_phandle_args child, parent;
>@@ -211,24 +212,24 @@ static int __init psci_pd_init_topology(struct device_node *np, bool add)
> 	return 0;
> }
>
>-static int __init psci_pd_add_topology(struct device_node *np)
>+static int psci_pd_add_topology(struct device_node *np)
> {
> 	return psci_pd_init_topology(np, true);
> }
>
>-static void __init psci_pd_remove_topology(struct device_node *np)
>+static void psci_pd_remove_topology(struct device_node *np)
> {
> 	psci_pd_init_topology(np, false);
> }
>
>-static const struct of_device_id psci_of_match[] __initconst = {
>+static const struct of_device_id psci_of_match[] = {
> 	{ .compatible = "arm,psci-1.0" },
> 	{}
> };
>
>-static int __init psci_idle_init_domains(void)
>+static int psci_cpuidle_domain_probe(struct platform_device *pdev)
> {
>-	struct device_node *np = of_find_matching_node(NULL, psci_of_match);
>+	struct device_node *np = pdev->dev.of_node;
> 	struct device_node *node;
> 	int ret = 0, pd_count = 0;
>
>@@ -237,7 +238,7 @@ static int __init psci_idle_init_domains(void)
>
> 	/* Currently limit the hierarchical topology to be used in OSI mode. */
> 	if (!psci_has_osi_support())
>-		goto out;
>+		return 0;
>
> 	/*
> 	 * Parse child nodes for the "#power-domain-cells" property and
>@@ -256,7 +257,7 @@ static int __init psci_idle_init_domains(void)
>
> 	/* Bail out if not using the hierarchical CPU topology. */
> 	if (!pd_count)
>-		goto out;
>+		return 0;
>
> 	/* Link genpd masters/subdomains to model the CPU topology. */
> 	ret = psci_pd_add_topology(np);
>@@ -271,9 +272,8 @@ static int __init psci_idle_init_domains(void)
> 		goto remove_pd;
> 	}
>
>-	of_node_put(np);
> 	pr_info("Initialized CPU PM domain topology\n");
>-	return pd_count;
>+	return 0;
>
> put_node:
> 	of_node_put(node);
>@@ -281,10 +281,21 @@ static int __init psci_idle_init_domains(void)
> 	if (pd_count)
> 		psci_pd_remove();
> 	pr_err("failed to create CPU PM domains ret=%d\n", ret);
>-out:
>-	of_node_put(np);
> 	return ret;
> }
>+
>+static struct platform_driver psci_cpuidle_domain_driver = {
>+	.probe  = psci_cpuidle_domain_probe,
>+	.driver = {
>+		.name = "psci-cpuidle-domain",
>+		.of_match_table = psci_of_match,
>+	},
>+};
>+
>+static int __init psci_idle_init_domains(void)
>+{
>+	return platform_driver_register(&psci_cpuidle_domain_driver);
>+}
> subsys_initcall(psci_idle_init_domains);
>
> struct device *psci_dt_attach_cpu(int cpu)
>-- 
>2.20.1
>

WARNING: multiple messages have this Message-ID (diff)
From: Lina Iyer <ilina@codeaurora.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Benjamin Gaignard <benjamin.gaignard@st.com>,
	Saravana Kannan <saravanak@google.com>,
	linux-pm@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/5] cpuidle: psci: Convert PM domain to platform driver
Date: Tue, 23 Jun 2020 11:21:56 -0600	[thread overview]
Message-ID: <20200623172156.GA16960@codeaurora.org> (raw)
In-Reply-To: <20200615152054.6819-5-ulf.hansson@linaro.org>

On Mon, Jun 15 2020 at 09:21 -0600, Ulf Hansson wrote:
>To enable support for deferred probing and to allow implementation of the
>->sync_state() callback from subsequent changes, let's convert into a
>platform driver.
>
>Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lina Iyer <ilina@codeaurora.org>

>---
> drivers/cpuidle/cpuidle-psci-domain.c | 45 +++++++++++++++++----------
> 1 file changed, 28 insertions(+), 17 deletions(-)
>
>diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
>index e48e578aaa7d..bf527d2bb4b6 100644
>--- a/drivers/cpuidle/cpuidle-psci-domain.c
>+++ b/drivers/cpuidle/cpuidle-psci-domain.c
>@@ -12,6 +12,7 @@
> #include <linux/cpu.h>
> #include <linux/device.h>
> #include <linux/kernel.h>
>+#include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> #include <linux/pm_runtime.h>
> #include <linux/psci.h>
>@@ -42,8 +43,8 @@ static int psci_pd_power_off(struct generic_pm_domain *pd)
> 	return 0;
> }
>
>-static int __init psci_pd_parse_state_nodes(struct genpd_power_state *states,
>-					int state_count)
>+static int psci_pd_parse_state_nodes(struct genpd_power_state *states,
>+				     int state_count)
> {
> 	int i, ret;
> 	u32 psci_state, *psci_state_buf;
>@@ -72,7 +73,7 @@ static int __init psci_pd_parse_state_nodes(struct genpd_power_state *states,
> 	return ret;
> }
>
>-static int __init psci_pd_parse_states(struct device_node *np,
>+static int psci_pd_parse_states(struct device_node *np,
> 			struct genpd_power_state **states, int *state_count)
> {
> 	int ret;
>@@ -100,7 +101,7 @@ static void psci_pd_free_states(struct genpd_power_state *states,
> 	kfree(states);
> }
>
>-static int __init psci_pd_init(struct device_node *np)
>+static int psci_pd_init(struct device_node *np)
> {
> 	struct generic_pm_domain *pd;
> 	struct psci_pd_provider *pd_provider;
>@@ -167,7 +168,7 @@ static int __init psci_pd_init(struct device_node *np)
> 	return ret;
> }
>
>-static void __init psci_pd_remove(void)
>+static void psci_pd_remove(void)
> {
> 	struct psci_pd_provider *pd_provider, *it;
> 	struct generic_pm_domain *genpd;
>@@ -185,7 +186,7 @@ static void __init psci_pd_remove(void)
> 	}
> }
>
>-static int __init psci_pd_init_topology(struct device_node *np, bool add)
>+static int psci_pd_init_topology(struct device_node *np, bool add)
> {
> 	struct device_node *node;
> 	struct of_phandle_args child, parent;
>@@ -211,24 +212,24 @@ static int __init psci_pd_init_topology(struct device_node *np, bool add)
> 	return 0;
> }
>
>-static int __init psci_pd_add_topology(struct device_node *np)
>+static int psci_pd_add_topology(struct device_node *np)
> {
> 	return psci_pd_init_topology(np, true);
> }
>
>-static void __init psci_pd_remove_topology(struct device_node *np)
>+static void psci_pd_remove_topology(struct device_node *np)
> {
> 	psci_pd_init_topology(np, false);
> }
>
>-static const struct of_device_id psci_of_match[] __initconst = {
>+static const struct of_device_id psci_of_match[] = {
> 	{ .compatible = "arm,psci-1.0" },
> 	{}
> };
>
>-static int __init psci_idle_init_domains(void)
>+static int psci_cpuidle_domain_probe(struct platform_device *pdev)
> {
>-	struct device_node *np = of_find_matching_node(NULL, psci_of_match);
>+	struct device_node *np = pdev->dev.of_node;
> 	struct device_node *node;
> 	int ret = 0, pd_count = 0;
>
>@@ -237,7 +238,7 @@ static int __init psci_idle_init_domains(void)
>
> 	/* Currently limit the hierarchical topology to be used in OSI mode. */
> 	if (!psci_has_osi_support())
>-		goto out;
>+		return 0;
>
> 	/*
> 	 * Parse child nodes for the "#power-domain-cells" property and
>@@ -256,7 +257,7 @@ static int __init psci_idle_init_domains(void)
>
> 	/* Bail out if not using the hierarchical CPU topology. */
> 	if (!pd_count)
>-		goto out;
>+		return 0;
>
> 	/* Link genpd masters/subdomains to model the CPU topology. */
> 	ret = psci_pd_add_topology(np);
>@@ -271,9 +272,8 @@ static int __init psci_idle_init_domains(void)
> 		goto remove_pd;
> 	}
>
>-	of_node_put(np);
> 	pr_info("Initialized CPU PM domain topology\n");
>-	return pd_count;
>+	return 0;
>
> put_node:
> 	of_node_put(node);
>@@ -281,10 +281,21 @@ static int __init psci_idle_init_domains(void)
> 	if (pd_count)
> 		psci_pd_remove();
> 	pr_err("failed to create CPU PM domains ret=%d\n", ret);
>-out:
>-	of_node_put(np);
> 	return ret;
> }
>+
>+static struct platform_driver psci_cpuidle_domain_driver = {
>+	.probe  = psci_cpuidle_domain_probe,
>+	.driver = {
>+		.name = "psci-cpuidle-domain",
>+		.of_match_table = psci_of_match,
>+	},
>+};
>+
>+static int __init psci_idle_init_domains(void)
>+{
>+	return platform_driver_register(&psci_cpuidle_domain_driver);
>+}
> subsys_initcall(psci_idle_init_domains);
>
> struct device *psci_dt_attach_cpu(int cpu)
>-- 
>2.20.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-06-23 17:22 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 15:20 [PATCH 0/5] cpuidle: psci: Various improvements for PSCI PM domains Ulf Hansson
2020-06-15 15:20 ` Ulf Hansson
2020-06-15 15:20 ` [PATCH 1/5] cpuidle: psci: Fail cpuidle registration if set OSI mode failed Ulf Hansson
2020-06-15 15:20   ` Ulf Hansson
2020-06-18 18:01   ` Lina Iyer
2020-06-18 18:01     ` Lina Iyer
2020-06-26 14:33   ` Sudeep Holla
2020-06-26 14:33     ` Sudeep Holla
2020-06-26 14:47     ` Sudeep Holla
2020-06-26 14:47       ` Sudeep Holla
2020-06-15 15:20 ` [PATCH 2/5] cpuidle: psci: Fix error path via converting to a platform driver Ulf Hansson
2020-06-15 15:20   ` Ulf Hansson
2020-06-26 14:42   ` Sudeep Holla
2020-06-26 14:42     ` Sudeep Holla
2020-06-26 23:06     ` Ulf Hansson
2020-06-26 23:06       ` Ulf Hansson
2020-06-15 15:20 ` [PATCH 3/5] cpuidle: psci: Split into two separate build objects Ulf Hansson
2020-06-15 15:20   ` Ulf Hansson
2020-06-18 18:02   ` Lina Iyer
2020-06-18 18:02     ` Lina Iyer
2020-06-26 14:44   ` Sudeep Holla
2020-06-26 14:44     ` Sudeep Holla
2020-06-15 15:20 ` [PATCH 4/5] cpuidle: psci: Convert PM domain to platform driver Ulf Hansson
2020-06-15 15:20   ` Ulf Hansson
2020-06-23 17:21   ` Lina Iyer [this message]
2020-06-23 17:21     ` Lina Iyer
2020-06-15 15:20 ` [PATCH 5/5] cpuidle: psci: Prevent domain idlestates until consumers are ready Ulf Hansson
2020-06-15 15:20   ` Ulf Hansson
2020-06-15 18:05   ` Saravana Kannan
2020-06-15 18:05     ` Saravana Kannan
2020-06-16  6:49     ` Ulf Hansson
2020-06-16  6:49       ` Ulf Hansson
2020-06-16  7:05       ` Saravana Kannan
2020-06-16  7:05         ` Saravana Kannan
2020-06-24  9:57 ` [PATCH 0/5] cpuidle: psci: Various improvements for PSCI PM domains Ulf Hansson
2020-06-24  9:57   ` Ulf Hansson
2020-06-30 10:23 ` Lukasz Luba
2020-06-30 10:23   ` Lukasz Luba
2020-07-07 11:53   ` Ulf Hansson
2020-07-07 11:53     ` Ulf Hansson
2020-07-07 12:37     ` Lukasz Luba
2020-07-07 12:37       ` Lukasz Luba
2020-07-07 12:51       ` Ulf Hansson
2020-07-07 12:51         ` Ulf Hansson
2020-07-07 13:26         ` Lukasz Luba
2020-07-07 13:26           ` Lukasz Luba

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=20200623172156.GA16960@codeaurora.org \
    --to=ilina@codeaurora.org \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=benjamin.gaignard@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=saravanak@google.com \
    --cc=sboyd@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vincent.guittot@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.