linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: dln2: Use irqchip template
@ 2020-07-22  7:34 Linus Walleij
  2020-07-22  8:10 ` Daniel Baluta
  2020-07-22 13:37 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2020-07-22  7:34 UTC (permalink / raw)
  To: linux-gpio
  Cc: Bartosz Golaszewski, Linus Walleij, Daniel Baluta, Octavian Purdila

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: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Octavian Purdila <octavian.purdila@nxp.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-dln2.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c
index 26b40c8b8a12..4c5f6d0c8d74 100644
--- a/drivers/gpio/gpio-dln2.c
+++ b/drivers/gpio/gpio-dln2.c
@@ -440,6 +440,7 @@ static int dln2_gpio_probe(struct platform_device *pdev)
 {
 	struct dln2_gpio *dln2;
 	struct device *dev = &pdev->dev;
+	struct gpio_irq_chip *girq;
 	int pins;
 	int ret;
 
@@ -476,6 +477,15 @@ static int dln2_gpio_probe(struct platform_device *pdev)
 	dln2->gpio.direction_output = dln2_gpio_direction_output;
 	dln2->gpio.set_config = dln2_gpio_set_config;
 
+	girq = &dln2->gpio.irq;
+	girq->chip = &dln2_gpio_irqchip;
+	/* 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_simple_irq;
+
 	platform_set_drvdata(pdev, dln2);
 
 	ret = devm_gpiochip_add_data(dev, &dln2->gpio, dln2);
@@ -484,13 +494,6 @@ static int dln2_gpio_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = gpiochip_irqchip_add(&dln2->gpio, &dln2_gpio_irqchip, 0,
-				   handle_simple_irq, IRQ_TYPE_NONE);
-	if (ret < 0) {
-		dev_err(dev, "failed to add irq chip: %d\n", ret);
-		return ret;
-	}
-
 	ret = dln2_register_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV,
 				     dln2_gpio_event);
 	if (ret) {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: dln2: Use irqchip template
  2020-07-22  7:34 [PATCH] gpio: dln2: Use irqchip template Linus Walleij
@ 2020-07-22  8:10 ` Daniel Baluta
  2020-07-22 13:37 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Baluta @ 2020-07-22  8:10 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, Bartosz Golaszewski, Octavian Purdila

On Wed, Jul 22, 2020 at 10:36 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> 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: Daniel Baluta <daniel.baluta@gmail.com>
> Cc: Octavian Purdila <octavian.purdila@nxp.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: dln2: Use irqchip template
  2020-07-22  7:34 [PATCH] gpio: dln2: Use irqchip template Linus Walleij
  2020-07-22  8:10 ` Daniel Baluta
@ 2020-07-22 13:37 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-07-22 13:37 UTC (permalink / raw)
  To: Linus Walleij
  Cc: open list:GPIO SUBSYSTEM, Bartosz Golaszewski, Daniel Baluta,
	Octavian Purdila

On Wed, Jul 22, 2020 at 10:37 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> 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.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Cc: Daniel Baluta <daniel.baluta@gmail.com>
> Cc: Octavian Purdila <octavian.purdila@nxp.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/gpio-dln2.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c
> index 26b40c8b8a12..4c5f6d0c8d74 100644
> --- a/drivers/gpio/gpio-dln2.c
> +++ b/drivers/gpio/gpio-dln2.c
> @@ -440,6 +440,7 @@ static int dln2_gpio_probe(struct platform_device *pdev)
>  {
>         struct dln2_gpio *dln2;
>         struct device *dev = &pdev->dev;
> +       struct gpio_irq_chip *girq;
>         int pins;
>         int ret;
>
> @@ -476,6 +477,15 @@ static int dln2_gpio_probe(struct platform_device *pdev)
>         dln2->gpio.direction_output = dln2_gpio_direction_output;
>         dln2->gpio.set_config = dln2_gpio_set_config;
>
> +       girq = &dln2->gpio.irq;
> +       girq->chip = &dln2_gpio_irqchip;
> +       /* 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_simple_irq;
> +
>         platform_set_drvdata(pdev, dln2);
>
>         ret = devm_gpiochip_add_data(dev, &dln2->gpio, dln2);
> @@ -484,13 +494,6 @@ static int dln2_gpio_probe(struct platform_device *pdev)
>                 return ret;
>         }
>
> -       ret = gpiochip_irqchip_add(&dln2->gpio, &dln2_gpio_irqchip, 0,
> -                                  handle_simple_irq, IRQ_TYPE_NONE);
> -       if (ret < 0) {
> -               dev_err(dev, "failed to add irq chip: %d\n", ret);
> -               return ret;
> -       }
> -
>         ret = dln2_register_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV,
>                                      dln2_gpio_event);
>         if (ret) {
> --
> 2.26.2
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-22 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  7:34 [PATCH] gpio: dln2: Use irqchip template Linus Walleij
2020-07-22  8:10 ` Daniel Baluta
2020-07-22 13:37 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).