From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Thomas Gleixner <tglx@linutronix.de>,
Marc Zyngier <marc.zyngier@arm.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [PATCH] irq/irq_sim: implement irq_sim_baseirq()
Date: Tue, 26 Sep 2017 19:06:29 +0200 [thread overview]
Message-ID: <20170926170629.32673-1-brgl@bgdev.pl> (raw)
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@bgdev.pl>
---
When porting the iio_dummy_evgen to using irq_sim I needed to manually
calculate the base interrupt number. If this gets merged, I'll update
the iio driver for 4.16.
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 24caabf1a0f7..9438599d0fc9 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -162,3 +162,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
next reply other threads:[~2017-09-26 17:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-26 17:06 Bartosz Golaszewski [this message]
2017-10-05 12:45 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170926170629.32673-1-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=Jonathan.Cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome