diff mbox series

[v8,4/5] iio: imu: st_lsm6dsx: always enter interrupt thread

Message ID 20190913090708.1442057-5-sean@geanix.com (mailing list archive)
State New, archived
Headers show
Series enable motion events for st_lsm6dsx | expand

Commit Message

Sean Nyekjaer Sept. 13, 2019, 9:07 a.m. UTC
The interrupt source can come from multiple sources,
fifo and wake interrupts.
Enter interrupt thread to check which interrupt that has fired.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jonathan Cameron Sept. 15, 2019, 12:33 p.m. UTC | #1
On Fri, 13 Sep 2019 11:07:07 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> The interrupt source can come from multiple sources,
> fifo and wake interrupts.
> Enter interrupt thread to check which interrupt that has fired.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index 810807c52d5f..80a94335175f 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -1717,9 +1717,7 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw,
>  
>  static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
>  {
> -	struct st_lsm6dsx_hw *hw = private;
> -
> -	return hw->sip > 0 ? IRQ_WAKE_THREAD : IRQ_NONE;
> +	return IRQ_WAKE_THREAD;

I missed this before.  Isn't this the same as just not providing a top half at all?

I.e. Pass null to request_threaded_irq where this function was.

Thanks,

Jonathan


>  }
>  
>  static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)
Lorenzo Bianconi Sept. 15, 2019, 12:48 p.m. UTC | #2
> On Fri, 13 Sep 2019 11:07:07 +0200
> Sean Nyekjaer <sean@geanix.com> wrote:
> 
> > The interrupt source can come from multiple sources,
> > fifo and wake interrupts.
> > Enter interrupt thread to check which interrupt that has fired.
> > 
> > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > ---
> >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > index 810807c52d5f..80a94335175f 100644
> > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > @@ -1717,9 +1717,7 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw,
> >  
> >  static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
> >  {
> > -	struct st_lsm6dsx_hw *hw = private;
> > -
> > -	return hw->sip > 0 ? IRQ_WAKE_THREAD : IRQ_NONE;
> > +	return IRQ_WAKE_THREAD;
> 
> I missed this before.  Isn't this the same as just not providing a top half at all?
> 
> I.e. Pass null to request_threaded_irq where this function was.
> 
> Thanks,
> 
> Jonathan

Right, for the moment we do not need it. It will be probably useful adding
buffering support for sensors that do not support hw timestamping in FIFO
(e.g. LSM9DS1). I am fine both ways, so up to you.

Regards,
Lorenzo

> 
> 
> >  }
> >  
> >  static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)
>
Jonathan Cameron Sept. 15, 2019, 1 p.m. UTC | #3
On Sun, 15 Sep 2019 14:48:40 +0200
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> > On Fri, 13 Sep 2019 11:07:07 +0200
> > Sean Nyekjaer <sean@geanix.com> wrote:
> >   
> > > The interrupt source can come from multiple sources,
> > > fifo and wake interrupts.
> > > Enter interrupt thread to check which interrupt that has fired.
> > > 
> > > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > > ---
> > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > index 810807c52d5f..80a94335175f 100644
> > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > @@ -1717,9 +1717,7 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw,
> > >  
> > >  static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
> > >  {
> > > -	struct st_lsm6dsx_hw *hw = private;
> > > -
> > > -	return hw->sip > 0 ? IRQ_WAKE_THREAD : IRQ_NONE;
> > > +	return IRQ_WAKE_THREAD;  
> > 
> > I missed this before.  Isn't this the same as just not providing a top half at all?
> > 
> > I.e. Pass null to request_threaded_irq where this function was.
> > 
> > Thanks,
> > 
> > Jonathan  
> 
> Right, for the moment we do not need it. It will be probably useful adding
> buffering support for sensors that do not support hw timestamping in FIFO
> (e.g. LSM9DS1). I am fine both ways, so up to you.
Scrap it for now. I suspect someone will have a script out there that will
fire on this and generate a patch removing it.  Better to not waste people's
time!

Thanks,

Jonathan

> 
> Regards,
> Lorenzo
> 
> > 
> >   
> > >  }
> > >  
> > >  static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)  
> >
Lorenzo Bianconi Sept. 15, 2019, 1:07 p.m. UTC | #4
> On Sun, 15 Sep 2019 14:48:40 +0200
> Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> 
> > > On Fri, 13 Sep 2019 11:07:07 +0200
> > > Sean Nyekjaer <sean@geanix.com> wrote:
> > >   
> > > > The interrupt source can come from multiple sources,
> > > > fifo and wake interrupts.
> > > > Enter interrupt thread to check which interrupt that has fired.
> > > > 
> > > > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > > > ---
> > > >  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +---
> > > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > > index 810807c52d5f..80a94335175f 100644
> > > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > > @@ -1717,9 +1717,7 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw,
> > > >  
> > > >  static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
> > > >  {
> > > > -	struct st_lsm6dsx_hw *hw = private;
> > > > -
> > > > -	return hw->sip > 0 ? IRQ_WAKE_THREAD : IRQ_NONE;
> > > > +	return IRQ_WAKE_THREAD;  
> > > 
> > > I missed this before.  Isn't this the same as just not providing a top half at all?
> > > 
> > > I.e. Pass null to request_threaded_irq where this function was.
> > > 
> > > Thanks,
> > > 
> > > Jonathan  
> > 
> > Right, for the moment we do not need it. It will be probably useful adding
> > buffering support for sensors that do not support hw timestamping in FIFO
> > (e.g. LSM9DS1). I am fine both ways, so up to you.
> Scrap it for now. I suspect someone will have a script out there that will
> fire on this and generate a patch removing it.  Better to not waste people's
> time!

ack :)
@Sean: can you please fix it in v9?

Regards,
Lorenzo

> 
> Thanks,
> 
> Jonathan
> 
> > 
> > Regards,
> > Lorenzo
> > 
> > > 
> > >   
> > > >  }
> > > >  
> > > >  static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)  
> > >   
>
diff mbox series

Patch

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index 810807c52d5f..80a94335175f 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -1717,9 +1717,7 @@  static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw,
 
 static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
 {
-	struct st_lsm6dsx_hw *hw = private;
-
-	return hw->sip > 0 ? IRQ_WAKE_THREAD : IRQ_NONE;
+	return IRQ_WAKE_THREAD;
 }
 
 static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)