iio:adc:ad7766: Use new IRQF_NO_AUTOEN to reduce boilerplate

As iio_poll_trigger() is safe against spurious interrupts when the
trigger is not enabled, this is not a fix despite looking like
a race.  It is nice to simplify the code however so the interrupt
is never enabled in the first place.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Barry Song <song.bao.hua@hisilicon.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20210402184544.488862-2-jic23@kernel.org
This commit is contained in:
Jonathan Cameron 2021-04-02 19:45:38 +01:00
parent aefaee4ec8
commit 0be49bdedc
1 changed files with 7 additions and 8 deletions

View File

@ -255,18 +255,17 @@ static int ad7766_probe(struct spi_device *spi)
ad7766->trig->ops = &ad7766_trigger_ops;
iio_trigger_set_drvdata(ad7766->trig, ad7766);
ret = devm_request_irq(&spi->dev, spi->irq, ad7766_irq,
IRQF_TRIGGER_FALLING, dev_name(&spi->dev),
ad7766->trig);
if (ret < 0)
return ret;
/*
* The device generates interrupts as long as it is powered up.
* Some platforms might not allow the option to power it down so
* disable the interrupt to avoid extra load on the system
* don't enable the interrupt to avoid extra load on the system
*/
disable_irq(spi->irq);
ret = devm_request_irq(&spi->dev, spi->irq, ad7766_irq,
IRQF_TRIGGER_FALLING | IRQF_NO_AUTOEN,
dev_name(&spi->dev),
ad7766->trig);
if (ret < 0)
return ret;
ret = devm_iio_trigger_register(&spi->dev, ad7766->trig);
if (ret)