Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Barry Song <song.bao.hua@hisilicon.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 1/7] iio:adc:ad7766: Use new IRQF_NO_AUTOEN to reduce boilerplate
Date: Fri,  2 Apr 2021 19:45:38 +0100
Message-ID: <20210402184544.488862-2-jic23@kernel.org> (raw)
In-Reply-To: <20210402184544.488862-1-jic23@kernel.org>

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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>
---
 drivers/iio/adc/ad7766.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/ad7766.c b/drivers/iio/adc/ad7766.c
index 829a3426f235..1e41759f3ee5 100644
--- a/drivers/iio/adc/ad7766.c
+++ b/drivers/iio/adc/ad7766.c
@@ -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)
-- 
2.31.1


  reply index

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 18:45 [PATCH 0/7] iio: Use IRQF_NO_AUTOEN Jonathan Cameron
2021-04-02 18:45 ` Jonathan Cameron [this message]
2021-04-02 20:10   ` [PATCH 1/7] iio:adc:ad7766: Use new IRQF_NO_AUTOEN to reduce boilerplate Song Bao Hua (Barry Song)
2021-04-05 14:27     ` Jonathan Cameron
2021-04-02 18:45 ` [PATCH 2/7] iio:adc:exynos-adc: Use new IRQF_NO_AUTOEN flag rather than separate irq_disable() Jonathan Cameron
2021-04-02 20:11   ` Song Bao Hua (Barry Song)
2021-04-04 19:20   ` Krzysztof Kozlowski
2021-04-05 14:29     ` Jonathan Cameron
2021-04-02 18:45 ` [PATCH 3/7] iio:adc:nau7802: Use IRQF_NO_AUTOEN instead of request then disable Jonathan Cameron
2021-04-02 20:12   ` Song Bao Hua (Barry Song)
2021-04-05 14:33     ` Jonathan Cameron
2021-04-02 18:45 ` [PATCH 4/7] iio:adc:sun4i-gpadc: Use new IRQF_NO_AUTOEN flag " Jonathan Cameron
2021-04-02 20:13   ` Song Bao Hua (Barry Song)
2021-04-05 14:35     ` Jonathan Cameron
2021-04-02 18:45 ` [PATCH 5/7] iio:chemical:scd30: Use IRQF_NO_AUTOEN to avoid irq " Jonathan Cameron
2021-04-02 20:14   ` Song Bao Hua (Barry Song)
2021-04-05 14:36     ` Jonathan Cameron
2021-04-02 18:45 ` [PATCH 6/7] iio:imu:adis: Use IRQF_NO_AUTOEN instead of " Jonathan Cameron
2021-04-02 20:37   ` Song Bao Hua (Barry Song)
2021-04-05 14:40     ` Jonathan Cameron
2021-04-06 11:48       ` Sa, Nuno
2021-04-02 18:45 ` [PATCH 7/7] iio:adc:ad_sigma_delta: Use IRQF_NO_AUTOEN rather than request and disable Jonathan Cameron
2021-04-02 20:30   ` Song Bao Hua (Barry Song)
2021-04-05 14:51     ` Jonathan Cameron
2021-04-05 22:56       ` Song Bao Hua (Barry Song)
2021-04-02 19:00 ` [PATCH 0/7] iio: Use IRQF_NO_AUTOEN Andy Shevchenko
2021-04-03 11:45 ` Lars-Peter Clausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210402184544.488862-2-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=song.bao.hua@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git