Skip to contentSkip to conversation

genirq: Correct fuzzy and fragile IRQ_RETVAL() definition

PATCH New Geert Uytterhoeven 1 participant 1 message Aug 18, 2013 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genirq: Correct fuzzy and fragile IRQ_RETVAL() definition

commit bedd30d986a05e32dc3eab874e4b9ed8a38058bb ("genirq: make irqreturn_t an enum") blindly replaced "0" by "IRQ_NONE" in the "IRQ_RETVAL(x)" macro definition.

However, as "x" is a condition, "0" meant "boolean false", not an irqreturn_t value.

All of this worked, and kept working after the addition of IRQ_WAKE_THREAD, as
- both "boolean false" and "IRQ_NONE" are "0" (for the comparison),
- "boolean true" and "boolean false" nicely map to the correct values of "IRQ_HANDLED" and "IRQ_NONE" (for the return value).

Correct the macro definition for clarity and future-proofness.

---
 include/linux/irqreturn.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/irqreturn.h +1 -1
index 714ba08..e374e36 100644
@@ -14,6 +14,6 @@ enum irqreturn {
 };
 
 typedef enum irqreturn irqreturn_t;
-#define IRQ_RETVAL(x)	((x) != IRQ_NONE)
+#define IRQ_RETVAL(x)	((x) ? IRQ_HANDLED : IRQ_NONE)
 
 #endif
Signature · 1 line
1.7.9.5