linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, maxime.ripard@free-electrons.com
Subject: Re: WARNING: at kernel/irq/handle.c, irq_default_primary_handler enabled interrupts
Date: Sat, 13 Oct 2012 17:05:32 +0100	[thread overview]
Message-ID: <5079914C.3030100@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.01.1209290134230.8022@pmeerw.net>

On 09/29/2012 12:44 AM, Peter Meerwald wrote:
> Hello myself :),
> 
>> si114x_irq() checks the irq status of the chip by reading and checking 
>> some register via i2c and then depending on the buffer being enabled or 
>> not
>>
>> 	if (iio_buffer_enabled(indio_dev))
>>         	iio_trigger_poll(indio_dev->trig, 0);
>>         else {
>> 		data->got_data = true;
>> 		wake_up_interruptible(&data->data_avail);
>> 	}
> 
> it should be iio_trigger_poll_chained(), not iio_trigger_poll(), since 
> this is an interrupt handler; this solves my WARN_ON()
That's not the reason, it's because you are calling it from a bottom half.
The nature of the trigger code is that it would normally be called from the
top half (as it's normally just calling a tree of other interrupt handlers
which may or may not have their own top halves.)

The chained call is probably ok, but does limit what other devices may use
this as a trigger source.  Lars-Peter had another approach that is used
in the sysfs trigger using irq_work_queues which might work here (I haven't
thought about it in much depth...) see drivers/staging/triggers/iio-trig-sysfs.c


Looking at rest of driver but thought I'd get back to you on this.
> 
> iio_trigger_poll_chained() will call handle_nested_irq(), while 
> iio_trigger_poll() calls generic_handle_irq()
> 
> 
> I modelled my code after ad91_adc which has iio_trigger_poll() in 
> at91_adc_eoc_trigger() together with disable_irq_nosync()/enable_irq() -- 
> is this correct? not sure, my code uses threaded irq, at91_adc not so
> 
> comments?
> 
> thanks, regards, p.
> 

  reply	other threads:[~2012-10-13 16:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28  8:49 WARNING: at kernel/irq/handle.c, irq_default_primary_handler enabled interrupts Peter Meerwald
2012-09-28 23:44 ` Peter Meerwald
2012-10-13 16:05   ` Jonathan Cameron [this message]
2012-10-13 16:15     ` Peter Meerwald

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=5079914C.3030100@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=pmeerw@pmeerw.net \
    /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).