Skip to content

Commit

Permalink
genirq: Correct fuzzy and fragile IRQ_RETVAL() definition
Browse files Browse the repository at this point in the history
commit bedd30d ("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.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Geert Uytterhoeven authored and Thomas Gleixner committed Nov 19, 2013
1 parent 00d1a39 commit 6bab2c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/irqreturn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6bab2c6

Please sign in to comment.