linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: change IRQ_HANDLED to IRQ_WAKE_THREAD
@ 2015-10-27 15:26 Ioana Ciornei
  2015-10-27 15:28 ` [Outreachy kernel] " Julia Lawall
  2015-10-27 16:12 ` Daniel Baluta
  0 siblings, 2 replies; 3+ messages in thread
From: Ioana Ciornei @ 2015-10-27 15:26 UTC (permalink / raw)
  To: outreachy-kernel, linux-iio; +Cc: Ioana Ciornei

This patch changes the return value of the primary interrupt handler to
IRQ_WAKE_THREAD in order to wake the kernel thread represented by the
iio_simple_dummy_event_handler function and continue handling the event.

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
 drivers/staging/iio/iio_simple_dummy_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/staging/iio/iio_simple_dummy_events.c
index bfbf1c5..6eb600f 100644
--- a/drivers/staging/iio/iio_simple_dummy_events.c
+++ b/drivers/staging/iio/iio_simple_dummy_events.c
@@ -159,7 +159,7 @@ static irqreturn_t iio_simple_dummy_get_timestamp(int irq, void *private)
 	struct iio_dummy_state *st = iio_priv(indio_dev);
 
 	st->event_timestamp = iio_get_time_ns();
-	return IRQ_HANDLED;
+	return IRQ_WAKE_THREAD;
 }
 
 /**
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: iio: change IRQ_HANDLED to IRQ_WAKE_THREAD
  2015-10-27 15:26 [PATCH] staging: iio: change IRQ_HANDLED to IRQ_WAKE_THREAD Ioana Ciornei
@ 2015-10-27 15:28 ` Julia Lawall
  2015-10-27 16:12 ` Daniel Baluta
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2015-10-27 15:28 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: outreachy-kernel, linux-iio

On Tue, 27 Oct 2015, Ioana Ciornei wrote:

> This patch changes the return value of the primary interrupt handler to
> IRQ_WAKE_THREAD in order to wake the kernel thread represented by the
> iio_simple_dummy_event_handler function and continue handling the event.

Can you give some more justification about why that is the right thing to
do?  Is it for example what other IIO drivers do in this situation?

julia

> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
> ---
>  drivers/staging/iio/iio_simple_dummy_events.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/staging/iio/iio_simple_dummy_events.c
> index bfbf1c5..6eb600f 100644
> --- a/drivers/staging/iio/iio_simple_dummy_events.c
> +++ b/drivers/staging/iio/iio_simple_dummy_events.c
> @@ -159,7 +159,7 @@ static irqreturn_t iio_simple_dummy_get_timestamp(int irq, void *private)
>  	struct iio_dummy_state *st = iio_priv(indio_dev);
>
>  	st->event_timestamp = iio_get_time_ns();
> -	return IRQ_HANDLED;
> +	return IRQ_WAKE_THREAD;
>  }
>
>  /**
> --
> 2.1.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1445959587-25953-1-git-send-email-ciorneiioana%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: iio: change IRQ_HANDLED to IRQ_WAKE_THREAD
  2015-10-27 15:26 [PATCH] staging: iio: change IRQ_HANDLED to IRQ_WAKE_THREAD Ioana Ciornei
  2015-10-27 15:28 ` [Outreachy kernel] " Julia Lawall
@ 2015-10-27 16:12 ` Daniel Baluta
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Baluta @ 2015-10-27 16:12 UTC (permalink / raw)
  To: Ioana Ciornei
  Cc: outreachy-kernel, linux-iio@vger.kernel.org, Jonathan Cameron

On Tue, Oct 27, 2015 at 5:26 PM, Ioana Ciornei <ciorneiioana@gmail.com> wrote:
> This patch changes the return value of the primary interrupt handler to
> IRQ_WAKE_THREAD in order to wake the kernel thread represented by the
> iio_simple_dummy_event_handler function and continue handling the event.
>

This is a very good catch! We need to have a better commit message. You
need to describe why the commit is needed.

==
iio: dummy: Complete IIO events delivery to userspace

Since commit fd2bb310ca ("Staging: iio: Move evgen interrupt
generation to irq_work")
event processing is split in two parts using threaded interrupts:

* part 1, IRQ handler - runs in IRQ context and only saves event timestamp.
* part 2, threaded handler, runs in process context, get events and
pushes them to userspace.

When IRQ handler returns IRQ_HANDLED code the interrupt is considered
to be processed
and the threaded handler will not be called. We don't want this for
IIO dummy events driver, since
the events processing takes places in the threaded handler.

Thus, IRQ handler needs to wake up threaded handler by returning IRQ_WAKE_THREAD

Fixes: fd2bb310ca ("Staging: iio: Move evgen interrupt generation to irq_work")
==

Also, because IIO driver was moved out of staging please rebase your
patch on Jonathan's tree:

https://git.kernel.org/cgit/linux/kernel/git/jic23/iio.git/log/?h=testing

use testing branch for this.


> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
> ---
>  drivers/staging/iio/iio_simple_dummy_events.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/staging/iio/iio_simple_dummy_events.c
> index bfbf1c5..6eb600f 100644
> --- a/drivers/staging/iio/iio_simple_dummy_events.c
> +++ b/drivers/staging/iio/iio_simple_dummy_events.c
> @@ -159,7 +159,7 @@ static irqreturn_t iio_simple_dummy_get_timestamp(int irq, void *private)
>         struct iio_dummy_state *st = iio_priv(indio_dev);
>
>         st->event_timestamp = iio_get_time_ns();
> -       return IRQ_HANDLED;
> +       return IRQ_WAKE_THREAD;
>  }
>
>  /**
> --
> 2.1.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1445959587-25953-1-git-send-email-ciorneiioana%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-27 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-27 15:26 [PATCH] staging: iio: change IRQ_HANDLED to IRQ_WAKE_THREAD Ioana Ciornei
2015-10-27 15:28 ` [Outreachy kernel] " Julia Lawall
2015-10-27 16:12 ` Daniel Baluta

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).