]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging: greybus: gpio: Use irqchip template
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 22 Jul 2020 07:44:14 +0000 (09:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Jul 2020 08:05:33 +0000 (10:05 +0200)
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add(). The irqchip is
instead added while adding the gpiochip.

Cc: Nishad Kamdar <nishadkamdar@gmail.com>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200722074414.48457-1-linus.walleij@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/gpio.c

index 36d99f9e419ef57b717db7591530d74c65505198..7e6347fe93f9922e8f06ab7db3a70158d28813f8 100644 (file)
@@ -504,6 +504,7 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
        struct gb_connection *connection;
        struct gb_gpio_controller *ggc;
        struct gpio_chip *gpio;
+       struct gpio_irq_chip *girq;
        struct irq_chip *irqc;
        int ret;
 
@@ -561,6 +562,15 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
        gpio->ngpio = ggc->line_max + 1;
        gpio->can_sleep = true;
 
+       girq = &gpio->irq;
+       girq->chip = irqc;
+       /* The event comes from the outside so no parent handler */
+       girq->parent_handler = NULL;
+       girq->num_parents = 0;
+       girq->parents = NULL;
+       girq->default_type = IRQ_TYPE_NONE;
+       girq->handler = handle_level_irq;
+
        ret = gb_connection_enable(connection);
        if (ret)
                goto exit_line_free;
@@ -571,18 +581,9 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
                goto exit_line_free;
        }
 
-       ret = gpiochip_irqchip_add(gpio, irqc, 0, handle_level_irq,
-                                  IRQ_TYPE_NONE);
-       if (ret) {
-               dev_err(&gbphy_dev->dev, "failed to add irq chip: %d\n", ret);
-               goto exit_gpiochip_remove;
-       }
-
        gbphy_runtime_put_autosuspend(gbphy_dev);
        return 0;
 
-exit_gpiochip_remove:
-       gpiochip_remove(gpio);
 exit_line_free:
        kfree(ggc->lines);
 exit_connection_disable: