[PATCH] regmap: Dynamicallly allocate a regmap_irq range if no base is specified

From: Mark Brown
Date: Sun May 13 2012 - 07:51:03 EST


This avoids drivers having to implement the logic and will make it easier
to add irq_domain support.

Signed-off-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
drivers/base/regmap/regmap-irq.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 0d233cc..f9724af 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -195,6 +195,10 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
return -EINVAL;
}

+ /* Ask for a dynamic range if none is specified */
+ if (!irq_base)
+ irq_base = -1;
+
irq_base = irq_alloc_descs(irq_base, 0, chip->num_irqs, 0);
if (irq_base < 0) {
dev_warn(map->dev, "Failed to allocate IRQs: %d\n",
--
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/