summaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu/adis_trigger.c
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2021-04-02 20:45:43 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-04-07 09:36:39 +0200
commit30f6a542b7d39b1ba990a28a3891bc03691d8d41 (patch)
treed85fde15b2fac0a533ed1f6a043032e43e111d36 /drivers/iio/imu/adis_trigger.c
parentiio:chemical:scd30: Use IRQF_NO_AUTOEN to avoid irq request then disable (diff)
downloadlinux-30f6a542b7d39b1ba990a28a3891bc03691d8d41.tar.xz
linux-30f6a542b7d39b1ba990a28a3891bc03691d8d41.zip
iio:imu:adis: Use IRQF_NO_AUTOEN instead of irq request then disable
This is a bit involved as the adis library code already has some sanity checking of the flags of the requested irq that we need to ensure is happy to pass through the IRQF_NO_AUTOEN flag untouched. Using this flag avoids us autoenabling the irq in the adis16460 and adis16475 drivers which cover parts that don't have any means of masking the interrupt on the device end. Note, compile tested only! Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Alexandru Ardelean <ardeleanalex@gmail.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> 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-7-jic23@kernel.org
Diffstat (limited to 'drivers/iio/imu/adis_trigger.c')
-rw-r--r--drivers/iio/imu/adis_trigger.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index 0f29e56200af..fa5540fabacc 100644
--- a/drivers/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -29,18 +29,19 @@ static const struct iio_trigger_ops adis_trigger_ops = {
static int adis_validate_irq_flag(struct adis *adis)
{
+ unsigned long direction = adis->irq_flag & IRQF_TRIGGER_MASK;
/*
* Typically this devices have data ready either on the rising edge or
* on the falling edge of the data ready pin. This checks enforces that
* one of those is set in the drivers... It defaults to
- * IRQF_TRIGGER_RISING for backward compatibility wiht devices that
+ * IRQF_TRIGGER_RISING for backward compatibility with devices that
* don't support changing the pin polarity.
*/
- if (!adis->irq_flag) {
- adis->irq_flag = IRQF_TRIGGER_RISING;
+ if (direction == IRQF_TRIGGER_NONE) {
+ adis->irq_flag |= IRQF_TRIGGER_RISING;
return 0;
- } else if (adis->irq_flag != IRQF_TRIGGER_RISING &&
- adis->irq_flag != IRQF_TRIGGER_FALLING) {
+ } else if (direction != IRQF_TRIGGER_RISING &&
+ direction != IRQF_TRIGGER_FALLING) {
dev_err(&adis->spi->dev, "Invalid IRQ mask: %08lx\n",
adis->irq_flag);
return -EINVAL;