linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Boris Brezillon <boris.brezillon@free-electrons.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Subject: Re: [PATCH] pinctrl: at91: move lock/unlock_as_irq calls into request/release resources methods
Date: Thu, 26 Feb 2015 14:32:02 +0100	[thread overview]
Message-ID: <54EF2052.6030909@atmel.com> (raw)
In-Reply-To: <1423419822-6258-1-git-send-email-boris.brezillon@free-electrons.com>

Le 08/02/2015 19:23, Boris Brezillon a écrit :
> The gpiochip_lock_as_irq call can fail and return an error, while the
> irq_startup is not expected to fail (returns an unsigned int which is not
> checked by irq core code).
> 
> irq_request/release_resources functions have been created to address this
> problem.
> 
> Move gpiochip_lock/unlock_as_irq calls into
> irq_request/release_resources functions to prevent using a gpio as an irq
> if the gpiochip_lock_as_irq call failed.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

If it can speed up things:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Linus,
can we schedule this fix during the 4.0-rc phase?

Bye,

> ---
>  drivers/pinctrl/pinctrl-at91.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
> index f4cd0b9..a481406 100644
> --- a/drivers/pinctrl/pinctrl-at91.c
> +++ b/drivers/pinctrl/pinctrl-at91.c
> @@ -1477,28 +1477,25 @@ static void gpio_irq_ack(struct irq_data *d)
>  	/* the interrupt is already cleared before by reading ISR */
>  }
>  
> -static unsigned int gpio_irq_startup(struct irq_data *d)
> +static int gpio_irq_request_res(struct irq_data *d)
>  {
>  	struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
>  	unsigned	pin = d->hwirq;
>  	int ret;
>  
>  	ret = gpiochip_lock_as_irq(&at91_gpio->chip, pin);
> -	if (ret) {
> +	if (ret)
>  		dev_err(at91_gpio->chip.dev, "unable to lock pind %lu IRQ\n",
>  			d->hwirq);
> -		return ret;
> -	}
> -	gpio_irq_unmask(d);
> -	return 0;
> +
> +	return ret;
>  }
>  
> -static void gpio_irq_shutdown(struct irq_data *d)
> +static void gpio_irq_release_res(struct irq_data *d)
>  {
>  	struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
>  	unsigned	pin = d->hwirq;
>  
> -	gpio_irq_mask(d);
>  	gpiochip_unlock_as_irq(&at91_gpio->chip, pin);
>  }
>  
> @@ -1577,8 +1574,8 @@ void at91_pinctrl_gpio_resume(void)
>  static struct irq_chip gpio_irqchip = {
>  	.name		= "GPIO",
>  	.irq_ack	= gpio_irq_ack,
> -	.irq_startup	= gpio_irq_startup,
> -	.irq_shutdown	= gpio_irq_shutdown,
> +	.irq_request_resources = gpio_irq_request_res,
> +	.irq_release_resources = gpio_irq_release_res,
>  	.irq_disable	= gpio_irq_mask,
>  	.irq_mask	= gpio_irq_mask,
>  	.irq_unmask	= gpio_irq_unmask,
> 


-- 
Nicolas Ferre

  parent reply	other threads:[~2015-02-26 13:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-08 18:23 [PATCH] pinctrl: at91: move lock/unlock_as_irq calls into request/release resources methods Boris Brezillon
2015-02-09 14:50 ` Jean-Christophe PLAGNIOL-VILLARD
2015-02-20  7:50   ` Jean-Christophe PLAGNIOL-VILLARD
2015-02-26 13:12     ` Boris Brezillon
2015-02-18 10:41 ` Ludovic Desroches
2015-02-26 13:32 ` Nicolas Ferre [this message]
2015-02-26 13:59   ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-04 21:30 ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-09 16:14 ` Linus Walleij
2015-03-10  8:34   ` Nicolas Ferre
2015-03-18  1:06     ` Linus Walleij

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=54EF2052.6030909@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=jjhiblot@traphandler.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=plagnioj@jcrosoft.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;
as well as URLs for NNTP newsgroup(s).