mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
To: Anup Patel <anup@brainfault.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	sanjayembeddedse@gmail.com, virendrasinhchauhan1206@gmail.com
Subject: [PATCH] irqchip/riscv-aplic: adapt to syscore API passing context data
Date: Wed, 24 Dec 2025 16:41:46 +0530	[thread overview]
Message-ID: <6eafdd754222e11a43be4bbc3652f7605d47afa6.1766559840.git.sanjayembeddedse@gmail.com> (raw)

From: Sanjay Chitroda <sanjayembeddedse@gmail.com>

linux-next commit a97fbc3ee3e2 ("syscore: Pass context data to callbacks")
changed the syscore API to register per-instance context alongside the
syscore operations and to pass that context into callbacks. As a result,
drivers must no longer rely on global state or implicit data access in
their syscore suspend/resume handlers.

The RISC-V APLIC driver started preserving state across suspend/resume,
but its syscore usage still assumed the old API. Building against
linux-next after a97fbc3ee3e2 fails because the callbacks don’t receive
the necessary driver context.

Update irq-riscv-aplic to the new syscore API:
  * register syscore with driver-private context,
  * pass the context to save/restore helpers,
  * stop using implicit globals in syscore paths.

This fixes the compilation error and restores correct APLIC state
handling across suspend/resume with the new syscore interface.

Fixes: a97fbc3ee3e2 ("syscore: Pass context data to callbacks")
Fixes: 1c546bb433618843 ("irqchip/riscv-aplic: Preserve APLIC states across suspend/resume")
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
 drivers/irqchip/irq-riscv-aplic-main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
index b760942e57f9..1283d6e69f5b 100644
--- a/drivers/irqchip/irq-riscv-aplic-main.c
+++ b/drivers/irqchip/irq-riscv-aplic-main.c
@@ -89,7 +89,7 @@ static void aplic_save_states(struct aplic_priv *priv)
 	}
 }
 
-static int aplic_syscore_suspend(void)
+static int aplic_syscore_suspend(void *data)
 {
 	struct aplic_priv *priv;
 
@@ -99,7 +99,7 @@ static int aplic_syscore_suspend(void)
 	return 0;
 }
 
-static void aplic_syscore_resume(void)
+static void aplic_syscore_resume(void *data)
 {
 	struct aplic_priv *priv;
 
@@ -107,11 +107,15 @@ static void aplic_syscore_resume(void)
 		aplic_restore_states(priv);
 }
 
-static struct syscore_ops aplic_syscore_ops = {
+static const struct syscore_ops aplic_syscore_ops = {
 	.suspend = aplic_syscore_suspend,
 	.resume = aplic_syscore_resume,
 };
 
+static struct syscore aplic_syscore = {
+	.ops = &aplic_syscore_ops,
+};
+
 static int aplic_pm_notifier(struct notifier_block *nb, unsigned long action, void *data)
 {
 	struct aplic_priv *priv = container_of(nb, struct aplic_priv, genpd_nb);
@@ -372,7 +376,7 @@ static int aplic_probe(struct platform_device *pdev)
 		dev_err_probe(dev, rc, "failed to setup APLIC in %s mode\n",
 			      msi_mode ? "MSI" : "direct");
 	else
-		register_syscore_ops(&aplic_syscore_ops);
+		register_syscore(&aplic_syscore);
 
 #ifdef CONFIG_ACPI
 	if (!acpi_disabled)
-- 
2.34.1


             reply	other threads:[~2025-12-24 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-24 11:11 Sanjay Chitroda [this message]
2026-01-02  9:37 ` Keke Ming
2026-01-03 15:51 ` Anup Patel
2026-01-09 11:51 ` Thomas Gleixner
2026-01-13 14:51   ` Sanjay Embedded_SE

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=6eafdd754222e11a43be4bbc3652f7605d47afa6.1766559840.git.sanjayembeddedse@gmail.com \
    --to=sanjayembeddedse@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=virendrasinhchauhan1206@gmail.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®