[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171005124446.26265-3-brgl@bgdev.pl>
Date: Thu, 5 Oct 2017 14:44:45 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <marc.zyngier@....com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Lars-Peter Clausen <lars@...afoo.de>
Cc: linux-kernel@...r.kernel.org, Bartosz Golaszewski <brgl@...ev.pl>
Subject: [PATCH 2/3] irq/irq_sim: implement irq_sim_baseirq()
Some users need to access the base of the allocated interrupt range.
Although this can be calculated manually, it's more elegant to expose
an interface for that.
Signed-off-by: Bartosz Golaszewski <brgl@...ev.pl>
---
include/linux/irq_sim.h | 1 +
kernel/irq/irq_sim.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/include/linux/irq_sim.h b/include/linux/irq_sim.h
index 0380d899b955..246f593face8 100644
--- a/include/linux/irq_sim.h
+++ b/include/linux/irq_sim.h
@@ -40,5 +40,6 @@ int devm_irq_sim_init(struct device *dev, struct irq_sim *sim,
void irq_sim_fini(struct irq_sim *sim);
void irq_sim_fire(struct irq_sim *sim, unsigned int offset);
int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset);
+int irq_sim_baseirq(struct irq_sim *sim);
#endif /* _LINUX_IRQ_SIM_H */
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index bd7dc1db6a80..1be10d0e295f 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -163,3 +163,14 @@ int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset)
return sim->irqs[offset].irqnum;
}
EXPORT_SYMBOL_GPL(irq_sim_irqnum);
+
+/**
+ * irq_sim_baseirq - Get the base interrupt number.
+ *
+ * @sim: The interrupt simulator object.
+ */
+int irq_sim_baseirq(struct irq_sim *sim)
+{
+ return irq_sim_irqnum(sim, 0);
+}
+EXPORT_SYMBOL_GPL(irq_sim_baseirq);
--
2.13.2
Powered by blists - more mailing lists