Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:chemical:scd30: Use IRQF_NO_AUTOEN to avoid irq request then disable

This new flag cleanly avoids the need for a dance where we request the
interrupt only to immediately disabling it by ensuring it is not
auto-enabled in the first place.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.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-6-jic23@kernel.org

+8 -8
+8 -8
drivers/iio/chemical/scd30_core.c
··· 655 655 656 656 indio_dev->trig = iio_trigger_get(trig); 657 657 658 + /* 659 + * Interrupt is enabled just before taking a fresh measurement 660 + * and disabled afterwards. This means we need to ensure it is not 661 + * enabled here to keep calls to enable/disable balanced. 662 + */ 658 663 ret = devm_request_threaded_irq(dev, state->irq, scd30_irq_handler, 659 - scd30_irq_thread_handler, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, 664 + scd30_irq_thread_handler, 665 + IRQF_TRIGGER_HIGH | IRQF_ONESHOT | 666 + IRQF_NO_AUTOEN, 660 667 indio_dev->name, indio_dev); 661 668 if (ret) 662 669 dev_err(dev, "failed to request irq\n"); 663 - 664 - /* 665 - * Interrupt is enabled just before taking a fresh measurement 666 - * and disabled afterwards. This means we need to disable it here 667 - * to keep calls to enable/disable balanced. 668 - */ 669 - disable_irq(state->irq); 670 670 671 671 return ret; 672 672 }