HID: i2c-hid: use "struct i2c_hid" as argument in most calls
[platform/kernel/linux-starfive.git] / include / linux / irqnr.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_IRQNR_H
3 #define _LINUX_IRQNR_H
4
5 #include <uapi/linux/irqnr.h>
6
7
8 extern int nr_irqs;
9 extern struct irq_desc *irq_to_desc(unsigned int irq);
10 unsigned int irq_get_next_irq(unsigned int offset);
11
12 # define for_each_irq_desc(irq, desc)                                   \
13         for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs;           \
14              irq++, desc = irq_to_desc(irq))                            \
15                 if (!desc)                                              \
16                         ;                                               \
17                 else
18
19
20 # define for_each_irq_desc_reverse(irq, desc)                           \
21         for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0;      \
22              irq--, desc = irq_to_desc(irq))                            \
23                 if (!desc)                                              \
24                         ;                                               \
25                 else
26
27 # define for_each_active_irq(irq)                       \
28         for (irq = irq_get_next_irq(0); irq < nr_irqs;  \
29              irq = irq_get_next_irq(irq + 1))
30
31 #define for_each_irq_nr(irq)                   \
32        for (irq = 0; irq < nr_irqs; irq++)
33
34 #endif