iio: buffer: fix warning in requesting threaded irq
PATCH 1/1 iio: buffer: fix warning in requesting threaded irq
IRQF_ONESHOT is for threaded IRQ. If there is no threaded IRQ handler, this flag should not be set.
This change fixes a warning during booting with kernel v7.0-rc3:
[ 18.322081] WARNING: kernel/irq/manage.c:1502 at __setup_irq+0x1639/0x2510, CPU#3: iio-sensor-prox/974 [ 18.322097] Modules linked in: snd_hda_intel snd_sof_pci_intel_mtl snd_sof_intel_hda_generic soundwire_intel snd_sof_intel_hda_sdw_bpt snd_sof_intel_hda_common snd_soc_hdac_hda snd_sof_intel_hda_mlink snd_sof_intel_hda soundwire_cadence snd_sof_pci snd_sof_xtensa_dsp snd_soc_sdw_utils snd_sof snd_sof_utils snd_hda_ext_core snd_hda_codec snd_hda_core snd_intel_dspcfg snd_intel_sdw_acpi snd_soc_acpi_intel_match snd_soc_acpi_intel_sdca_quirks soundwire_generic_allocation snd_soc_acpi snd_hwdep soundwire_bus snd_soc_sdca snd_soc_core snd_compress intel_uncore_frequency ac97_bus intel_uncore_frequency_common snd_pcm_dmaengine x86_pkg_temp_thermal intel_powerclamp snd_pcm coretemp snd_seq_midi snd_seq_midi_event kvm_intel snd_rawmidi i915(+) binfmt_misc snd_seq kvm snd_seq_device snd_timer irqbypass prime_numbers cmdlinepart ghash_clmulni_intel processor_thermal_device_pci drm_buddy snd aesni_intel processor_thermal_device spi_nor ttm nls_iso8859_1 mei_gsc_proxy intel_rapl_msr wmi_bmof rapl mtd intel_cstate drm_client_lib [ 18.322243] processor_thermal_wt_hint i2c_i801 hid_sensor_rotation hid_sensor_incl_3d soundcore hid_sensor_accel_3d hid_sensor_prox hid_sensor_magn_3d hid_sensor_custom_intel_hinge hid_sensor_als hid_sensor_gyro_3d platform_temperature_control hid_sensor_trigger processor_thermal_soc_slider industrialio_triggered_buffer intel_pmc_core crc8 i2c_mux platform_profile kfifo_buf processor_thermal_rfim i2c_smbus drm_display_helper hid_sensor_iio_common processor_thermal_rapl industrialio intel_vpu cec intel_rapl_common mei_me processor_thermal_wt_req rc_core drm_shmem_helper processor_thermal_power_floor mei idma64 i2c_algo_bit drm_kms_helper processor_thermal_mbox int3403_thermal pmt_telemetry int340x_thermal_zone pmt_discovery pmt_class int3400_thermal intel_pmc_ssram_telemetry acpi_thermal_rel intel_pmc_pwrm_telemetry intel_hid input_leds acpi_tad acpi_pad sparse_keymap joydev mac_hid sch_fq_codel msr parport_pc ppdev lp parport efi_pstore nfnetlink dmi_sysfs autofs4 hid_sensor_custom ucsi_acpi typec_ucsi hid_sensor_hub [ 18.322391] typec spi_pxa2xx_platform uas dw_dmac dw_dmac_core ahci usb_storage usbhid hid_generic spi_pxa2xx_core libahci e1000e thunderbolt vmd video pinctrl_meteorpoint pinctrl_meteorlake wmi pinctrl_intel [ 18.322435] CPU: 3 UID: 0 PID: 974 Comm: iio-sensor-prox Not tainted 7.0.0-rc3 #16 PREEMPT(lazy) [ 18.322443] Hardware name: Intel Corporation Arrow Lake Client Platform/MTL-S UDIMM 1DPC EVCRB, BIOS MTLSEMI1.R00.5124.D41.2504210658 04/21/2025 [ 18.322447] RIP: 0010:__setup_irq+0x1639/0x2510 [ 18.322455] Code: b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 84 75 f0 ff ff 48 8b 7d c8 e8 21 ea 99 00 e9 67 f0 ff ff e8 87 2f 21 00 <0f> 0b 31 ff 44 89 ee e8 3b 25 21 00 45 85 ed 0f 84 f0 f1 ff ff bb [ 18.322461] RSP: 0018:ffff8881387c7698 EFLAGS: 00010246 [ 18.322467] RAX: 0000000000000000 RBX: 0000000000002000 RCX: 0000000000000000 [ 18.322471] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 18.322475] RBP: ffff8881387c7748 R08: 0000000000000000 R09: 0000000000000000 [ 18.322479] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000400 [ 18.322483] R13: 0000000000000000 R14: ffff888102718f20 R15: ffff888102718f00 [ 18.322488] FS: 0000700e74a2a900(0000) GS:ffff8888ab3c4000(0000) knlGS:0000000000000000 [ 18.322493] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 18.322497] CR2: 0000574bb155c068 CR3: 000000010ae6e006 CR4: 0000000000f72ef0 [ 18.322502] PKRU: 55555554 [ 18.322505] Call Trace: [ 18.322507] <TASK> [ 18.322510] ? kasan_save_track+0x14/0x40 [ 18.322519] ? __kasan_kmalloc+0xc3/0xd0 [ 18.322525] request_threaded_irq+0x2c7/0x490 [ 18.322533] iio_trigger_attach_poll_func+0x353/0x6b0 [industrialio] [ 18.322603] ? __bitmap_equal+0xcb/0x1d0 [ 18.322614] __iio_update_buffers+0x2420/0x2c70 [industrialio] [ 18.322800] ? do_syscall_64+0xcf/0x15d0 [ 18.322813] ? __pfx___iio_update_buffers+0x10/0x10 [industrialio] [ 18.322858] ? __kasan_check_write+0x14/0x30 [ 18.322869] ? __pfx_mutex_lock+0x10/0x10 [ 18.322877] enable_store+0x183/0x270 [industrialio] [ 18.322926] ? __pfx_enable_store+0x10/0x10 [industrialio] [ 18.322975] ? __pfx__copy_from_iter+0x10/0x10 [ 18.322986] ? __pfx_enable_store+0x10/0x10 [industrialio] [ 18.323035] dev_attr_store+0x5e/0x90 [ 18.323046] ? __pfx_dev_attr_store+0x10/0x10 [ 18.323053] sysfs_kf_write+0x1e8/0x290 [ 18.323062] kernfs_fop_write_iter+0x406/0x5f0 [ 18.323068] ? __pfx_sysfs_kf_write+0x10/0x10 [ 18.323076] vfs_write+0x71c/0xea0
--- drivers/iio/buffer/industrialio-triggered-buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iio/buffer/industrialio-triggered-buffer.c +4 -1
@@ -44,6 +44,7 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, const struct iio_dev_attr **buffer_attrs) {struct iio_buffer *buffer; +unsigned long flags =0 ;int ret;/*
@@ -62,9 +63,11 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, goto error_ret; } +if (thread) + flags |=IRQF_ONESHOT ; indio_dev->pollfunc = iio_alloc_pollfunc(h, thread, - IRQF_ONESHOT, + flags, indio_dev, "%s_consumer%d", indio_dev->name,
Signature · 1 line
2.43.0
Quoted 4 lines · Junxiao Chang
IRQF_ONESHOTis for threaded IRQ. If there is no threaded IRQ handler, this flag should not be set.This change fixes a warning during booting with kernel v7.0-rc3:
Please, read this
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#backtraces-in-commit-messages
and act accordingly.
Quoted 40 lines
[ 18.322081] WARNING: kernel/irq/manage.c:1502 at __setup_irq+0x1639/0x2510, CPU#3: iio-sensor-prox/974 [ 18.322097] Modules linked in: snd_hda_intel snd_sof_pci_intel_mtl snd_sof_intel_hda_generic soundwire_intel snd_sof_intel_hda_sdw_bpt snd_sof_intel_hda_common snd_soc_hdac_hda snd_sof_intel_hda_mlink snd_sof_intel_hda soundwire_cadence snd_sof_pci snd_sof_xtensa_dsp snd_soc_sdw_utils snd_sof snd_sof_utils snd_hda_ext_core snd_hda_codec snd_hda_core snd_intel_dspcfg snd_intel_sdw_acpi snd_soc_acpi_intel_match snd_soc_acpi_intel_sdca_quirks soundwire_generic_allocation snd_soc_acpi snd_hwdep soundwire_bus snd_soc_sdca snd_soc_core snd_compress intel_uncore_frequency ac97_bus intel_uncore_frequency_common snd_pcm_dmaengine x86_pkg_temp_thermal intel_powerclamp snd_pcm coretemp snd_seq_midi snd_seq_midi_event kvm_intel snd_rawmidi i915(+) binfmt_misc snd_seq kvm snd_seq_device snd_timer irqbypass prime_numbers cmdlinepart ghash_clmulni_intel processor_thermal_device_pci drm_buddy snd aesni_intel processor_thermal_device spi_nor ttm nls_iso8859_1 mei_gsc_proxy intel_rapl_msr wmi_bmof rapl mtd intel_cstate drm_client_lib [ 18.322243] processor_thermal_wt_hint i2c_i801 hid_sensor_rotation hid_sensor_incl_3d soundcore hid_sensor_accel_3d hid_sensor_prox hid_sensor_magn_3d hid_sensor_custom_intel_hinge hid_sensor_als hid_sensor_gyro_3d platform_temperature_control hid_sensor_trigger processor_thermal_soc_slider industrialio_triggered_buffer intel_pmc_core crc8 i2c_mux platform_profile kfifo_buf processor_thermal_rfim i2c_smbus drm_display_helper hid_sensor_iio_common processor_thermal_rapl industrialio intel_vpu cec intel_rapl_common mei_me processor_thermal_wt_req rc_core drm_shmem_helper processor_thermal_power_floor mei idma64 i2c_algo_bit drm_kms_helper processor_thermal_mbox int3403_thermal pmt_telemetry int340x_thermal_zone pmt_discovery pmt_class int3400_thermal intel_pmc_ssram_telemetry acpi_thermal_rel intel_pmc_pwrm_telemetry intel_hid input_leds acpi_tad acpi_pad sparse_keymap joydev mac_hid sch_fq_codel msr parport_pc ppdev lp parport efi_pstore nfnetlink dmi_sysfs autofs4 hid_sensor_custom ucsi_acpi typec_ucsi hid_sensor_hub [ 18.322391] typec spi_pxa2xx_platform uas dw_dmac dw_dmac_core ahci usb_storage usbhid hid_generic spi_pxa2xx_core libahci e1000e thunderbolt vmd video pinctrl_meteorpoint pinctrl_meteorlake wmi pinctrl_intel [ 18.322435] CPU: 3 UID: 0 PID: 974 Comm: iio-sensor-prox Not tainted 7.0.0-rc3 #16 PREEMPT(lazy) [ 18.322443] Hardware name: Intel Corporation Arrow Lake Client Platform/MTL-S UDIMM 1DPC EVCRB, BIOS MTLSEMI1.R00.5124.D41.2504210658 04/21/2025 [ 18.322447] RIP: 0010:__setup_irq+0x1639/0x2510 [ 18.322455] Code: b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 84 75 f0 ff ff 48 8b 7d c8 e8 21 ea 99 00 e9 67 f0 ff ff e8 87 2f 21 00 <0f> 0b 31 ff 44 89 ee e8 3b 25 21 00 45 85 ed 0f 84 f0 f1 ff ff bb [ 18.322461] RSP: 0018:ffff8881387c7698 EFLAGS: 00010246 [ 18.322467] RAX: 0000000000000000 RBX: 0000000000002000 RCX: 0000000000000000 [ 18.322471] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 18.322475] RBP: ffff8881387c7748 R08: 0000000000000000 R09: 0000000000000000 [ 18.322479] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000400 [ 18.322483] R13: 0000000000000000 R14: ffff888102718f20 R15: ffff888102718f00 [ 18.322488] FS: 0000700e74a2a900(0000) GS:ffff8888ab3c4000(0000) knlGS:0000000000000000 [ 18.322493] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 18.322497] CR2: 0000574bb155c068 CR3: 000000010ae6e006 CR4: 0000000000f72ef0 [ 18.322502] PKRU: 55555554 [ 18.322505] Call Trace: [ 18.322507] <TASK> [ 18.322510] ? kasan_save_track+0x14/0x40 [ 18.322519] ? __kasan_kmalloc+0xc3/0xd0 [ 18.322525] request_threaded_irq+0x2c7/0x490 [ 18.322533] iio_trigger_attach_poll_func+0x353/0x6b0 [industrialio] [ 18.322603] ? __bitmap_equal+0xcb/0x1d0 [ 18.322614] __iio_update_buffers+0x2420/0x2c70 [industrialio] [ 18.322800] ? do_syscall_64+0xcf/0x15d0 [ 18.322813] ? __pfx___iio_update_buffers+0x10/0x10 [industrialio] [ 18.322858] ? __kasan_check_write+0x14/0x30 [ 18.322869] ? __pfx_mutex_lock+0x10/0x10 [ 18.322877] enable_store+0x183/0x270 [industrialio] [ 18.322926] ? __pfx_enable_store+0x10/0x10 [industrialio] [ 18.322975] ? __pfx__copy_from_iter+0x10/0x10 [ 18.322986] ? __pfx_enable_store+0x10/0x10 [industrialio] [ 18.323035] dev_attr_store+0x5e/0x90 [ 18.323046] ? __pfx_dev_attr_store+0x10/0x10 [ 18.323053] sysfs_kf_write+0x1e8/0x290 [ 18.323062] kernfs_fop_write_iter+0x406/0x5f0 [ 18.323068] ? __pfx_sysfs_kf_write+0x10/0x10 [ 18.323076] vfs_write+0x71c/0xea0
...
drivers/iio/buffer/industrialio-triggered-buffer.c int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, · line 47
Quoted 2 lines
drivers/iio/buffer/industrialio-triggered-buffer.c +1
-0struct iio_buffer *buffer; +unsigned long flags =0 ;
This is less maintainable. When the assigned value is used in a conditional, it's always better to have the assignment there.
Quoted 1 line
int ret;
...
drivers/iio/buffer/industrialio-triggered-buffer.c int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, · line 67
Quoted 2 lines
drivers/iio/buffer/industrialio-triggered-buffer.c +2
-0+if (thread) + flags |=IRQF_ONESHOT ;
if (thread) flags = IRQF_ONESHOT; else flags = 0;
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Sat, Apr 18, 2026 at 08:23:34AM +0800, Junxiao Chang wrote:
...
Quoted 7 lines
drivers/iio/buffer/industrialio-triggered-buffer.c int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, · line 47
Quoted 2 lines
drivers/iio/buffer/industrialio-triggered-buffer.c +1
-0struct iio_buffer *buffer; +unsigned long flags =0 ;This is less maintainable. When the assigned value is used in a conditional, it's always better to have the assignment there.
Quoted 1 line
int ret;
...
Quoted 7 lines
drivers/iio/buffer/industrialio-triggered-buffer.c int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, · line 67
Quoted 2 lines
drivers/iio/buffer/industrialio-triggered-buffer.c +2
-0+if (thread) + flags |=IRQF_ONESHOT ;if (thread) flags = IRQF_ONESHOT; else flags = 0;
Note, alternatively you can completely drop this temporary variable and use ternary directly in the call. I think it will be even better from readability p.o.v.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 1/1 iio: buffer: fix warning in requesting threaded irq
In reply to Junxiao ChangIRQF_ONESHOT is for threaded IRQ. If there is no threaded IRQ handler, this flag should not be set.
This change fixes a warning during booting with kernel v7.0-rc3:
WARNING: kernel/irq/manage.c:1502 at __setup_irq+0x1639/0x2510, CPU#3: iio-sensor-prox/974 RIP: 0010:__setup_irq+0x1639/0x2510 Call Trace: request_threaded_irq+0x2c7/0x490 iio_trigger_attach_poll_func+0x353/0x6b0 __iio_update_buffers+0x2420/0x2c70 enable_store+0x183/0x270 dev_attr_store+0x5e/0x90 sysfs_kf_write+0x1e8/0x290 kernfs_fop_write_iter+0x406/0x5f0 vfs_write+0x71c/0xea0
v2: using ternary and drop temp variable
--- drivers/iio/buffer/industrialio-triggered-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/buffer/industrialio-triggered-buffer.c +1 -1
@@ -64,7 +64,7 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev, indio_dev->pollfunc = iio_alloc_pollfunc(h, thread, - IRQF_ONESHOT, + thread ? IRQF_ONESHOT : 0, indio_dev, "%s_consumer%d", indio_dev->name,
Signature · 1 line
2.43.0
Quoted 8 lines · Junxiao Chang
IRQF_ONESHOTis for threaded IRQ. If there is no threaded IRQ handler, this flag should not be set.This change fixes a warning during booting with kernel v7.0-rc3:
WARNING: kernel/irq/manage.c:1502 at __setup_irq+0x1639/0x2510, CPU#3: iio-sensor-prox/974 RIP: 0010:__setup_irq+0x1639/0x2510
Unneeded line (it dups the previous one).
Quoted 10 lines
Call Trace: request_threaded_irq+0x2c7/0x490 iio_trigger_attach_poll_func+0x353/0x6b0 __iio_update_buffers+0x2420/0x2c70 enable_store+0x183/0x270 dev_attr_store+0x5e/0x90 sysfs_kf_write+0x1e8/0x290 kernfs_fop_write_iter+0x406/0x5f0 vfs_write+0x71c/0xea0
These 3 lines are also redundant.
Quoted 1 line
v2: using ternary and drop temp variable
Changelog should go...
Quoted 3 lines
Fixes 23f2d735a932 ("iio: Add helper function for initializing triggered buffers")Signed-off-by Junxiao Chang <[email protected]>---
...here, when it doesn't go to the commit message. One may find this in the lore archive.
...
Code wise now it looks good.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · On Fri, 17 Apr 2026 14:30:11 +0300 Andy Shevchenko…
Quoted 6 lines · Junxiao Chang
IRQF_ONESHOTis for threaded IRQ. If there is no threaded IRQ handler, this flag should not be set.This change fixes a warning during booting with kernel v7.0-rc3:
WARNING: kernel/irq/manage.c:1502 at __setup_irq+0x1639/0x2510, CPU#3: iio-sensor-prox/974
Please provide details on which driver is in use to hit this corner case.
That may help people identify if the bug applies to what they are seeing and also provide some background on how urgent this is to get upstream + backported.
Jonathan
Quoted 33 lines
Quoted 2 lines
RIP: 0010:__setup_irq+0x1639/0x2510Unneeded line (it dups the previous one).
Quoted 10 lines
Call Trace: request_threaded_irq+0x2c7/0x490 iio_trigger_attach_poll_func+0x353/0x6b0 __iio_update_buffers+0x2420/0x2c70 enable_store+0x183/0x270 dev_attr_store+0x5e/0x90 sysfs_kf_write+0x1e8/0x290 kernfs_fop_write_iter+0x406/0x5f0 vfs_write+0x71c/0xea0These 3 lines are also redundant.
Quoted 1 line
v2: using ternary and drop temp variable
Changelog should go...
Quoted 3 lines
Fixes 23f2d735a932 ("iio: Add helper function for initializing triggered buffers")Signed-off-by Junxiao Chang <[email protected]>---
...here, when it doesn't go to the commit message. One may find this in the lore archive.
...
Code wise now it looks good.
Jonathan Cameron
maintainerQuoted 7 lines · On Fri, 17 Apr 2026 13:50:44 +0100 Jonathan Cameron…
Quoted 4 lines · On Fri, 17 Apr 2026 14:30:11 +0300 Andy Shevchenko…
Quoted 3 lines · Junxiao Chang
IRQF_ONESHOTis for threaded IRQ. If there is no threaded IRQ handler, this flag should not be set.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
This change fixes a warning during booting with kernel v7.0-rc3:
WARNING: kernel/irq/manage.c:1502 at __setup_irq+0x1639/0x2510, CPU#3: iio-sensor-prox/974Please provide details on which driver is in use to hit this corner case.
That may help people identify if the bug applies to what they are seeing and also provide some background on how urgent this is to get upstream + backported.
Another thing I just noticed related to upstream process. Please don't send a new version in reply to the older one. Send it as a new email thread. It doesn't matter a massive amount in a simple case like this but when things get more complex threads can become unmanageable if using this style.
Another practical thing if you want to get code merged is many reviewers do what I'm doing today and, when they have a massive backlog to review, start with the latest emails that they see. In this case your patch ends up further back in history so is less likely to get reviews in the short term
Jonathan
Quoted 38 lines
Jonathan
Quoted 33 lines
Quoted 2 lines
RIP: 0010:__setup_irq+0x1639/0x2510Unneeded line (it dups the previous one).
Quoted 10 lines
Call Trace: request_threaded_irq+0x2c7/0x490 iio_trigger_attach_poll_func+0x353/0x6b0 __iio_update_buffers+0x2420/0x2c70 enable_store+0x183/0x270 dev_attr_store+0x5e/0x90 sysfs_kf_write+0x1e8/0x290 kernfs_fop_write_iter+0x406/0x5f0 vfs_write+0x71c/0xea0These 3 lines are also redundant.
Quoted 1 line
v2: using ternary and drop temp variable
Changelog should go...
Quoted 3 lines
Fixes 23f2d735a932 ("iio: Add helper function for initializing triggered buffers")Signed-off-by Junxiao Chang <[email protected]>---
...here, when it doesn't go to the commit message. One may find this in the lore archive.
...
Code wise now it looks good.
Quoted 9 lines
Quoted 4 lines · On Fri, 17 Apr 2026 13:50:44 +0100 Jonathan Cameron…
Please provide details on which driver is in use to hit this corner case.
That may help people identify if the bug applies to what they are seeing and also provide some background on how urgent this is to get
upstream + backported.
Our hardware platform: ARL-s(Ultra 9 285) desktop. OS: Ubuntu 24.04, kernel v7.0-rc3. It could be reproduced every time. With code review, some drivers don't have threaded IRQ handler in triggered buffer setup. For example:vf610_adc_probe in drivers/iio/adc/vf610_adc.chid_sensor_setup_trigger in drivers/iio/common/hid-sensors/hid-sensor-trigger.c
This might introduce warning during boot.
Quoted 11 lines
Another thing I just noticed related to upstream process.
Please don't send a new version in reply to the older one.
Send it as a new email thread. It doesn't matter a massive amount in a simple case like this but when things get more complex threads can become unmanageable if using this style.Another practical thing if you want to get code merged is many reviewers do what I'm doing today and, when they have a massive backlog to review, start with the latest emails that they see. In this case your patch ends up further back in history so is less likely to get reviews in the short term
Thank you for your suggestion! I will send updated patch as new thread.