[PATCH] aoa: i2sbus: move module parameter declaration up
[firefly-linux-kernel-4.4.55.git] / sound / aoa / soundbus / i2sbus / i2sbus-core.c
index f268dacdaa000b99b31c3b1bfd42275703da6a12..8227dbbc994fa3e83ff55653830221190be9d7db 100644 (file)
@@ -24,6 +24,11 @@ MODULE_DESCRIPTION("Apple Soundbus: I2S support");
  * string that macio puts into the relevant device */
 MODULE_ALIAS("of:Ni2sTi2sC");
 
+static int force;
+module_param(force, int, 0444);
+MODULE_PARM_DESC(force, "Force loading i2sbus even when"
+                       " no layout-id property is present");
+
 static struct of_device_id i2sbus_match[] = {
        { .name = "i2s" },
        { }
@@ -101,11 +106,6 @@ static irqreturn_t i2sbus_bus_intr(int irq, void *devid, struct pt_regs *regs)
        return IRQ_HANDLED;
 }
 
-static int force;
-module_param(force, int, 0444);
-MODULE_PARM_DESC(force, "Force loading i2sbus even when"
-                       " no layout-id property is present");
-
 /* FIXME: look at device node refcounting */
 static int i2sbus_add_dev(struct macio_dev *macio,
                          struct i2sbus_control *control,
@@ -129,9 +129,6 @@ static int i2sbus_add_dev(struct macio_dev *macio,
        if (strncmp(np->name, "i2s-", 4))
                return 0;
 
-       if (np->n_intrs != 3)
-               return 0;
-
        dev = kzalloc(sizeof(struct i2sbus_dev), GFP_KERNEL);
        if (!dev)
                return 0;
@@ -183,9 +180,10 @@ static int i2sbus_add_dev(struct macio_dev *macio,
                snprintf(dev->rnames[i], sizeof(dev->rnames[i]), rnames[i], np->name);
        }
        for (i=0;i<3;i++) {
-               if (request_irq(np->intrs[i].line, ints[i], 0, dev->rnames[i], dev))
+               int irq = irq_of_parse_and_map(np, i);
+               if (request_irq(irq, ints[i], 0, dev->rnames[i], dev))
                        goto err;
-               dev->interrupts[i] = np->intrs[i].line;
+               dev->interrupts[i] = irq;
        }
 
        for (i=0;i<3;i++) {