Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Scott Branden <scott.branden@broadcom.com>
To: Linus Walleij <linus.walleij@linaro.org>, linux-gpio@vger.kernel.org
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Pramod Kumar <pramodku@broadcom.com>, Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Thierry Reding <treding@nvidia.com>
Subject: Re: [PATCH] pinctrl: bcm-iproc: Pass irqchip when adding gpiochip
Date: Mon, 12 Aug 2019 09:00:37 -0700	[thread overview]
Message-ID: <24d28eed-c2ab-5850-50b2-db63740b71dd@broadcom.com> (raw)
In-Reply-To: <20190812132554.18313-1-linus.walleij@linaro.org>


On 2019-08-12 6:25 a.m., Linus Walleij wrote:
> We need to convert all old gpio irqchips to pass the irqchip
> setup along when adding the gpio_chip. For more info see
> drivers/gpio/TODO.
>
> For chained irqchips this is a pretty straight-forward
> conversion.
>
> Cc: Pramod Kumar <pramodku@broadcom.com>
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: Thierry Reding <treding@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Scott Branden <scott.branden@broadcom.com>
> ---
>   drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 33 ++++++++++++++----------
>   1 file changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
> index 18ff01727e0e..ee01306c62fa 100644
> --- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
> +++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
> @@ -780,6 +780,25 @@ static int iproc_gpio_probe(struct platform_device *pdev)
>   	chip->pinmux_is_supported = of_property_read_bool(dev->of_node,
>   							"gpio-ranges");
>   
> +	/* optional GPIO interrupt support */
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq) {
> +		struct gpio_irq_chip *girq;
> +
> +		girq = &gc->irq;
> +		girq->chip = &iproc_gpio_irq_chip;
> +		girq->parent_handler = iproc_gpio_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_simple_irq;
> +	}
> +
>   	ret = gpiochip_add_data(gc, chip);
>   	if (ret < 0) {
>   		dev_err(dev, "unable to add GPIO chip\n");
> @@ -804,20 +823,6 @@ static int iproc_gpio_probe(struct platform_device *pdev)
>   		}
>   	}
>   
> -	/* optional GPIO interrupt support */
> -	irq = platform_get_irq(pdev, 0);
> -	if (irq) {
> -		ret = gpiochip_irqchip_add(gc, &iproc_gpio_irq_chip, 0,
> -					   handle_simple_irq, IRQ_TYPE_NONE);
> -		if (ret) {
> -			dev_err(dev, "no GPIO irqchip\n");
> -			goto err_rm_gpiochip;
> -		}
> -
> -		gpiochip_set_chained_irqchip(gc, &iproc_gpio_irq_chip, irq,
> -					     iproc_gpio_irq_handler);
> -	}
> -
>   	return 0;
>   
>   err_rm_gpiochip:

      reply	other threads:[~2019-08-12 16:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12 13:25 [PATCH] pinctrl: bcm-iproc: Pass irqchip when adding gpiochip Linus Walleij
2019-08-12 16:00 ` Scott Branden [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24d28eed-c2ab-5850-50b2-db63740b71dd@broadcom.com \
    --to=scott.branden@broadcom.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=pramodku@broadcom.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=treding@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox