linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sylvain.rochet@finsecur.com (Sylvain Rochet)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv4 2/3] USB: gadget: atmel_usba_udc: Enable Vbus signal IRQ in UDC start instead of UDC probe
Date: Wed, 21 Jan 2015 14:18:37 +0100	[thread overview]
Message-ID: <20150121131837.GA12825@gradator.net> (raw)
In-Reply-To: <20150121102016.064a33ce@bbrezillon>

Hi Boris,

On Wed, Jan 21, 2015 at 10:20:16AM +0100, Boris Brezillon wrote:
> >  
> >  	udc->vbus_prev = 0;
> > -	if (gpio_is_valid(udc->vbus_pin))
> > -		enable_irq(gpio_to_irq(udc->vbus_pin));
> > +	if (gpio_is_valid(udc->vbus_pin)) {
> > +		ret = request_irq(gpio_to_irq(udc->vbus_pin),
> > +				usba_vbus_irq, 0,
> > +				"atmel_usba_udc", udc);
> > +		if (ret) {
> > +			udc->vbus_pin = -ENODEV;
> 
> I guess you're trying to protect against free_irq by changing the
> vbus_pin value (making it an invalid gpio id), but I think you should
> leave it unchanged for two reasons:
> 1) If the request_irq call temporary fails (an ENOMEM for example) then
> you should be able to retry later, and modifying the vbus_pin value
> will prevent that.
> 2) atmel_usba_stop will never be called if the atmel_usba_start failed,
> so there's no need to protect against this free_irq.

Indeed.

By the way, I just discovered irq_set_status_flags(irq, IRQ_NOAUTOEN); ? 
so I am going for a v5 and the previous part is not relevant anymore.

Sylvain

  reply	other threads:[~2015-01-21 13:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 21:23 [PATCHv4 0/3] USB: gadget: atmel_usba_udc: Start clocks on rising edge of the Vbus signal, stop clocks on falling edge of the Vbus signal Sylvain Rochet
2015-01-20 21:23 ` [PATCHv4 1/3] USB: gadget: atmel_usba_udc: Fixed vbus_prev initial state Sylvain Rochet
2015-01-20 21:23 ` [PATCHv4 2/3] USB: gadget: atmel_usba_udc: Enable Vbus signal IRQ in UDC start instead of UDC probe Sylvain Rochet
2015-01-21  9:20   ` Boris Brezillon
2015-01-21 13:18     ` Sylvain Rochet [this message]
2015-01-20 21:23 ` [PATCHv4 3/3] USB: gadget: atmel_usba_udc: Start clocks on rising edge of the Vbus signal, stop clocks on falling edge of the Vbus signal Sylvain Rochet

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=20150121131837.GA12825@gradator.net \
    --to=sylvain.rochet@finsecur.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).