mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Murzin <vladimir.murzin@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, radu@rendec.net, tglx@kernel.org,
	lpieralisi@kernel.org, maz@kernel.org
Subject: [PATCH v2] irqchip/gic-v5: Rename gicv5_hwirq_init() to gicv5_hwirq_set_priority()
Date: Thu,  3 Dec 2026 13:43:19 +0000	[thread overview]
Message-ID: <20261203134319.126071-1-vladimir.murzin@arm.com> (raw)

Since commit a1ee1a1ca75b ("irqchip/gic-v5: Defer default SPI and LPI
IAFFID programming"), gicv5_hwirq_init() only sets the interrupt
priority. Rename it to reflect its actual functionality.

Once here add compile time check to prevent accidental misuse.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Marc Zyngier <maz@kernel.org>
---

Changelog:

 v1 -> v2
    - Turned runtime check into compile time check (Lorenzo)
    - Added tags, yet please shout if I should have not done that (Marc)
    - Updated commit message about added check.

 drivers/irqchip/irq-gic-v5.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v5.c b/drivers/irqchip/irq-gic-v5.c
index 8c0303af71e7..f51e94f041ae 100644
--- a/drivers/irqchip/irq-gic-v5.c
+++ b/drivers/irqchip/irq-gic-v5.c
@@ -85,16 +85,17 @@ static void gicv5_ppi_priority_init(void)
 	isb();
 }
 
-static void gicv5_hwirq_init(irq_hw_number_t hwirq, u8 priority, u8 hwirq_type)
+static __always_inline void gicv5_hwirq_set_priority(irq_hw_number_t hwirq, u8 priority, u8 hwirq_type)
 {
 	u64 cdpri;
 
-	if (hwirq_type == GICV5_HWIRQ_TYPE_LPI || hwirq_type == GICV5_HWIRQ_TYPE_SPI) {
-		cdpri = FIELD_PREP(GICV5_GIC_CDPRI_PRIORITY_MASK, priority)	|
-			FIELD_PREP(GICV5_GIC_CDPRI_TYPE_MASK, hwirq_type)	|
-			FIELD_PREP(GICV5_GIC_CDPRI_ID_MASK, hwirq);
-		gic_insn(cdpri, CDPRI);
-	}
+	BUILD_BUG_ON(hwirq_type != GICV5_HWIRQ_TYPE_LPI && hwirq_type != GICV5_HWIRQ_TYPE_SPI);
+
+	cdpri = FIELD_PREP(GICV5_GIC_CDPRI_PRIORITY_MASK, priority)	|
+		FIELD_PREP(GICV5_GIC_CDPRI_TYPE_MASK, hwirq_type)	|
+		FIELD_PREP(GICV5_GIC_CDPRI_ID_MASK, hwirq);
+
+	gic_insn(cdpri, CDPRI);
 }
 
 static void gicv5_ppi_irq_mask(struct irq_data *d)
@@ -733,7 +734,7 @@ static int gicv5_irq_spi_domain_alloc(struct irq_domain *domain, unsigned int vi
 	irq_set_probe(virq);
 	irqd_set_single_target(irqd);
 
-	gicv5_hwirq_init(hwirq, GICV5_IRQ_PRI_MI, GICV5_HWIRQ_TYPE_SPI);
+	gicv5_hwirq_set_priority(hwirq, GICV5_IRQ_PRI_MI, GICV5_HWIRQ_TYPE_SPI);
 
 	return 0;
 }
@@ -824,7 +825,7 @@ static int gicv5_irq_lpi_domain_alloc(struct irq_domain *domain, unsigned int vi
 				    NULL, handle_fasteoi_irq, NULL, NULL);
 		irqd_set_single_target(irqd);
 
-		gicv5_hwirq_init(hwirq, GICV5_IRQ_PRI_MI, GICV5_HWIRQ_TYPE_LPI);
+		gicv5_hwirq_set_priority(hwirq, GICV5_IRQ_PRI_MI, GICV5_HWIRQ_TYPE_LPI);
 		gicv5_lpi_config_reset(irqd);
 	}
 
-- 
2.34.1


             reply	other threads:[~2026-12-03 13:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 13:43 Vladimir Murzin [this message]
2026-12-04 11:13 ` Lorenzo Pieralisi
2026-12-04 20:02 ` [tip: irq/drivers] " tip-bot2 for Vladimir Murzin

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=20261203134319.126071-1-vladimir.murzin@arm.com \
    --to=vladimir.murzin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=maz@kernel.org \
    --cc=radu@rendec.net \
    --cc=tglx@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

all inboxes | Powered by JetHome®