[PATCH V4 1/6] regmap: irq: add apis to unmap the mapped irq

From: Laxman Dewangan
Date: Sat Feb 06 2016 - 09:49:22 EST


Before removing irq domains, it is require to unmap all
mapped interrupt from that domain. Currently there is API
to map the interrupt on chip as regmap_irq_get_virq() for
creating mapping. Add equivalent API to dispose the mapped
irq in irq domains.

Signed-off-by: Laxman Dewangan <ldewangan@xxxxxxxxxx>
CC: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
CC: Javier Martinez Canillas <javier@xxxxxxxxxxxxxxx>

---
This is new in the series which was identified when testing V3
series that it is require to unmap virq before deleting irq chip
domain. Adding this APIs in regmap irq framework.

drivers/base/regmap/regmap-irq.c | 14 ++++++++++++++
include/linux/regmap.h | 1 +
2 files changed, 15 insertions(+)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 9b0d202..9b36fc8 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -707,6 +707,20 @@ int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq)
EXPORT_SYMBOL_GPL(regmap_irq_get_virq);

/**
+ * regmap_irq_put_virq(): Unmap mapped interrupt of a chip in irq-domain.
+ *
+ * This routine is used to dispose the created mapping from irq domain
+ * which must be call before removing irq domain.
+ *
+ * @irq: virtual irq number which was mapped with irq domains.
+ */
+void regmap_irq_put_virq(int virq)
+{
+ irq_dispose_mapping(virq);
+}
+EXPORT_SYMBOL_GPL(regmap_irq_put_virq);
+
+/**
* regmap_irq_get_domain(): Retrieve the irq_domain for the chip
*
* Useful for drivers to request their own IRQs and for integration
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 27aaac9..546eab5 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -870,6 +870,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
+void regmap_irq_put_virq(int virq);
struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);

#else
--
2.1.4