[PATCH 1/3] irqchip/gic-v3: Use switch/case statements in gic_cpu_pm_notifier

Florian Fainelli f.fainelli at gmail.com
Tue Feb 14 15:34:24 PST 2023


No functional change, but facilitates adding new states in subsequent
changes.

Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 drivers/irqchip/irq-gic-v3.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index bb57ab8bff6a..b60fadb7eb44 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1374,14 +1374,20 @@ static int gic_retrigger(struct irq_data *data)
 static int gic_cpu_pm_notifier(struct notifier_block *self,
 			       unsigned long cmd, void *v)
 {
-	if (cmd == CPU_PM_EXIT) {
+	switch (cmd) {
+	case CPU_PM_ENTER:
+		if (gic_dist_security_disabled()) {
+			gic_write_grpen1(0);
+			gic_enable_redist(false);
+		}
+		break;
+	case CPU_PM_EXIT:
 		if (gic_dist_security_disabled())
 			gic_enable_redist(true);
 		gic_cpu_sys_reg_init();
-	} else if (cmd == CPU_PM_ENTER && gic_dist_security_disabled()) {
-		gic_write_grpen1(0);
-		gic_enable_redist(false);
+		break;
 	}
+
 	return NOTIFY_OK;
 }
 
-- 
2.34.1




More information about the linux-arm-kernel mailing list