public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Bert Karwatzki <spasswolf@web.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	Jiri Kosina	 <jikos@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Srinivas Pandruvada	 <srinivas.pandruvada@linux.intel.com>,
	Thomas Gleixner <tglx@kernel.org>,
	 Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	spasswolf@web.de
Subject: Re: [tip: irq/core] genirq: Warn about using IRQF_ONESHOT without a threaded handler
Date: Tue, 03 Feb 2026 11:43:53 +0100	[thread overview]
Message-ID: <476cf5e072259332676c431c19ca3188705a86f1.camel@web.de> (raw)
In-Reply-To: <20260203083826.1gOzxrwt@linutronix.de>

Am Dienstag, dem 03.02.2026 um 09:38 +0100 schrieb Sebastian Andrzej Siewior:
> On 2026-02-03 00:27:40 [+0100], Bert Karwatzki wrote:
> > 
> > The warning appears because iio_triggered_buffer_setup_ext() (in 
> > drivers/iio/buffer/industrialio-triggered-buffer.c) is called with thread = NULL
> > during the probe of the iio device and calls iio_alloc_pollfunc()
> > (in drivers/iio/industrialio-trigger.c) with thread = NULL and type = IRQF_ONESHOT.
> > 
> > A simple fix could be this:
> > 
> > diff --git a/drivers/iio/buffer/industrialio-triggered-buffer.c b/drivers/iio/buffer/industrialio-triggered-buffer.c
> > index 9bf75dee7ff8..40eea3a44724 100644
> > --- a/drivers/iio/buffer/industrialio-triggered-buffer.c
> > +++ b/drivers/iio/buffer/industrialio-triggered-buffer.c
> > @@ -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,
> > 
> > 
> > Are there any problems with this?
> 
> Urgh. Haven't seen those.
> 
> Looking at all the users of of *iio_triggered_buffer_setup*() the
> primary handler is either NULL or iio_pollfunc_store_time(). 
> So IRQF_ONESHOST should work all the time.
> 
> Then there is 
> - drivers/iio/adc/vf610_adc.c 
> - drivers/iio/common/hid-sensors/hid-sensor-trigger.c
> 
> They use iio_pollfunc_store_time() as primary and have no secondary.
> This would trigger the warning but not having a secondary handler while
> returning IRQF_WAKE_THREAD should create a warning of its own.

Yes, this should call warn_no_thread() when the interrupt is triggered, but
I don't know if these sensors are actually functional on my laptop (I've never
tried to use them).

So I installed libiio-utils from debian and this is the output from
iio_info:


# iio_info 
iio_info version: 0.26 (git tag:v0.26)
Libiio version: 0.26 (git tag: v0.26) backends: local xml ip usb serial
IIO context created with local backend.
Backend version: 0.26 (git tag: v0.26)
Backend description string: Linux lisa 6.19.0-rc7-next-20260130-iiofix-00001-gc30f943f5645 #293 SMP PREEMPT_DYNAMIC Tue Feb  3 00:32:20 CET 2026 x86_64
IIO context has 2 attributes:
	local,kernel: 6.19.0-rc7-next-20260130-iiofix-00001-gc30f943f5645
	uri: local:
IIO context has 21 devices:
	hwmon0: acpitz
		1 channels found:
			temp1:  (input)
			1 channel-specific attributes found:
				attr  0: input value: 59000
		No trigger on this device
	hwmon1: nvme
		2 channels found:
			temp3:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 77850
				attr  1: label value: Sensor 2
			temp1:  (input)
			6 channel-specific attributes found:
				attr  0: alarm value: 0
				attr  1: crit value: 88850
				attr  2: input value: 29850
				attr  3: label value: Composite
				attr  4: max value: 83850
				attr  5: min value: -20150
		No trigger on this device
	hwmon2: nvme
		4 channels found:
			temp2:  (input)
			4 channel-specific attributes found:
				attr  0: input value: 32850
				attr  1: label value: Sensor 1
				attr  2: max value: 65261850
				attr  3: min value: -273150
			temp6:  (input)
			4 channel-specific attributes found:
				attr  0: input value: 35850
				attr  1: label value: Sensor 5
				attr  2: max value: 65261850
				attr  3: min value: -273150
			temp3:  (input)
			4 channel-specific attributes found:
				attr  0: input value: 30850
				attr  1: label value: Sensor 2
				attr  2: max value: 65261850
				attr  3: min value: -273150
			temp1:  (input)
			6 channel-specific attributes found:
				attr  0: alarm value: 0
				attr  1: crit value: 79850
				attr  2: input value: 31850
				attr  3: label value: Composite
				attr  4: max value: 69850
				attr  5: min value: -273150
		No trigger on this device
	hwmon3: amdgpu
		7 channels found:
			temp3:  (input)
			5 channel-specific attributes found:
				attr  0: crit value: 100000
				attr  1: crit_hyst value: -273150
				attr  2: emergency value: 105000
				attr  3: input value: 46000
				attr  4: label value: mem
			temp2:  (input)
			5 channel-specific attributes found:
				attr  0: crit value: 100000
				attr  1: crit_hyst value: -273150
				attr  2: emergency value: 105000
				attr  3: input value: 46000
				attr  4: label value: junction
			in0:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 6
				attr  1: label value: vddgfx
			power1:  (input)
			6 channel-specific attributes found:
				attr  0: average value: 4000000
				attr  1: cap value: 65000000
				attr  2: cap_default value: 65000000
				attr  3: cap_max value: 65000000
				attr  4: cap_min value: 65000000
				attr  5: label value: PPT
			fan1:  (input)
			5 channel-specific attributes found:
				attr  0: enable value: 0
				attr  1: input value: 0
				attr  2: max value: 3300
				attr  3: min value: 0
				attr  4: target value: 0
			temp1:  (input)
			5 channel-specific attributes found:
				attr  0: crit value: 100000
				attr  1: crit_hyst value: -273150
				attr  2: emergency value: 105000
				attr  3: input value: 46000
				attr  4: label value: edge
			pwm1:  (input)
			4 channel-specific attributes found:
				attr  0: enable value: 2
				attr  1: max value: 255
				attr  2: min value: 0
				attr  3: pwm1 value: 91
		4 device-specific attributes found:
				attr  0: freq1_input value: 0
				attr  1: freq1_label value: sclk
				attr  2: freq2_input value: 96000000
				attr  3: freq2_label value: mclk
		No trigger on this device
	hwmon4: amdgpu
		4 channels found:
			in1:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 962
				attr  1: label value: vddnb
			in0:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 1099
				attr  1: label value: vddgfx
			power1:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 17000000
				attr  1: label value: PPT
			temp1:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 49000
				attr  1: label value: edge
		2 device-specific attributes found:
				attr  0: freq1_input value: 400000000
				attr  1: freq1_label value: sclk
		No trigger on this device
	hwmon5: ADP1
		0 channels found:
		No trigger on this device
	hwmon6: k10temp
		1 channels found:
			temp1:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 56500
				attr  1: label value: Tctl
		No trigger on this device
	hwmon7: BAT1
		2 channels found:
			in0:  (input)
			1 channel-specific attributes found:
				attr  0: input value: 15801
			curr1:  (input)
			1 channel-specific attributes found:
				attr  0: input value: 0
		No trigger on this device
	hwmon8: mt7921_phy0
		1 channels found:
			temp1:  (input)
			1 channel-specific attributes found:
				attr  0: input value: 42000
		No trigger on this device
	iio:device0: als (buffer capable)
		6 channels found:
			intensity_both:  (input, index: 0, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 10.000000
				attr  5: scale value: 0.100000000
			illuminance:  (input, index: 1, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 10.000000
				attr  5: scale value: 0.100000000
			colortemp:  (input, WARN:iio_channel_get_type()=UNKNOWN, index: 2, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: -16843009
				attr  4: sampling_frequency value: 10.000000
				attr  5: scale value: 0.100000000
			chromaticity_x:  (input, WARN:iio_channel_get_type()=UNKNOWN, index: 3, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: -1073087296
				attr  4: sampling_frequency value: 10.000000
				attr  5: scale value: 0.100000000
			chromaticity_y:  (input, WARN:iio_channel_get_type()=UNKNOWN, index: 4, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 10.000000
				attr  5: scale value: 0.100000000
			timestamp:  (input, index: 5, format: le:S64/64>>0)
		1 device-specific attributes found:
				attr  0: current_timestamp_clock value: realtime
		2 buffer-specific attributes found:
				attr  0: data_available value: 0
				attr  1: direction value: in
		Current trigger: trigger0(als-dev0)
	iio:device1: als (buffer capable)
		6 channels found:
			intensity_both:  (input, index: 0, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 0.000000
				attr  5: scale value: 0.100000000
			illuminance:  (input, index: 1, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 0.000000
				attr  5: scale value: 0.100000000
			colortemp:  (input, WARN:iio_channel_get_type()=UNKNOWN, index: 2, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 0.000000
				attr  5: scale value: 0.100000000
			chromaticity_x:  (input, WARN:iio_channel_get_type()=UNKNOWN, index: 3, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 0.000000
				attr  5: scale value: 0.100000000
			chromaticity_y:  (input, WARN:iio_channel_get_type()=UNKNOWN, index: 4, format: le:S32/32>>0)
			6 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: hysteresis_relative value: 0.000000
				attr  2: offset value: 0
				attr  3: raw value: 0
				attr  4: sampling_frequency value: 0.000000
				attr  5: scale value: 0.100000000
			timestamp:  (input, index: 5, format: le:S64/64>>0)
		1 device-specific attributes found:
				attr  0: current_timestamp_clock value: realtime
		2 buffer-specific attributes found:
				attr  0: data_available value: 0
				attr  1: direction value: in
		Current trigger: trigger1(als-dev1)
	iio:device2: gyro_3d (buffer capable)
		4 channels found:
			anglvel_x:  (input, index: 0, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 0.000000
				attr  4: scale value: 0.000174532
			anglvel_y:  (input, index: 1, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 0.000000
				attr  4: scale value: 0.000174532
			anglvel_z:  (input, index: 2, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 0.000000
				attr  4: scale value: 0.000174532
			timestamp:  (input, index: 3, format: le:S64/64>>0)
		1 device-specific attributes found:
				attr  0: current_timestamp_clock value: realtime
		2 buffer-specific attributes found:
				attr  0: data_available value: 0
				attr  1: direction value: in
		Current trigger: trigger2(gyro_3d-dev2)
	iio:device3: prox (buffer capable)
		1 channels found:
			proximity0:  (input, index: 0, format: le:s8/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis ERROR: Invalid argument (22)
				attr  1: offset value: 0
				attr  2: raw value: 15
				attr  3: sampling_frequency value: 10.000000
				attr  4: scale value: 1.000000000
		2 buffer-specific attributes found:
				attr  0: data_available value: 0
				attr  1: direction value: in
		Current trigger: trigger4(prox-dev3)
	iio:device4: accel_3d (buffer capable)
		4 channels found:
			accel_x:  (input, index: 0, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 10.000000
				attr  4: scale value: 0.098066500
			accel_y:  (input, index: 1, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 10.000000
				attr  4: scale value: 0.098066500
			accel_z:  (input, index: 2, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 10.000000
				attr  4: scale value: 0.098066500
			timestamp:  (input, index: 3, format: le:S64/64>>0)
		1 device-specific attributes found:
				attr  0: current_timestamp_clock value: realtime
		2 buffer-specific attributes found:
				attr  0: data_available value: 0
				attr  1: direction value: in
		Current trigger: trigger3(accel_3d-dev4)
	iio:device5: magn_3d (buffer capable)
		3 channels found:
			magn_x:  (input, index: 0, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 0.000000
				attr  4: scale value: 0.000001000
			magn_y:  (input, index: 1, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 0.000000
				attr  4: scale value: 0.000001000
			magn_z:  (input, index: 2, format: le:S32/32>>0)
			5 channel-specific attributes found:
				attr  0: hysteresis value: 0.000000
				attr  1: offset value: 0
				attr  2: raw value: 0
				attr  3: sampling_frequency value: 0.000000
				attr  4: scale value: 0.000001000
		2 buffer-specific attributes found:
				attr  0: data_available value: 0
				attr  1: direction value: in
		Current trigger: trigger5(magn_3d-dev5)
	trigger0: als-dev0
		0 channels found:
		No trigger on this device
	trigger1: als-dev1
		0 channels found:
		No trigger on this device
	trigger2: gyro_3d-dev2
		0 channels found:
		No trigger on this device
	trigger3: accel_3d-dev4
		0 channels found:
		No trigger on this device
	trigger4: prox-dev3
		0 channels found:
		No trigger on this device
	trigger5: magn_3d-dev5
		0 channels found:
		No trigger on this device

The iio:device* sensors all report 0 for the "offset value", so these
sensors are maybe non-fuctional.


> What did I miss?

I don't think you missed something, but the thread function being NULL here
could a problem on devices where these sensors actually work. (Or perhaps these sensors
need to be polled and the interrupts never trigger (?))

Bert Karwatzki
> 

  reply	other threads:[~2026-02-03 10:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260113120541.YVf2vRA3@linutronix.de>
2026-02-02 23:27 ` [tip: irq/core] genirq: Warn about using IRQF_ONESHOT without a threaded handler Bert Karwatzki
2026-02-03  8:38   ` Sebastian Andrzej Siewior
2026-02-03 10:43     ` Bert Karwatzki [this message]
2026-02-03 14:58       ` Sebastian Andrzej Siewior
2026-02-07 15:46         ` Jonathan Cameron
2026-02-09  2:00           ` srinivas pandruvada
2026-02-14 15:00             ` Jonathan Cameron
2026-02-14 15:08               ` Jonathan Cameron
2026-02-03 17:29     ` srinivas pandruvada
2026-02-07 15:42       ` Jonathan Cameron
2026-03-01 23:17         ` David Lechner
2026-03-01 23:57           ` David Lechner
2026-03-01 22:45     ` David Lechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=476cf5e072259332676c431c19ca3188705a86f1.camel@web.de \
    --to=spasswolf@web.de \
    --cc=bigeasy@linutronix.de \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox