linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Gondois <pierre.gondois@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Pierre Gondois <pierre.gondois@arm.com>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>,
	Michal Simek <michal.simek@xilinx.com>,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] driver: soc: xilinx: Save cpuhp dynamic state
Date: Wed, 14 Sep 2022 18:28:14 +0200	[thread overview]
Message-ID: <20220914162815.1954866-2-pierre.gondois@arm.com> (raw)
In-Reply-To: <20220914162815.1954866-1-pierre.gondois@arm.com>

Requesting a CPUHP_AP_ONLINE_DYN cpuhp state reserves a state
among the range [CPUHP_AP_ONLINE_DYN:CPUHP_AP_ONLINE_DYN_END].
The reserved state must be saved in order to remove it later.

Cf. __cpuhp_setup_state_cpuslocked() documentation:
Return:
  On success:
    Positive state number if @state is CPUHP_AP_ONLINE_DYN;
    0 for all other states

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 drivers/soc/xilinx/xlnx_event_manager.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c
index 5dcb7665fe22..be67f74f3b5c 100644
--- a/drivers/soc/xilinx/xlnx_event_manager.c
+++ b/drivers/soc/xilinx/xlnx_event_manager.c
@@ -24,6 +24,8 @@ static DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number1);
 static int virq_sgi;
 static int event_manager_availability = -EACCES;
 
+static int cpuhp_event_state;
+
 /* SGI number used for Event management driver */
 #define XLNX_EVENT_SGI_NUM	(15)
 
@@ -609,7 +611,10 @@ static void xlnx_event_cleanup_sgi(struct platform_device *pdev)
 
 	per_cpu(cpu_number1, cpu) = cpu;
 
-	cpuhp_remove_state(CPUHP_AP_ONLINE_DYN);
+	if (cpuhp_event_state > 0) {
+		cpuhp_remove_state(cpuhp_event_state);
+		cpuhp_event_state = 0;
+	}
 
 	on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
 
@@ -644,8 +649,11 @@ static int xlnx_event_manager_probe(struct platform_device *pdev)
 	}
 
 	/* Setup function for the CPU hot-plug cases */
-	cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting",
+	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting",
 			  xlnx_event_cpuhp_start, xlnx_event_cpuhp_down);
+	if (ret > 0)
+		cpuhp_event_state = ret;
+
 
 	ret = zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_REGISTER_SGI, sgi_num,
 				  0, NULL);
-- 
2.25.1


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

  reply	other threads:[~2022-09-14 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 16:28 [PATCH 0/2] Save cpuhp dynamic state Pierre Gondois
2022-09-14 16:28 ` Pierre Gondois [this message]
2022-09-14 16:28 ` [PATCH 2/2] powercap/drivers/dtpm: " Pierre Gondois
2022-10-06  7:54 ` [PATCH 0/2] " Pierre Gondois
2023-02-01 16:20   ` Pierre Gondois

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=20220914162815.1954866-2-pierre.gondois@arm.com \
    --to=pierre.gondois@arm.com \
    --cc=abhyuday.godhasara@xilinx.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=rafael@kernel.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;
as well as URLs for NNTP newsgroup(s).