Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [PATCH 4/5] genirq: Use the common function irq_expand_nr_irqs() | Date | Tue, 31 Jan 2023 10:35:23 +0100 |
| |
On Sun, Jan 29 2023 at 18:57, Shanker Donthineni wrote:
> Subject: genirq: Use the common function ...
genirq: Unify irq_expand_nr_irqs()
irq_expand_nr_irqs() is implemented as a stub function for !SPARSEIRQ builds. That's not necessary as the SPARSEIRQ version returns -ENOMEM correctly even for the !SPARSEIRQ case as the ....
But this common function is non-obvious for the !SPARSEIRQ case. It at least needs a comment
> +static int irq_expand_nr_irqs(unsigned int nr) > +{ > + if (nr > MAX_SPARSE_IRQS) > + return -ENOMEM; > + nr_irqs = nr; > + return 0; > +}
or preferrably something like this:
if (!IS_ENABLED(CONFIG_SPARSEIRQ) || nr > MAX_SPARSE_IRQS) return -ENOMEM;
which makes it entirely clear and also allows the compiler to optimize is down to a 'return -ENOMEM'.
Thanks,
tglx
| |