blob: 50c39dcd2cba117ac611b8a8011e4cdfebcde498 [file] [log] [blame]
Christoph Hellwig511cbce2015-11-10 14:56:14 +01001#ifndef IRQ_POLL_H
2#define IRQ_POLL_H
3
4struct irq_poll;
5typedef int (irq_poll_fn)(struct irq_poll *, int);
6
7struct irq_poll {
8 struct list_head list;
9 unsigned long state;
10 unsigned long data;
11 int weight;
12 int max;
13 irq_poll_fn *poll;
14};
15
16enum {
17 IRQ_POLL_F_SCHED = 0,
18 IRQ_POLL_F_DISABLE = 1,
19};
20
21/*
22 * Returns 0 if we successfully set the IRQ_POLL_F_SCHED bit, indicating
23 * that we were the first to acquire this iop for scheduling. If this iop
24 * is currently disabled, return "failure".
25 */
26static inline int irq_poll_sched_prep(struct irq_poll *iop)
27{
28 if (!test_bit(IRQ_POLL_F_DISABLE, &iop->state))
29 return test_and_set_bit(IRQ_POLL_F_SCHED, &iop->state);
30
31 return 1;
32}
33
34static inline int irq_poll_disable_pending(struct irq_poll *iop)
35{
36 return test_bit(IRQ_POLL_F_DISABLE, &iop->state);
37}
38
39extern void irq_poll_sched(struct irq_poll *);
40extern void irq_poll_init(struct irq_poll *, int, irq_poll_fn *);
41extern void irq_poll_complete(struct irq_poll *);
42extern void __irq_poll_complete(struct irq_poll *);
43extern void irq_poll_enable(struct irq_poll *);
44extern void irq_poll_disable(struct irq_poll *);
45
46#endif