linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: dummy: complete IIO events delivery to userspace
@ 2015-10-27 18:40 Ioana Ciornei
  2015-10-28  8:26 ` [Outreachy kernel] " Daniel Baluta
  2015-10-28 22:47 ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Ioana Ciornei @ 2015-10-27 18:40 UTC (permalink / raw)
  To: linux-iio; +Cc: outreachy-kernel, cristina.opriceana, Ioana Ciornei

Starting with commit fd2bb310ca (Staging: iio: Move evgen interrupt
generation to irq_work) event processing is handled by calling
both the top half and the threaded part properly simulating real
hardware interrupts making use of threaded interrupts.
This way the processing is split in 2 parts:

* the IRQ handler that runs in IRQ context and only saves the event
timestamp
* the threaded handler that runs in process context, reads the events
and pushes the in the userspace.

If the IRQ handler returns IRQ_HANDLED the threaded handler is not
even being called since the interrupt is considered to be processed.
Because the iio dummy driver processes the events in the threaded
handler the IRQ handler must return IRQ_WAKE_THREAD so that the
threaded part would be awakened and called.

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
---
rebased on linux-iio tree

 drivers/iio/dummy/iio_simple_dummy_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dummy/iio_simple_dummy_events.c b/drivers/iio/dummy/iio_simple_dummy_events.c
index bfbf1c5..6eb600f 100644
--- a/drivers/iio/dummy/iio_simple_dummy_events.c
+++ b/drivers/iio/dummy/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] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: iio: dummy: complete IIO events delivery to userspace
  2015-10-27 18:40 [PATCH] staging: iio: dummy: complete IIO events delivery to userspace Ioana Ciornei
@ 2015-10-28  8:26 ` Daniel Baluta
  2015-10-28 22:47 ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Baluta @ 2015-10-28  8:26 UTC (permalink / raw)
  To: Ioana Ciornei, linux-iio@vger.kernel.org, Jonathan Cameron
  Cc: outreachy-kernel, Cristina Georgiana Opriceana

On Tue, Oct 27, 2015 at 8:40 PM, Ioana Ciornei <ciorneiioana@gmail.com> wrote:
> Starting with commit fd2bb310ca (Staging: iio: Move evgen interrupt
> generation to irq_work) event processing is handled by calling
> both the top half and the threaded part properly simulating real
> hardware interrupts making use of threaded interrupts.
> This way the processing is split in 2 parts:
>
> * the IRQ handler that runs in IRQ context and only saves the event
> timestamp
> * the threaded handler that runs in process context, reads the events
> and pushes the in the userspace.
>
> If the IRQ handler returns IRQ_HANDLED the threaded handler is not
> even being called since the interrupt is considered to be processed.
> Because the iio dummy driver processes the events in the threaded
> handler the IRQ handler must return IRQ_WAKE_THREAD so that the
> threaded part would be awakened and called.
>
> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>

Fixes: fd2bb310ca ("Staging: iio: Move evgen interrupt generation to irq_work")
Acked-by: Daniel Baluta <daniel.baluta@intel.com>

> ---
> rebased on linux-iio tree
>
>  drivers/iio/dummy/iio_simple_dummy_events.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dummy/iio_simple_dummy_events.c b/drivers/iio/dummy/iio_simple_dummy_events.c
> index bfbf1c5..6eb600f 100644
> --- a/drivers/iio/dummy/iio_simple_dummy_events.c
> +++ b/drivers/iio/dummy/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/1445971256-22474-1-git-send-email-ciorneiioana%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

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

* Re: [Outreachy kernel] [PATCH] staging: iio: dummy: complete IIO events delivery to userspace
  2015-10-27 18:40 [PATCH] staging: iio: dummy: complete IIO events delivery to userspace Ioana Ciornei
  2015-10-28  8:26 ` [Outreachy kernel] " Daniel Baluta
@ 2015-10-28 22:47 ` Greg KH
  2015-10-28 22:49   ` Ioana Ciornei
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2015-10-28 22:47 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: linux-iio, outreachy-kernel, cristina.opriceana

On Tue, Oct 27, 2015 at 08:40:56PM +0200, Ioana Ciornei wrote:
> Starting with commit fd2bb310ca (Staging: iio: Move evgen interrupt
> generation to irq_work) event processing is handled by calling
> both the top half and the threaded part properly simulating real
> hardware interrupts making use of threaded interrupts.
> This way the processing is split in 2 parts:
> 
> * the IRQ handler that runs in IRQ context and only saves the event
> timestamp
> * the threaded handler that runs in process context, reads the events
> and pushes the in the userspace.
> 
> If the IRQ handler returns IRQ_HANDLED the threaded handler is not
> even being called since the interrupt is considered to be processed.
> Because the iio dummy driver processes the events in the threaded
> handler the IRQ handler must return IRQ_WAKE_THREAD so that the
> threaded part would be awakened and called.
> 
> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
> Fixes: fd2bb310ca ("Staging: iio: Move evgen interrupt generation to irq_work")
> Acked-by: Daniel Baluta <daniel.baluta@intel.com>
> ---
> rebased on linux-iio tree

Daniel, can you forward this to the iio developers, I can't take this as
it doesn't apply to my tree :(

thanks,

greg k-h

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

* Re: [Outreachy kernel] [PATCH] staging: iio: dummy: complete IIO events delivery to userspace
  2015-10-28 22:47 ` Greg KH
@ 2015-10-28 22:49   ` Ioana Ciornei
  2015-10-28 23:07     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Ioana Ciornei @ 2015-10-28 22:49 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-iio, outreachy-kernel, Cristina Georgiana Opriceana

On Thu, Oct 29, 2015 at 12:47 AM, Greg KH <greg@kroah.com> wrote:
> On Tue, Oct 27, 2015 at 08:40:56PM +0200, Ioana Ciornei wrote:
>> Starting with commit fd2bb310ca (Staging: iio: Move evgen interrupt
>> generation to irq_work) event processing is handled by calling
>> both the top half and the threaded part properly simulating real
>> hardware interrupts making use of threaded interrupts.
>> This way the processing is split in 2 parts:
>>
>> * the IRQ handler that runs in IRQ context and only saves the event
>> timestamp
>> * the threaded handler that runs in process context, reads the events
>> and pushes the in the userspace.
>>
>> If the IRQ handler returns IRQ_HANDLED the threaded handler is not
>> even being called since the interrupt is considered to be processed.
>> Because the iio dummy driver processes the events in the threaded
>> handler the IRQ handler must return IRQ_WAKE_THREAD so that the
>> threaded part would be awakened and called.
>>
>> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
>> Fixes: fd2bb310ca ("Staging: iio: Move evgen interrupt generation to irq_work")
>> Acked-by: Daniel Baluta <daniel.baluta@intel.com>
>> ---
>> rebased on linux-iio tree
>
> Daniel, can you forward this to the iio developers, I can't take this as
> it doesn't apply to my tree :(
>

I already sent it to the linux-iio list as Daniel suggested in a
previous message.
I hope it's ok.

Thanks,

Ioana

> thanks,
>
> greg k-h

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

* Re: [Outreachy kernel] [PATCH] staging: iio: dummy: complete IIO events delivery to userspace
  2015-10-28 22:49   ` Ioana Ciornei
@ 2015-10-28 23:07     ` Greg KH
  2015-10-31 10:39       ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2015-10-28 23:07 UTC (permalink / raw)
  To: Ioana Ciornei; +Cc: linux-iio, outreachy-kernel, Cristina Georgiana Opriceana

On Thu, Oct 29, 2015 at 12:49:28AM +0200, Ioana Ciornei wrote:
> On Thu, Oct 29, 2015 at 12:47 AM, Greg KH <greg@kroah.com> wrote:
> > On Tue, Oct 27, 2015 at 08:40:56PM +0200, Ioana Ciornei wrote:
> >> Starting with commit fd2bb310ca (Staging: iio: Move evgen interrupt
> >> generation to irq_work) event processing is handled by calling
> >> both the top half and the threaded part properly simulating real
> >> hardware interrupts making use of threaded interrupts.
> >> This way the processing is split in 2 parts:
> >>
> >> * the IRQ handler that runs in IRQ context and only saves the event
> >> timestamp
> >> * the threaded handler that runs in process context, reads the events
> >> and pushes the in the userspace.
> >>
> >> If the IRQ handler returns IRQ_HANDLED the threaded handler is not
> >> even being called since the interrupt is considered to be processed.
> >> Because the iio dummy driver processes the events in the threaded
> >> handler the IRQ handler must return IRQ_WAKE_THREAD so that the
> >> threaded part would be awakened and called.
> >>
> >> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
> >> Fixes: fd2bb310ca ("Staging: iio: Move evgen interrupt generation to irq_work")
> >> Acked-by: Daniel Baluta <daniel.baluta@intel.com>
> >> ---
> >> rebased on linux-iio tree
> >
> > Daniel, can you forward this to the iio developers, I can't take this as
> > it doesn't apply to my tree :(
> >
> 
> I already sent it to the linux-iio list as Daniel suggested in a
> previous message.
> I hope it's ok.

Fine with me, thanks.

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

* Re: [Outreachy kernel] [PATCH] staging: iio: dummy: complete IIO events delivery to userspace
  2015-10-28 23:07     ` Greg KH
@ 2015-10-31 10:39       ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2015-10-31 10:39 UTC (permalink / raw)
  To: Greg KH, Ioana Ciornei
  Cc: linux-iio, outreachy-kernel, Cristina Georgiana Opriceana

On 28/10/15 23:07, Greg KH wrote:
> On Thu, Oct 29, 2015 at 12:49:28AM +0200, Ioana Ciornei wrote:
>> On Thu, Oct 29, 2015 at 12:47 AM, Greg KH <greg@kroah.com> wrote:
>>> On Tue, Oct 27, 2015 at 08:40:56PM +0200, Ioana Ciornei wrote:
>>>> Starting with commit fd2bb310ca (Staging: iio: Move evgen interrupt
>>>> generation to irq_work) event processing is handled by calling
>>>> both the top half and the threaded part properly simulating real
>>>> hardware interrupts making use of threaded interrupts.
>>>> This way the processing is split in 2 parts:
>>>>
>>>> * the IRQ handler that runs in IRQ context and only saves the event
>>>> timestamp
>>>> * the threaded handler that runs in process context, reads the events
>>>> and pushes the in the userspace.
>>>>
>>>> If the IRQ handler returns IRQ_HANDLED the threaded handler is not
>>>> even being called since the interrupt is considered to be processed.
>>>> Because the iio dummy driver processes the events in the threaded
>>>> handler the IRQ handler must return IRQ_WAKE_THREAD so that the
>>>> threaded part would be awakened and called.
>>>>
>>>> Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
>>>> Fixes: fd2bb310ca ("Staging: iio: Move evgen interrupt generation to irq_work")
>>>> Acked-by: Daniel Baluta <daniel.baluta@intel.com>
>>>> ---
>>>> rebased on linux-iio tree
>>>
>>> Daniel, can you forward this to the iio developers, I can't take this as
>>> it doesn't apply to my tree :(
>>>
>>
>> I already sent it to the linux-iio list as Daniel suggested in a
>> previous message.
>> I hope it's ok.
> 
> Fine with me, thanks.
Hmm. This one got complex.  The fix needs to go prior to the driver move
but after the patch that broken. I've bodged it together and pushed out
a temporary branch fixes-togreg-post-rc1

I'll push that one on to Greg as the name suggests after rc1 is out and hence
the broken patch has gone into Linus' tree.   Then I'll deal with any fallout
in the togreg branch before sending that on to Greg.

At the end of the day, we have a broken fake driver - as long as we fix it reasonably
quickly no one other than Ioana will probably ever notice ;)

Jonathan

> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


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

end of thread, other threads:[~2015-10-31 10:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-27 18:40 [PATCH] staging: iio: dummy: complete IIO events delivery to userspace Ioana Ciornei
2015-10-28  8:26 ` [Outreachy kernel] " Daniel Baluta
2015-10-28 22:47 ` Greg KH
2015-10-28 22:49   ` Ioana Ciornei
2015-10-28 23:07     ` Greg KH
2015-10-31 10:39       ` Jonathan Cameron

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