[PATCHv4 2/3] USB: gadget: atmel_usba_udc: Enable Vbus signal IRQ in UDC start instead of UDC probe

Sylvain Rochet sylvain.rochet at finsecur.com
Wed Jan 21 05:18:37 PST 2015


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



More information about the linux-arm-kernel mailing list