Re: [PATCH] iio: buffer: fix warning in requesting threaded irq
From: Andy Shevchenko
Date: Fri Apr 17 2026 - 03:25:24 EST
On Sat, Apr 18, 2026 at 08:23:34AM +0800, Junxiao Chang wrote:
> 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:
Please, read this
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#backtraces-in-commit-messages
and act accordingly.
> [ 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
...
> struct 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.
> int ret;
...
> + if (thread)
> + flags |= IRQF_ONESHOT;
if (thread)
flags = IRQF_ONESHOT;
else
flags = 0;
--
With Best Regards,
Andy Shevchenko