nuttx/drivers
Felipe Moura efc4c773d6 drivers/sensors/sensor: pace POLLIN at the requested interval
A fetch() only lower half is always ready, so a subscriber that asked for
a rate with SNIOC_SET_INTERVAL got no pacing from poll(): the descriptor
reported POLLIN on every pass and the application had to sleep out the
period itself. That does not compose. An application polling several
topics reads them sequentially from one thread, so per read sleeps
serialize: three topics at 10 Hz sleeping 100 ms each yield 3.3 Hz per
topic rather than 10.

Pace it where poll() can act on it instead. A subscriber that never
requested a rate stays always ready, and one that did becomes ready once
per its own interval, driven by a watchdog armed in sensor_poll(). This
is the fetch() side of what sensor_is_updated() already does for a
pushing lower half, so both models now honor a requested rate the same
way.

The wdog_s lives in sensor_user_s rather than in the device, so each
subscriber is paced at its own interval instead of at the minimum across
all of them, and the timer only runs while somebody is polling. The
expiry runs in timer context and takes no lock: poll_notify() is safe
from an interrupt handler, and a teardown that raced it has already
cleared fds, which makes both the notify and the re-arm no-ops. Teardown
therefore just cancels the watchdog where it clears fds, and a watchdog
keeps this off the work queue entirely, which a fetch() only sensor
exists to avoid.

sensor_close() needs nothing of its own: poll_setup() holds a reference
on the file for the duration of the poll, so file_close() cannot run
until poll_teardown() has called sensor_poll() with setup false, and that
already cancelled the watchdog.

Assisted-by: Claude:claude-sonnet-5

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-08-05 12:50:12 +02:00
..
1wire drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
aie drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
analog drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
audio drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
bch drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
can drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
clk !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
contactless drivers/contactless: fix uninitialized uid leak in mfrc522_read 2026-07-13 19:50:57 +08:00
coresight drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
crypto drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
devicetree include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
dma drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
dummy drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
eeprom drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
efuse drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
i2c drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
i2s drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
i3c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
input drivers/input: report special keys from the keyboard matrix 2026-07-31 11:02:20 -03:00
ioexpander gpio: Fix GPIO expanders warnings 2026-08-01 11:15:11 +08:00
ipcc drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
lcd drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
leds drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
loop drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
math drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
misc libs/libc: Fix divide-by-zero in stat() with large filesystem block sizes 2026-07-16 23:37:22 +08:00
mmcsd drivers/mmcsd/mmcsd_sdio.c: Fix finfo print modifier 2026-08-03 23:18:48 +08:00
modem drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
motor drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
mtd libs/libc: Fix divide-by-zero in stat() with large filesystem block sizes 2026-07-16 23:37:22 +08:00
net drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
note drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
pci drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
pinctrl drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
pipes drivers/: Multiple Drivers Are Registered With World Writable Part 3 2026-07-16 09:49:07 -03:00
power drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
rc drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
regmap include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
reset include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
rf drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
rpmsg drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
rptun drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
segger drivers/segger: Download systemview from NuttX Mirror Repo 2026-06-03 19:19:24 +08:00
sensors drivers/sensors/sensor: pace POLLIN at the requested interval 2026-08-05 12:50:12 +02:00
serial drivers/serial: Modify serial/pty to allow NSH/Telnet line edit 2026-07-22 22:07:18 +08:00
spi drivers/spi/ice40: fix operator precedence in final clock cycle count 2026-07-20 17:05:01 +08:00
syslog drivers/syslog: fix syslog_write() returning -EIO on every write 2026-07-29 07:57:29 +02:00
thermal include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
timers WDOG: Output status on read 2026-08-02 00:38:05 +08:00
usbdev drivers/usbdev/rndis: Fix reported MTU OID sizes 2026-08-04 17:39:56 -03:00
usbhost drivers/usbhost: report the HID keyboard through the keyboard upper half 2026-07-31 11:02:20 -03:00
usbmisc drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
usbmonitor include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
usrsock drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
vhost include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
video drivers/video: zero message on MIPI DSI driver 2026-07-24 20:57:57 -03:00
virtio drivers/input: partial fix of indistinguishable ASCII and special keycodes 2026-07-29 22:51:15 -03:00
wireless drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
.gitignore build: Remve the unnecessary .gitignore 2020-05-23 18:00:40 +01:00
CMakeLists.txt drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
drivers_initialize.c serial/uart_rpmsg: add _raw version of driver 2026-02-23 09:19:57 -03:00
Kconfig espressif/rmt: replace rmtchar with arch-specific lirc adapter 2026-04-04 11:18:32 -03:00
Makefile tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-07-28 21:26:03 -03:00