Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Thierry Reding <treding@nvidia.com>
Subject: Re: [PATCH] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip
Date: Mon, 12 Aug 2019 20:52:14 +0300	[thread overview]
Message-ID: <20190812175214.GR30120@smile.fi.intel.com> (raw)
In-Reply-To: <20190812141446.1090-1-linus.walleij@linaro.org>

On Mon, Aug 12, 2019 at 04:14:46PM +0200, 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.

Pushed to my review and testing queue, thanks!

> 
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Thierry Reding <treding@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Andy: when you're happy with this you can either supply an
> ACK and I will merge it or you can merge it into your tree
> for a later pull request, just tell me what you prefer.
> ---
>  drivers/pinctrl/intel/pinctrl-baytrail.c | 38 ++++++++++++++----------
>  1 file changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
> index e5a112a8e067..57faddca3710 100644
> --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
> @@ -1533,6 +1533,28 @@ static int byt_gpio_probe(struct byt_gpio *vg)
>  	if (!vg->saved_context)
>  		return -ENOMEM;
>  #endif
> +
> +	/* set up interrupts  */
> +	irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0);
> +	if (irq_rc && irq_rc->start) {
> +		struct gpio_irq_chip *girq;
> +
> +		byt_gpio_irq_init_hw(vg);
> +
> +		girq = &gc->irq;
> +		girq->chip = &byt_irqchip;
> +		girq->parent_handler = byt_gpio_irq_handler;
> +		girq->num_parents = 1;
> +		girq->parents = devm_kcalloc(&vg->pdev->dev, 1,
> +					     sizeof(*girq->parents),
> +					     GFP_KERNEL);
> +		if (!girq->parents)
> +			return -ENOMEM;
> +		girq->parents[0] = (unsigned int)irq_rc->start;
> +		girq->default_type = IRQ_TYPE_NONE;
> +		girq->handler = handle_bad_irq;
> +	}
> +
>  	ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg);
>  	if (ret) {
>  		dev_err(&vg->pdev->dev, "failed adding byt-gpio chip\n");
> @@ -1546,22 +1568,6 @@ static int byt_gpio_probe(struct byt_gpio *vg)
>  		return ret;
>  	}
>  
> -	/* set up interrupts  */
> -	irq_rc = platform_get_resource(vg->pdev, IORESOURCE_IRQ, 0);
> -	if (irq_rc && irq_rc->start) {
> -		byt_gpio_irq_init_hw(vg);
> -		ret = gpiochip_irqchip_add(gc, &byt_irqchip, 0,
> -					   handle_bad_irq, IRQ_TYPE_NONE);
> -		if (ret) {
> -			dev_err(&vg->pdev->dev, "failed to add irqchip\n");
> -			return ret;
> -		}
> -
> -		gpiochip_set_chained_irqchip(gc, &byt_irqchip,
> -					     (unsigned)irq_rc->start,
> -					     byt_gpio_irq_handler);
> -	}
> -
>  	return ret;
>  }
>  
> -- 
> 2.21.0
> 

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2019-08-12 18:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12 14:14 [PATCH] pinctrl: intel: baytrail: Pass irqchip when adding gpiochip Linus Walleij
2019-08-12 17:52 ` Andy Shevchenko [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=20190812175214.GR30120@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.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