genirq: add IRQF_NONE
RFC PATCH 1/1 genirq: add IRQF_NONE
What about adding an IRQF_NONE flag as in the below patch?
I'm currently working on removing the use of the deprecated IRQF_DISABLED flag, and frequently have to replace IRQF_DISABLED by 0, typically in request_irq() arguments.
Using IRQF_NONE instead of 0 would make the code more readable, at least for people reading driver code for the first time.
Would it worth it?
I'm sure this kind of idea has come up many times before...
--- include/linux/interrupt.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/interrupt.h +2 -0
@@ -40,6 +40,7 @@* These flags used only by the kernel as part of the * irq handling routines. * +* IRQF_NONE - No irq flag bit is set. * IRQF_DISABLED - keep irqs disabled when calling the action handler. * DEPRECATED. This flag is a NOOP and scheduled to be removed * IRQF_SHARED - allow sharing the irq among several devices
@@ -59,6 +60,7 @@* IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device * resume time. */ +#define IRQF_NONE 0x00000000#define IRQF_DISABLED 0x00000020#define IRQF_SHARED 0x00000080#define IRQF_PROBE_SHARED 0x00000100
Signature · 1 line
1.8.1.2
Quoted 6 lines · Michael Opdenacker
What about adding an
IRQF_NONEflag as in the below patch?I'm currently working on removing the use of the deprecated
IRQF_DISABLEDflag, and frequently have to replaceIRQF_DISABLEDby 0, typically inrequest_irq()arguments.
Quoted 8 lines
Using
IRQF_NONEinstead of 0 would make the code more readable, at least for people reading driver code for the first time.Would it worth it?
I'm sure this kind of idea has come up many times before...
Signed-off-by Michael Opdenacker <[email protected]>
I don't think it makes sense, no; it's a flags field, meant to receive a set of flags, and 0 is the standard empty set of flags. I think IRQF_NONE would actually reduce readability, especially for readers who haven't seen it before, because it isn't immediately obvious that it just corresponds to the 0 of "no flags". My first guess reading it would be that it's some non-zero flag with some non-obvious semantic, such as "don't actually allocate an IRQ", or something strange like that.
- Josh Triplett
Hi Josh,
Quoted 14 lines · Josh Triplett
Quoted 13 lines · Michael Opdenacker
What about adding an
IRQF_NONEflag as in the below patch?I'm currently working on removing the use of the deprecated
IRQF_DISABLEDflag, and frequently have to replaceIRQF_DISABLEDby 0, typically inrequest_irq()arguments.Using
IRQF_NONEinstead of 0 would make the code more readable, at least for people reading driver code for the first time.Would it worth it?
I'm sure this kind of idea has come up many times before...
Quoted 8 lines
Quoted 1 line
Signed-off-by Michael Opdenacker <[email protected]>I don't think it makes sense, no; it's a flags field, meant to receive a set of flags, and 0 is the standard empty set of flags. I think
IRQF_NONEwould actually reduce readability, especially for readers who haven't seen it before, because it isn't immediately obvious that it just corresponds to the 0 of "no flags". My first guess reading it would be that it's some non-zero flag with some non-obvious semantic, such as "don't actually allocate an IRQ", or something strange like
Thanks for your feedback. It's true that 0 for a flag is clear enough, and that IRQF_NONE will be more confusing.
I was just thinking the IRQF_NONE would make it clearer that the corresponding argument is a flag. This way, people reading "0" wouldn't have to lookup the prototype of request_irq() to know what type of argument this is (flag, number of resources, boolean....)
So, this may be a little helpful for completely new people, but more confusing for people with a little more experience, as you explained.
I agree not to sacrifice the latter.
Thanks again,
Michael.
Signature · 4 lines
Michael Opdenacker, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com +33 484 258 098