lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171005124446.26265-4-brgl@bgdev.pl>
Date:   Thu,  5 Oct 2017 14:44:46 +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 3/3] irq/irq_sim: implement irq_sim_irq2offset()

Add a routine allowing to retrieve the offset corresponding with an
allocated interrupt number from an irq_sim object.

Signed-off-by: Bartosz Golaszewski <brgl@...ev.pl>
---
 include/linux/irq_sim.h |  1 +
 kernel/irq/irq_sim.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/linux/irq_sim.h b/include/linux/irq_sim.h
index 246f593face8..e9768ca81e3e 100644
--- a/include/linux/irq_sim.h
+++ b/include/linux/irq_sim.h
@@ -41,5 +41,6 @@ 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);
+unsigned int irq_sim_irq2offset(struct irq_sim *sim, int irq);
 
 #endif /* _LINUX_IRQ_SIM_H */
diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c
index 1be10d0e295f..9a9a1bc8853c 100644
--- a/kernel/irq/irq_sim.c
+++ b/kernel/irq/irq_sim.c
@@ -174,3 +174,18 @@ int irq_sim_baseirq(struct irq_sim *sim)
 	return irq_sim_irqnum(sim, 0);
 }
 EXPORT_SYMBOL_GPL(irq_sim_baseirq);
+
+/**
+ * irq_sim_irq2offset - Get the offset of an allocated interrupt.
+ *
+ * @sim:        The interrupt simulator object.
+ * irq:         Allocated interrupt number.
+ *
+ * Perform a reverse lookup for the interrupt number and return its offset in
+ * the array allocated by sim_irq.
+ */
+unsigned int irq_sim_irq2offset(struct irq_sim *sim, int irq)
+{
+	return irq - sim->irq_base;
+}
+EXPORT_SYMBOL_GPL(irq_sim_irq2offset);
-- 
2.13.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ