Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / include / linux / irq_sim.h
blob0380d899b9556c6a3331639f0439fba3c1429c15
1 #ifndef _LINUX_IRQ_SIM_H
2 #define _LINUX_IRQ_SIM_H
3 /*
4 * Copyright (C) 2017 Bartosz Golaszewski <brgl@bgdev.pl>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
12 #include <linux/irq_work.h>
13 #include <linux/device.h>
16 * Provides a framework for allocating simulated interrupts which can be
17 * requested like normal irqs and enqueued from process context.
20 struct irq_sim_work_ctx {
21 struct irq_work work;
22 int irq;
25 struct irq_sim_irq_ctx {
26 int irqnum;
27 bool enabled;
30 struct irq_sim {
31 struct irq_sim_work_ctx work_ctx;
32 int irq_base;
33 unsigned int irq_count;
34 struct irq_sim_irq_ctx *irqs;
37 int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs);
38 int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
39 unsigned int num_irqs);
40 void irq_sim_fini(struct irq_sim *sim);
41 void irq_sim_fire(struct irq_sim *sim, unsigned int offset);
42 int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset);
44 #endif /* _LINUX_IRQ_SIM_H */