Skip to contentSkip to conversation

irqchip/stm32-exti: Use INVALID_HWIRQ definition

PATCH In review Andy Shevchenko 2 participants 3 messages Jul 15, 2022 – Jul 18, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip/stm32-exti: Use INVALID_HWIRQ definition

Use specific definition for invalid IRQ. It makes the code uniform in respect to the constant used for that. No functional change intended.

---
 drivers/irqchip/irq-stm32-exti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-stm32-exti.c +1 -1
index a73763d475f0..a6ae9f38aaf0 100644
@@ -170,7 +170,7 @@ static const struct stm32_exti_bank *stm32mp1_exti_banks[] = {
 static struct irq_chip stm32_exti_h_chip;
 static struct irq_chip stm32_exti_h_chip_direct;
 
-#define EXTI_INVALID_IRQ       U8_MAX
+#define EXTI_INVALID_IRQ       ((u8)INVALID_HWIRQ)
 #define STM32MP1_DESC_IRQ_SIZE (ARRAY_SIZE(stm32mp1_exti_banks) * IRQS_PER_BANK)
 
 static const u8 stm32mp1_desc_irq[] = {
Signature · 1 line
2.35.1
#1 lore raw
Quoted 15 lines · Andy Shevchenko

Use specific definition for invalid IRQ. It makes the code uniform in respect to the constant used for that. No functional change intended.

---
 drivers/irqchip/irq-stm32-exti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-stm32-exti.c +0 -0
index a73763d475f0..a6ae9f38aaf0 100644

drivers/irqchip/irq-stm32-exti.c static const struct stm32_exti_bank *stm32mp1_exti_banks[] = { · line 173

Quoted 5 lines
drivers/irqchip/irq-stm32-exti.c +1 -1
@@ -170,7 +170,7 @@ static const struct stm32_exti_bank *stm32mp1_exti_banks[] = {
 static struct irq_chip stm32_exti_h_chip;
 static struct irq_chip stm32_exti_h_chip_direct;
 
-#define EXTI_INVALID_IRQ       U8_MAX
+#define EXTI_INVALID_IRQ       ((u8)INVALID_HWIRQ)

This looks like a terrible idea. It gives the impression that you can now rely on comparing the internal data structure field to INVALID_HWIRQ. Which is of course bound to fail.

To be honest, I'd rather *kill* INVALID_HWIRQ, because apart from cherryview, nobody even *checks* for this value by that name. So much for the "code uniformity"...

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#2 lore raw
Quoted 6 lines · Marc Zyngier
Quoted 4 lines · Andy Shevchenko

Use specific definition for invalid IRQ. It makes the code uniform in respect to the constant used for that. No functional change intended.

...

Quoted 6 lines

drivers/irqchip/irq-stm32-exti.c static const struct stm32_exti_bank *stm32mp1_exti_banks[] = { · line 173

Quoted 2 lines
drivers/irqchip/irq-stm32-exti.c +1 -1
-#define EXTI_INVALID_IRQ       U8_MAX
+#define EXTI_INVALID_IRQ       ((u8)INVALID_HWIRQ)

This looks like a terrible idea. It gives the impression that you can now rely on comparing the internal data structure field to INVALID_HWIRQ. Which is of course bound to fail.

I don't know how one can go to that conclusion, but okay, I understood you.

Quoted 3 lines

To be honest, I'd rather *kill* INVALID_HWIRQ, because apart from cherryview, nobody even *checks* for this value by that name. So much for the "code uniformity"...

It's used by two or three, I don't remember by heart.

Signature · 2 lines
With Best Regards,
Andy Shevchenko