[PATCH 3/4] irqchip/gic: Use GIC_* DT binding definitions
Geert Uytterhoeven
geert+renesas at glider.be
Wed Mar 4 09:21:58 PST 2026
Replace magic numbers by symbolic DT binding definitions. This improves
readability, and makes it easier to find where the various GIC
interrupts types are handled.
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
drivers/irqchip/irq-gic-v3.c | 14 ++++++++------
drivers/irqchip/irq-gic.c | 6 ++++--
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index d75163e71bf22473..6ac103cb40097acc 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -35,6 +35,8 @@
#include <asm/smp_plat.h>
#include <asm/virt.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
#include "irq-gic-common.h"
static u8 dist_prio_irq __ro_after_init = GICV3_PRIO_IRQ;
@@ -1602,25 +1604,25 @@ static int gic_irq_domain_translate(struct irq_domain *d,
return -EINVAL;
switch (fwspec->param[0]) {
- case 0: /* SPI */
+ case GIC_SPI:
if (fwspec->param[1] > 987)
pr_warn_once("SPI %u out of range (use ESPI?)\n",
fwspec->param[1]);
*hwirq = fwspec->param[1] + 32;
break;
- case 1: /* PPI */
+ case GIC_PPI:
if (fwspec->param[1] > 16)
pr_warn_once("PPI %u out of range (use EPPI?)\n",
fwspec->param[1]);
*hwirq = fwspec->param[1] + 16;
break;
- case 2: /* ESPI */
+ case GIC_ESPI:
if (fwspec->param[1] > 1023)
pr_warn_once("ESPI %u out of range\n",
fwspec->param[1]);
*hwirq = fwspec->param[1] + ESPI_BASE_INTID;
break;
- case 3: /* EPPI */
+ case GIC_EPPI:
if (fwspec->param[1] > 63)
pr_warn_once("EPPI %u out of range\n",
fwspec->param[1]);
@@ -1738,8 +1740,8 @@ static int gic_irq_get_fwspec_info(struct irq_fwspec *fwspec, struct irq_fwspec_
struct fwnode_handle *fw;
switch (fwspec->param[0]) {
- case 1: /* PPI */
- case 3: /* EPPI */
+ case GIC_PPI:
+ case GIC_EPPI:
break;
default:
return 0;
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index ec70c84e9f91dd7b..a2225ca1efeb700d 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -47,6 +47,8 @@
#include <asm/smp_plat.h>
#include <asm/virt.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
#include "irq-gic-common.h"
#ifdef CONFIG_ARM64
@@ -1094,10 +1096,10 @@ static int gic_irq_domain_translate(struct irq_domain *d,
return -EINVAL;
switch (fwspec->param[0]) {
- case 0: /* SPI */
+ case GIC_SPI:
*hwirq = fwspec->param[1] + 32;
break;
- case 1: /* PPI */
+ case GIC_PPI:
*hwirq = fwspec->param[1] + 16;
break;
default:
--
2.43.0
More information about the Linux-mediatek
mailing list