summaryrefslogtreecommitdiffstats
path: root/kernel/irq/irq_sim.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2019-02-18 17:32:03 +0100
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2019-02-19 17:42:28 +0100
commit8d91ecc84d1b177d9bcce6ce8e82c64347ceac9d (patch)
tree9070e8197d26c5f4ec8dcc3e5ded5116199a2843 /kernel/irq/irq_sim.c
parentgpio: altera-a10sr: Trivial coding style fix (diff)
downloadlinux-8d91ecc84d1b177d9bcce6ce8e82c64347ceac9d.tar.xz
linux-8d91ecc84d1b177d9bcce6ce8e82c64347ceac9d.zip
irq/irq_sim: add irq_set_type() callback
Implement the irq_set_type() callback and call irqd_set_trigger_type() internally so that users interested in the configured trigger type can later retrieve it using irqd_get_trigger_type(). We only support edge trigger types. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'kernel/irq/irq_sim.c')
-rw-r--r--kernel/irq/irq_sim.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index 98a20e1594ce..b992f88c5613 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -25,10 +25,22 @@ static void irq_sim_irqunmask(struct irq_data *data)
irq_ctx->enabled = true;
}
+static int irq_sim_set_type(struct irq_data *data, unsigned int type)
+{
+ /* We only support rising and falling edge trigger types. */
+ if (type & ~IRQ_TYPE_EDGE_BOTH)
+ return -EINVAL;
+
+ irqd_set_trigger_type(data, type);
+
+ return 0;
+}
+
static struct irq_chip irq_sim_irqchip = {
.name = "irq_sim",
.irq_mask = irq_sim_irqmask,
.irq_unmask = irq_sim_irqunmask,
+ .irq_set_type = irq_sim_set_type,
};
static void irq_sim_handle_irq(struct irq_work *work)