> -----Original Message----- > From: Jonathan Cameron [mailto:jic23@xxxxxxxxxx] > Sent: Saturday, April 3, 2021 7:46 AM > To: linux-iio@xxxxxxxxxxxxxxx > Cc: Song Bao Hua (Barry Song) <song.bao.hua@xxxxxxxxxxxxx>; Jonathan Cameron > <jonathan.cameron@xxxxxxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>; > Alexandru Ardelean <ardeleanalex@xxxxxxxxx> > Subject: [PATCH 7/7] iio:adc:ad_sigma_delta: Use IRQF_NO_AUTOEN rather than > request and disable > > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > These devices are not able to mask the signal used as a data ready > interrupt. As such they previously requested the irq then immediately > disabled it. Now we can avoid the potential of a spurious interrupt > by avoiding the irq being auto enabled in the first place. > > I'm not sure how this code could have been called with the irq already > disabled, so I believe the conditional would always have been true and > have removed it. > If irq_dis is true, it seems the original code assumed interrupt was open. Now the code is moving to disable-irq for true irq_dis. For false irq_dis, this patch has no side effect so looks correct. A safer way might be as below? if(!sigma_delta->irq_dis) irq_flags = sigma_delta->info->irq_flags | IRQF_NO_AUTOEN; request_irq(irq_flags); sigma_delta->irq_dis = true; > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Cc: Lars-Peter Clausen <lars@xxxxxxxxxx> > Cc: Alexandru Ardelean <ardeleanalex@xxxxxxxxx> > --- > drivers/iio/adc/ad_sigma_delta.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/adc/ad_sigma_delta.c > b/drivers/iio/adc/ad_sigma_delta.c > index 9289812c0a94..e777ec718973 100644 > --- a/drivers/iio/adc/ad_sigma_delta.c > +++ b/drivers/iio/adc/ad_sigma_delta.c > @@ -485,18 +485,15 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev) > sigma_delta->trig->ops = &ad_sd_trigger_ops; > init_completion(&sigma_delta->completion); > > + sigma_delta->irq_dis = true; > ret = request_irq(sigma_delta->spi->irq, > ad_sd_data_rdy_trig_poll, > - sigma_delta->info->irq_flags, > + sigma_delta->info->irq_flags | IRQF_NO_AUTOEN, > indio_dev->name, > sigma_delta); > if (ret) > goto error_free_trig; > > - if (!sigma_delta->irq_dis) { > - sigma_delta->irq_dis = true; > - disable_irq_nosync(sigma_delta->spi->irq); > - } > iio_trigger_set_drvdata(sigma_delta->trig, sigma_delta); > > ret = iio_trigger_register(sigma_delta->trig); > -- > 2.31.1 Thanks Barry