Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1680578 > unrolled thread

Re: [PATCH] iio: adc: sun4i-gpadc-iio: fix unbalanced irq enable/disable

Started byMaxime Ripard <maxime.ripard@free-electrons.com>
First post2017-07-03 23:20 +0200
Last post2017-07-04 21:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] iio: adc: sun4i-gpadc-iio: fix unbalanced irq  enable/disable Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-07-03 23:20 +0200
    Re: [PATCH] iio: adc: sun4i-gpadc-iio: fix unbalanced irq  enable/disable Jonathan Cameron <jic23@kernel.org> - 2017-07-04 21:40 +0200

#1680578 — Re: [PATCH] iio: adc: sun4i-gpadc-iio: fix unbalanced irq enable/disable

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-07-03 23:20 +0200
SubjectRe: [PATCH] iio: adc: sun4i-gpadc-iio: fix unbalanced irq enable/disable
Message-ID<tZgVc-7a5-11@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Mon, Jul 03, 2017 at 03:09:26PM +0200, Quentin Schulz wrote:
> When initializing interrupts, the devm_request_any_context_irq will
> enable them right away. An atomic flag was set in sun4i_irq_init and read
> in the interrupt handler to make sure no unwanted interrupts were
> handled. If an unwanted interrupt occurred, the handler would disable
> the irq and return IRQ_HANDLED. However, at the end of sun4i_irq_init,
> the irq would be disabled as well, resulting in an unbalanced enable
> (since there are more disables than enables, the code enabling the
> interrupt would never be called).
> 
> When reading the ADC or the temperature, the respective irq would be
> enabled in the read function and disabled in the irq handler. In the
> read function, we would wait for a completion (with a timeout) that will
> be set in the irq handler. However, if the completion is never set or if
> the wait for completion times out, the irq would not be disabled in the
> read function resulting in an unbalanced enable once the read function
> is called again (since there are 2+ enables for no disable).
> 
> Moving disable_irq from the irq handler to the read function get rid of
> these two cases of unbalanced enable.
> 
> Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")
> 
> Reported-by: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [next] | [standalone]


#1681148

FromJonathan Cameron <jic23@kernel.org>
Date2017-07-04 21:40 +0200
Message-ID<tZBPY-4mq-25@gated-at.bofh.it>
In reply to#1680578
On Mon, 3 Jul 2017 23:19:45 +0200
Maxime Ripard <maxime.ripard@free-electrons.com> wrote:

> On Mon, Jul 03, 2017 at 03:09:26PM +0200, Quentin Schulz wrote:
> > When initializing interrupts, the devm_request_any_context_irq will
> > enable them right away. An atomic flag was set in sun4i_irq_init and read
> > in the interrupt handler to make sure no unwanted interrupts were
> > handled. If an unwanted interrupt occurred, the handler would disable
> > the irq and return IRQ_HANDLED. However, at the end of sun4i_irq_init,
> > the irq would be disabled as well, resulting in an unbalanced enable
> > (since there are more disables than enables, the code enabling the
> > interrupt would never be called).
> > 
> > When reading the ADC or the temperature, the respective irq would be
> > enabled in the read function and disabled in the irq handler. In the
> > read function, we would wait for a completion (with a timeout) that will
> > be set in the irq handler. However, if the completion is never set or if
> > the wait for completion times out, the irq would not be disabled in the
> > read function resulting in an unbalanced enable once the read function
> > is called again (since there are 2+ enables for no disable).
> > 
> > Moving disable_irq from the irq handler to the read function get rid of
> > these two cases of unbalanced enable.
> > 
> > Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")
> > 
> > Reported-by: Andreas Färber <afaerber@suse.de>
> > Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>  
> 
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Nice detailed explanation - thanks.

Applied to the fixes-togreg branch of iio.git.

Jonathan
> 
> Thanks!
> Maxime
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web