public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] iio: adc: ads1119: Fix IRQ flags
@ 2024-07-31 14:06 Francesco Dolcini
  2024-07-31 14:20 ` João Paulo Gonçalves
  0 siblings, 1 reply; 5+ messages in thread
From: Francesco Dolcini @ 2024-07-31 14:06 UTC (permalink / raw)
  To: Francesco Dolcini, João Paulo Gonçalves,
	Jonathan Cameron, Lars-Peter Clausen
  Cc: Francesco Dolcini, linux-iio, linux-kernel

From: Francesco Dolcini <francesco.dolcini@toradex.com>

Remove IRQF_TRIGGER_FALLING flag from irq request, this should come from
the platform firmware and should not be hard-coded into the driver.

Add IRQF_ONESHOT flag to the irq request, the interrupt should not be
re-activated in interrupt context, it should be done only after the
device irq handler run.

Fixes: a9306887eba4 ("iio: adc: ti-ads1119: Add driver")
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
 drivers/iio/adc/ti-ads1119.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c
index 630f5d5f9a60..d649980479e4 100644
--- a/drivers/iio/adc/ti-ads1119.c
+++ b/drivers/iio/adc/ti-ads1119.c
@@ -735,7 +735,7 @@ static int ads1119_probe(struct i2c_client *client)
 	if (client->irq > 0) {
 		ret = devm_request_threaded_irq(dev, client->irq,
 						ads1119_irq_handler,
-						NULL, IRQF_TRIGGER_FALLING,
+						NULL, IRQF_ONESHOT,
 						"ads1119", indio_dev);
 		if (ret)
 			return dev_err_probe(dev, ret,
-- 
2.39.2


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

* Re: [PATCH v1] iio: adc: ads1119: Fix IRQ flags
  2024-07-31 14:06 [PATCH v1] iio: adc: ads1119: Fix IRQ flags Francesco Dolcini
@ 2024-07-31 14:20 ` João Paulo Gonçalves
  2024-08-03 11:21   ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: João Paulo Gonçalves @ 2024-07-31 14:20 UTC (permalink / raw)
  To: Francesco Dolcini
  Cc: Jonathan Cameron, Lars-Peter Clausen, Francesco Dolcini,
	linux-iio, linux-kernel

On Wed, Jul 31, 2024 at 04:06:57PM +0200, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> Remove IRQF_TRIGGER_FALLING flag from irq request, this should come from
> the platform firmware and should not be hard-coded into the driver.
> 
> Add IRQF_ONESHOT flag to the irq request, the interrupt should not be
> re-activated in interrupt context, it should be done only after the
> device irq handler run.
>

Reviwed-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>

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

* Re: [PATCH v1] iio: adc: ads1119: Fix IRQ flags
  2024-07-31 14:20 ` João Paulo Gonçalves
@ 2024-08-03 11:21   ` Jonathan Cameron
  2024-08-03 12:12     ` Francesco Dolcini
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2024-08-03 11:21 UTC (permalink / raw)
  To: João Paulo Gonçalves
  Cc: Francesco Dolcini, Lars-Peter Clausen, Francesco Dolcini,
	linux-iio, linux-kernel

On Wed, 31 Jul 2024 11:20:16 -0300
João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com> wrote:

> On Wed, Jul 31, 2024 at 04:06:57PM +0200, Francesco Dolcini wrote:
> > From: Francesco Dolcini <francesco.dolcini@toradex.com>
> > 
> > Remove IRQF_TRIGGER_FALLING flag from irq request, this should come from
> > the platform firmware and should not be hard-coded into the driver.
> > 
> > Add IRQF_ONESHOT flag to the irq request, the interrupt should not be
> > re-activated in interrupt context, it should be done only after the
> > device irq handler run.
> >  
> 
> Reviwed-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>

For the direction, there is a risk that we will break someone who
has a firmware that isn't setting this correctly.
I don't mind doing that if we have another board that needs control
(and is setting it appropriately) though.  Is that true here, or is
this just cleanup?

If it's cleanup we tend to leave these alone (but not introduce them
into new code!)

Jonathan

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

* Re: [PATCH v1] iio: adc: ads1119: Fix IRQ flags
  2024-08-03 11:21   ` Jonathan Cameron
@ 2024-08-03 12:12     ` Francesco Dolcini
  2024-08-03 15:48       ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Francesco Dolcini @ 2024-08-03 12:12 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: João Paulo Gonçalves, Francesco Dolcini,
	Lars-Peter Clausen, Francesco Dolcini, linux-iio, linux-kernel

Hello Jonathan,

On Sat, Aug 03, 2024 at 12:21:27PM +0100, Jonathan Cameron wrote:
> On Wed, 31 Jul 2024 11:20:16 -0300
> João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com> wrote:
> 
> > On Wed, Jul 31, 2024 at 04:06:57PM +0200, Francesco Dolcini wrote:
> > > From: Francesco Dolcini <francesco.dolcini@toradex.com>
> > > 
> > > Remove IRQF_TRIGGER_FALLING flag from irq request, this should come from
> > > the platform firmware and should not be hard-coded into the driver.
> > > 
> > > Add IRQF_ONESHOT flag to the irq request, the interrupt should not be
> > > re-activated in interrupt context, it should be done only after the
> > > device irq handler run.
> > >  
> > 
> > Reviwed-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
> 
> For the direction, there is a risk that we will break someone who
> has a firmware that isn't setting this correctly.

> I don't mind doing that if we have another board that needs control
> (and is setting it appropriately) though.  Is that true here, or is
> this just cleanup?
> 
> If it's cleanup we tend to leave these alone (but not introduce them
> into new code!)

The driver was just introduced by me in v6.11, I assume that the only
user is a board that is not yet available in the upstream Linux kernel
(we gonna send the DT soon), with that said I am relatively confident we
are not going to break any user.

The reason for sending this patch is that we just stumbled across
a different driver that was hard-coding the IRQ flags and it was not working
for our hardware, at that moment I realized that the decision on the just
added ti-ads1119 was not the best one.

The idea of this patch is to clean this up _before_ any user is
affected.

Francesco


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

* Re: [PATCH v1] iio: adc: ads1119: Fix IRQ flags
  2024-08-03 12:12     ` Francesco Dolcini
@ 2024-08-03 15:48       ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2024-08-03 15:48 UTC (permalink / raw)
  To: Francesco Dolcini
  Cc: João Paulo Gonçalves, Lars-Peter Clausen,
	Francesco Dolcini, linux-iio, linux-kernel

On Sat, 3 Aug 2024 14:12:52 +0200
Francesco Dolcini <francesco@dolcini.it> wrote:

> Hello Jonathan,
> 
> On Sat, Aug 03, 2024 at 12:21:27PM +0100, Jonathan Cameron wrote:
> > On Wed, 31 Jul 2024 11:20:16 -0300
> > João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com> wrote:
> >   
> > > On Wed, Jul 31, 2024 at 04:06:57PM +0200, Francesco Dolcini wrote:  
> > > > From: Francesco Dolcini <francesco.dolcini@toradex.com>
> > > > 
> > > > Remove IRQF_TRIGGER_FALLING flag from irq request, this should come from
> > > > the platform firmware and should not be hard-coded into the driver.
> > > > 
> > > > Add IRQF_ONESHOT flag to the irq request, the interrupt should not be
> > > > re-activated in interrupt context, it should be done only after the
> > > > device irq handler run.
> > > >    
> > > 
> > > Reviwed-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>  
> > 
> > For the direction, there is a risk that we will break someone who
> > has a firmware that isn't setting this correctly.  
> 
> > I don't mind doing that if we have another board that needs control
> > (and is setting it appropriately) though.  Is that true here, or is
> > this just cleanup?
> > 
> > If it's cleanup we tend to leave these alone (but not introduce them
> > into new code!)  
> 
> The driver was just introduced by me in v6.11, I assume that the only
> user is a board that is not yet available in the upstream Linux kernel
> (we gonna send the DT soon), with that said I am relatively confident we
> are not going to break any user.

ah! I'd missed the timeline detail completely.  Too many drivers and they
all have similar names :)

> 
> The reason for sending this patch is that we just stumbled across
> a different driver that was hard-coding the IRQ flags and it was not working
> for our hardware, at that moment I realized that the decision on the just
> added ti-ads1119 was not the best one.
> 
> The idea of this patch is to clean this up _before_ any user is
> affected.
> 
Excellent.  Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan


> Francesco
> 


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

end of thread, other threads:[~2024-08-03 15:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 14:06 [PATCH v1] iio: adc: ads1119: Fix IRQ flags Francesco Dolcini
2024-07-31 14:20 ` João Paulo Gonçalves
2024-08-03 11:21   ` Jonathan Cameron
2024-08-03 12:12     ` Francesco Dolcini
2024-08-03 15:48       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox