Re: [PATCH 18/21] iio: Replace IRQF_ONESHOT with IRQF_NO_THREAD

Nuno Sá
2026-01-28T11:38:35Z

On Fri, 2026-01-23 at 12:37 +0100, Sebastian Andrzej Siewior wrote:
> Passing IRQF_ONESHOT ensures that the interrupt source is masked until
> the secondary (threaded) handler is done. If only a primary handler is
> used then the flag makes no sense because the interrupt can not fire
> (again) while its handler is running.
> The flag also disallows force-threading of the primary handler and the
> irq-core will warn about this.
>
> The intention here was probably not allowing forced-threading for
> handlers such as iio_trigger_generic_data_rdy_poll() will intends to
> invoke hard-interrupt handlers.
>
> Replace IRQF_ONESHOT with IRQF_NO_THREAD.
>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Michael Hennerich <Michael.Hennerich@analog.com>
> Cc: Puranjay Mohan <puranjay@kernel.org>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: David Lechner <dlechner@baylibre.com>
> Cc: "Nuno Sá" <nuno.sa@analog.com>
> Cc: Andy Shevchenko <andy@kernel.org>
> Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>
> Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
> Cc: Kent Gustavsson <kent@minoris.se>
> Cc: Gustavo Silva <gustavograzs@gmail.com>
> Cc: Nishant Malpani <nish.malpani25@gmail.com>
> Cc: linux-iio@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---

LGTM,

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/accel/adxl355_core.c       |  3 ++-
>  drivers/iio/accel/adxl372.c            |  9 ++++-----
>  drivers/iio/accel/mxc4005.c            | 11 ++++-------
>  drivers/iio/accel/stk8ba50.c           | 11 ++++-------
>  drivers/iio/adc/ad4170-4.c             |  2 +-
>  drivers/iio/adc/ad7768-1.c             |  5 ++---
>  drivers/iio/adc/ad7779.c               |  2 +-
>  drivers/iio/adc/mcp3911.c              |  2 +-
>  drivers/iio/adc/ti-ads131e08.c         |  2 +-
>  drivers/iio/chemical/ens160_core.c     |  9 +++------
>  drivers/iio/gyro/adxrs290.c            |  2 +-
>  drivers/iio/health/afe4403.c           |  9 ++++-----
>  drivers/iio/health/afe4404.c           |  9 ++++-----
>  drivers/iio/magnetometer/bmc150_magn.c |  9 +++------
>  drivers/iio/pressure/dlhl60d.c         |  6 +++---
>  drivers/iio/temperature/tmp006.c       | 10 ++++------
>  16 files changed, 42 insertions(+), 59 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl355_core.c b/drivers/iio/accel/adxl355_core.c
> index 5fc7f814b9077..04caa493176d3 100644
> --- a/drivers/iio/accel/adxl355_core.c
> +++ b/drivers/iio/accel/adxl355_core.c
> @@ -770,7 +770,8 @@ static int adxl355_probe_trigger(struct iio_dev *indio_dev, int irq)
>
>   ret = devm_request_irq(data->dev, irq,
>          &iio_trigger_generic_data_rdy_poll,
> -        IRQF_ONESHOT, "adxl355_irq", data->dready_trig);
> +        IRQF_NO_THREAD,
> +        "adxl355_irq", data->dready_trig);
>   if (ret)
>   return dev_err_probe(data->dev, ret, "request irq %d failed\n",
>        irq);
> diff --git a/drivers/iio/accel/adxl372.c b/drivers/iio/accel/adxl372.c
> index 46d518a2a0291..2f6aa52aeba51 100644
> --- a/drivers/iio/accel/adxl372.c
> +++ b/drivers/iio/accel/adxl372.c
> @@ -1247,11 +1247,10 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
>
>   indio_dev->trig = iio_trigger_get(st->dready_trig);
>
> - ret = devm_request_threaded_irq(dev, st->irq,
> - iio_trigger_generic_data_rdy_poll,
> - NULL,
> - IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> - indio_dev->name, st->dready_trig);
> + ret = devm_request_irq(dev, st->irq,
> +        iio_trigger_generic_data_rdy_poll,
> +        IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
> +        indio_dev->name, st->dready_trig);
>   if (ret < 0)
>   return ret;
>   }
> diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
> index ac973d871c8bb..a2c3cf13d0981 100644
> --- a/drivers/iio/accel/mxc4005.c
> +++ b/drivers/iio/accel/mxc4005.c
> @@ -486,13 +486,10 @@ static int mxc4005_probe(struct i2c_client *client)
>   if (!data->dready_trig)
>   return -ENOMEM;
>
> - ret = devm_request_threaded_irq(&client->dev, client->irq,
> - iio_trigger_generic_data_rdy_poll,
> - NULL,
> - IRQF_TRIGGER_FALLING |
> - IRQF_ONESHOT,
> - "mxc4005_event",
> - data->dready_trig);
> + ret = devm_request_irq(&client->dev, client->irq,
> +        iio_trigger_generic_data_rdy_poll,
> +        IRQF_TRIGGER_FALLING | IRQF_NO_THREAD,
> +        "mxc4005_event", data->dready_trig);
>   if (ret) {
>   dev_err(&client->dev,
>   "failed to init threaded irq\n");
> diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
> index 384f1fbcbcb37..a9ff2a273fe1c 100644
> --- a/drivers/iio/accel/stk8ba50.c
> +++ b/drivers/iio/accel/stk8ba50.c
> @@ -428,13 +428,10 @@ static int stk8ba50_probe(struct i2c_client *client)
>   }
>
>   if (client->irq > 0) {
> - ret = devm_request_threaded_irq(&client->dev, client->irq,
> - stk8ba50_data_rdy_trig_poll,
> - NULL,
> - IRQF_TRIGGER_RISING |
> - IRQF_ONESHOT,
> - "stk8ba50_event",
> - indio_dev);
> + ret = devm_request_irq(&client->dev, client->irq,
> +        stk8ba50_data_rdy_trig_poll,
> +        IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
> +        "stk8ba50_event", indio_dev);
>   if (ret < 0) {
>   dev_err(&client->dev, "request irq %d failed\n",
>   client->irq);
> diff --git a/drivers/iio/adc/ad4170-4.c b/drivers/iio/adc/ad4170-4.c
> index efaed92191f1b..82205bfae531e 100644
> --- a/drivers/iio/adc/ad4170-4.c
> +++ b/drivers/iio/adc/ad4170-4.c
> @@ -2973,7 +2973,7 @@ static int ad4170_probe(struct spi_device *spi)
>
>   if (spi->irq) {
>   ret = devm_request_irq(dev, spi->irq, &ad4170_irq_handler,
> -        IRQF_ONESHOT, indio_dev->name, indio_dev);
> +        IRQF_NO_THREAD, indio_dev->name, indio_dev);
>   if (ret)
>   return ret;
>
> diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
> index d96802b7847a6..84ce23c8e5782 100644
> --- a/drivers/iio/adc/ad7768-1.c
> +++ b/drivers/iio/adc/ad7768-1.c
> @@ -1394,9 +1394,8 @@ static int ad7768_probe(struct spi_device *spi)
>   if (ret)
>   return ret;
>
> - ret = devm_request_irq(&spi->dev, spi->irq,
> -        &ad7768_interrupt,
> -        IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> + ret = devm_request_irq(&spi->dev, spi->irq, &ad7768_interrupt,
> +        IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
>          indio_dev->name, indio_dev);
>   if (ret)
>   return ret;
> diff --git a/drivers/iio/adc/ad7779.c b/drivers/iio/adc/ad7779.c
> index aac5049c9a07b..695cc79e78da5 100644
> --- a/drivers/iio/adc/ad7779.c
> +++ b/drivers/iio/adc/ad7779.c
> @@ -840,7 +840,7 @@ static int ad7779_setup_without_backend(struct ad7779_state *st, struct
> iio_dev
>   iio_trigger_set_drvdata(st->trig, st);
>
>   ret = devm_request_irq(dev, st->spi->irq, iio_trigger_generic_data_rdy_poll,
> -        IRQF_ONESHOT | IRQF_NO_AUTOEN, indio_dev->name,
> +        IRQF_NO_THREAD | IRQF_NO_AUTOEN, indio_dev->name,
>          st->trig);
>   if (ret)
>   return dev_err_probe(dev, ret, "request IRQ %d failed\n",
> diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
> index a6f21791c6859..ddc3721f3f688 100644
> --- a/drivers/iio/adc/mcp3911.c
> +++ b/drivers/iio/adc/mcp3911.c
> @@ -815,7 +815,7 @@ static int mcp3911_probe(struct spi_device *spi)
>   * don't enable the interrupt to avoid extra load on the system.
>   */
>   ret = devm_request_irq(dev, spi->irq, &iio_trigger_generic_data_rdy_poll,
> -        IRQF_NO_AUTOEN | IRQF_ONESHOT,
> +        IRQF_NO_AUTOEN | IRQF_NO_THREAD,
>          indio_dev->name, adc->trig);
>   if (ret)
>   return ret;
> diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c
> index c9a20024d6b11..a585621b0bc30 100644
> --- a/drivers/iio/adc/ti-ads131e08.c
> +++ b/drivers/iio/adc/ti-ads131e08.c
> @@ -827,7 +827,7 @@ static int ads131e08_probe(struct spi_device *spi)
>   if (spi->irq) {
>   ret = devm_request_irq(&spi->dev, spi->irq,
>   ads131e08_interrupt,
> - IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> + IRQF_TRIGGER_FALLING | IRQF_NO_THREAD,
>   spi->dev.driver->name, indio_dev);
>   if (ret)
>   return dev_err_probe(&spi->dev, ret,
> diff --git a/drivers/iio/chemical/ens160_core.c b/drivers/iio/chemical/ens160_core.c
> index 86bde4a91bf7e..bbc96c4c62838 100644
> --- a/drivers/iio/chemical/ens160_core.c
> +++ b/drivers/iio/chemical/ens160_core.c
> @@ -316,12 +316,9 @@ static int ens160_setup_trigger(struct iio_dev *indio_dev, int irq)
>
>   indio_dev->trig = iio_trigger_get(trig);
>
> - ret = devm_request_threaded_irq(dev, irq,
> - iio_trigger_generic_data_rdy_poll,
> - NULL,
> - IRQF_ONESHOT,
> - indio_dev->name,
> - indio_dev->trig);
> + ret = devm_request_irq(dev, irq, iio_trigger_generic_data_rdy_poll,
> +        IRQF_NO_THREAD, indio_dev->name,
> +        indio_dev->trig);
>   if (ret)
>   return dev_err_probe(dev, ret, "failed to request irq\n");
>
> diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
> index 8fcb41f45baac..3efe385ebedc4 100644
> --- a/drivers/iio/gyro/adxrs290.c
> +++ b/drivers/iio/gyro/adxrs290.c
> @@ -597,7 +597,7 @@ static int adxrs290_probe_trigger(struct iio_dev *indio_dev)
>
>   ret = devm_request_irq(&st->spi->dev, st->spi->irq,
>          &iio_trigger_generic_data_rdy_poll,
> -        IRQF_ONESHOT, "adxrs290_irq", st->dready_trig);
> +        IRQF_NO_THREAD, "adxrs290_irq", st->dready_trig);
>   if (ret < 0)
>   return dev_err_probe(&st->spi->dev, ret,
>        "request irq %d failed\n", st->spi->irq);
> diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
> index 0e5a512e3bb8f..d358f4d5e5da8 100644
> --- a/drivers/iio/health/afe4403.c
> +++ b/drivers/iio/health/afe4403.c
> @@ -540,11 +540,10 @@ static int afe4403_probe(struct spi_device *spi)
>   return ret;
>   }
>
> - ret = devm_request_threaded_irq(dev, afe->irq,
> - iio_trigger_generic_data_rdy_poll,
> - NULL, IRQF_ONESHOT,
> - AFE4403_DRIVER_NAME,
> - afe->trig);
> + ret = devm_request_irq(dev, afe->irq,
> +        iio_trigger_generic_data_rdy_poll,
> +        IRQF_NO_THREAD, AFE4403_DRIVER_NAME,
> +        afe->trig);
>   if (ret) {
>   dev_err(dev, "Unable to request IRQ\n");
>   return ret;
> diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
> index 768d794e574b9..032da52a96d0e 100644
> --- a/drivers/iio/health/afe4404.c
> +++ b/drivers/iio/health/afe4404.c
> @@ -547,11 +547,10 @@ static int afe4404_probe(struct i2c_client *client)
>   return ret;
>   }
>
> - ret = devm_request_threaded_irq(dev, afe->irq,
> - iio_trigger_generic_data_rdy_poll,
> - NULL, IRQF_ONESHOT,
> - AFE4404_DRIVER_NAME,
> - afe->trig);
> + ret = devm_request_irq(dev, afe->irq,
> +        iio_trigger_generic_data_rdy_poll,
> +        IRQF_NO_THREAD, AFE4404_DRIVER_NAME,
> +        afe->trig);
>   if (ret) {
>   dev_err(dev, "Unable to request IRQ\n");
>   return ret;
> diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c
> index 6a73f6e2f1f06..a022e1805dff7 100644
> --- a/drivers/iio/magnetometer/bmc150_magn.c
> +++ b/drivers/iio/magnetometer/bmc150_magn.c
> @@ -906,12 +906,9 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap,
>   goto err_poweroff;
>   }
>
> - ret = request_threaded_irq(irq,
> -    iio_trigger_generic_data_rdy_poll,
> -    NULL,
> -    IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> -    "bmc150_magn_event",
> -    data->dready_trig);
> + ret = request_irq(irq, iio_trigger_generic_data_rdy_poll,
> +   IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
> +   "bmc150_magn_event", data->dready_trig);
>   if (ret < 0) {
>   dev_err(dev, "request irq %d failed\n", irq);
>   goto err_trigger_unregister;
> diff --git a/drivers/iio/pressure/dlhl60d.c b/drivers/iio/pressure/dlhl60d.c
> index 8bad7162fec64..e975b733ce0a1 100644
> --- a/drivers/iio/pressure/dlhl60d.c
> +++ b/drivers/iio/pressure/dlhl60d.c
> @@ -306,9 +306,9 @@ static int dlh_probe(struct i2c_client *client)
>   indio_dev->num_channels = ARRAY_SIZE(dlh_channels);
>
>   if (client->irq > 0) {
> - ret = devm_request_threaded_irq(&client->dev, client->irq,
> - dlh_interrupt, NULL,
> - IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> + ret = devm_request_irq(&client->dev, client->irq,
> +        dlh_interrupt,
> +        IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
>   st->info->name, indio_dev);
>   if (ret) {
>   dev_err(&client->dev, "failed to allocate threaded irq");
> diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
> index 10bd3f221929d..d8d8c8936d177 100644
> --- a/drivers/iio/temperature/tmp006.c
> +++ b/drivers/iio/temperature/tmp006.c
> @@ -356,12 +356,10 @@ static int tmp006_probe(struct i2c_client *client)
>
>   indio_dev->trig = iio_trigger_get(data->drdy_trig);
>
> - ret = devm_request_threaded_irq(&client->dev, client->irq,
> - iio_trigger_generic_data_rdy_poll,
> - NULL,
> - IRQF_ONESHOT,
> - "tmp006_irq",
> - data->drdy_trig);
> + ret = devm_request_irq(&client->dev, client->irq,
> +        iio_trigger_generic_data_rdy_poll,
> +        IRQF_NO_THREAD, "tmp006_irq",
> +        data->drdy_trig);
>   if (ret < 0)
>   return ret;
>   }