Merge tag 'gpio-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux...
[sfrench/cifs-2.6.git] / drivers / gpio / gpio-pl061.c
index 9aad32206e84b20fbb3674eabbbcf8f1242f3cdc..722ce5cf861e870686731e4d0b12f6387643f5ce 100644 (file)
@@ -283,6 +283,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
 {
        struct device *dev = &adev->dev;
        struct pl061 *pl061;
+       struct gpio_irq_chip *girq;
        int ret, irq;
 
        pl061 = devm_kzalloc(dev, sizeof(*pl061), GFP_KERNEL);
@@ -310,10 +311,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
        pl061->gc.parent = dev;
        pl061->gc.owner = THIS_MODULE;
 
-       ret = gpiochip_add_data(&pl061->gc, pl061);
-       if (ret)
-               return ret;
-
        /*
         * irq_chip support
         */
@@ -332,19 +329,24 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
        }
        pl061->parent_irq = irq;
 
-       ret = gpiochip_irqchip_add(&pl061->gc, &pl061->irq_chip,
-                                  0, handle_bad_irq,
-                                  IRQ_TYPE_NONE);
-       if (ret) {
-               dev_info(&adev->dev, "could not add irqchip\n");
+       girq = &pl061->gc.irq;
+       girq->chip = &pl061->irq_chip;
+       girq->parent_handler = pl061_irq_handler;
+       girq->num_parents = 1;
+       girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
+                                    GFP_KERNEL);
+       if (!girq->parents)
+               return -ENOMEM;
+       girq->parents[0] = irq;
+       girq->default_type = IRQ_TYPE_NONE;
+       girq->handler = handle_bad_irq;
+
+       ret = devm_gpiochip_add_data(dev, &pl061->gc, pl061);
+       if (ret)
                return ret;
-       }
-       gpiochip_set_chained_irqchip(&pl061->gc, &pl061->irq_chip,
-                                    irq, pl061_irq_handler);
 
        amba_set_drvdata(adev, pl061);
-       dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n",
-                &adev->res.start);
+       dev_info(dev, "PL061 GPIO chip registered\n");
 
        return 0;
 }