mfd: Simplify IRQ domain registration code in STMPE
authorLee Jones <lee.jones@linaro.org>
Fri, 23 Nov 2012 15:19:29 +0000 (15:19 +0000)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 26 Nov 2012 11:11:21 +0000 (12:11 +0100)
Historically, a driver would have to decide whether it required
a Linear or Legacy IRQ domain when registering one. This can end
up as quite a lot of code. A new Simple call now exists which
simplifies this process. Let's make use of it here.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/stmpe.c

index c0df4b9d51c3393510f4276a68a85707c5c69f9d..0061d1bc971900f7e40b24fc4492426ca43cba74 100644 (file)
@@ -888,18 +888,14 @@ static struct irq_domain_ops stmpe_irq_ops = {
 static int __devinit stmpe_irq_init(struct stmpe *stmpe,
                                struct device_node *np)
 {
-       int base = stmpe->irq_base;
+       int base = 0;
        int num_irqs = stmpe->variant->num_irqs;
 
-       if (base) {
-               stmpe->domain = irq_domain_add_legacy(
-                       np, num_irqs, base, 0, &stmpe_irq_ops, stmpe);
-       }
-       else {
-               stmpe->domain = irq_domain_add_linear(
-                       np, num_irqs, &stmpe_irq_ops, stmpe);
-       }
+       if (!np)
+               base = stmpe->irq_base;
 
+       stmpe->domain = irq_domain_add_simple(np, num_irqs, base,
+                                             &stmpe_irq_ops, stmpe);
        if (!stmpe->domain) {
                dev_err(stmpe->dev, "Failed to create irqdomain\n");
                return -ENOSYS;