nuttx/include/nuttx
pangzhen1 7b154402fb sched/irq: Consolidate IRQ bounds checking into IRQ_TO_NDX macro
Previously, IRQ bounds checking (irq >= 0 && irq < NR_IRQS) was duplicated
across multiple IRQ subsystem functions before calling IRQ_TO_NDX(). This
led to code duplication and inconsistency.

This patch consolidates all IRQ bounds checking into the IRQ_TO_NDX() macro
itself, which now returns -EINVAL for out-of-bounds IRQ numbers. This approach:

1. Eliminates duplicated bounds checking code
2. Ensures consistent error handling across all IRQ functions
3. Simplifies caller code - just check if IRQ_TO_NDX() returns negative
4. Makes the macro behavior more predictable and self-contained

Changes:
- Modified IRQ_TO_NDX() to check (irq < 0 || irq >= NR_IRQS) and return -EINVAL
- Removed redundant IRQ range checks in irq_attach(), irq_attach_thread(),
  irq_attach_wqueue(), and irqchain_detach()
- Simplified error handling to check ndx < 0 after IRQ_TO_NDX() call

This consolidation reduces code size and improves maintainability while
preserving all existing error checking functionality.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-28 13:35:30 +08:00
..
1wire 1wire DS2XXX: add 1wire and DS2XXX documentation 2025-10-11 07:39:01 -03:00
aie nuttx ai driver update 2024-10-17 22:35:40 +08:00
analog drivers/adc: Use mutexlock to replace critical section protection 2026-01-05 22:03:12 +08:00
audio drivers/i2s/i2schar: Implement ioctl commands for i2schar 2025-08-27 11:07:05 +08:00
binfmt binfmt: Add a configuration flag to store the module filename 2025-11-01 22:59:47 +08:00
can sja1000: replace enter_critical_section with spinlock 2026-01-08 09:15:04 -03:00
clk include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
contactless include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
coresight style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
crypto crypto/blake2s.h: fix tasking compile warning 2026-01-19 14:16:25 +08:00
dma include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
drivers drivers/rpmsg: add slash check for sepical rpmsg dev 2025-12-12 17:48:43 +08:00
eeprom mtd/at25ee: Use eeprom/spi_xx25xx internally 2025-12-17 19:03:54 +01:00
efuse include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
fs fs/procfs: Add mallinfo and memdump callback to procfs_meminfo_entry_s 2026-01-27 21:27:53 +08:00
himem include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
hwspinlock include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
i2c drivers/i2c: add ioexpander-based lower-half implementation for I2C bit-bang 2026-01-01 17:08:47 +08:00
i3c style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
input input/ff: add control operation to force feedback driver interface 2025-12-17 20:10:09 +08:00
ioexpander drivers/ioexpander: add enable & disable macro for gpio SETDEBOUNCE and SETMASK 2026-01-13 09:27:52 -03:00
lcd style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
leds drivers/leds: Add support for KTD2052 2025-07-07 09:49:51 -03:00
lib lib/math32: improve the performance of invdiv_u32. 2025-10-22 09:46:42 +08:00
math drivers/math: use small lock to replace enter_critical_section 2026-01-08 11:17:17 +08:00
mbox include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
mm mm: Call mm_free_delaylist in mm_mallinfo 2026-01-27 21:27:53 +08:00
modem style/FAR: remove FAR qualifier 2025-11-10 10:56:29 +01:00
motor style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
mtd drivers/mtd: add MTDIOC_ISBAD ioctl 2025-12-23 09:26:34 -03:00
net netdev: delete macro CONFIG_NETDEV_CHECKSUM with nuttx 2026-01-19 23:22:46 +08:00
note note/ram: support multiple noterams to dump data when panic occurs 2026-01-24 19:33:17 +08:00
nx style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
pci drivers/pci: epc add dma heap 2025-08-01 20:47:43 +08:00
pinctrl include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
power power/battery: support get battery cycle count 2025-12-22 09:15:56 -03:00
rc style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
regmap include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
reset style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
rf include: migrate license to ASF 2024-11-06 19:46:13 +08:00
rmt include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
rpmsg drivers/rpmsg: refactor internal APIs to private header 2026-01-26 17:23:31 -03:00
rptun rptun: add configuring the stack of rptun as static 2026-01-19 14:18:27 +08:00
segger include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
sensors drivers/sensors: sensor rpmsg add new features. 2026-01-26 15:04:11 +08:00
serial drivers/serial/serial: prevent race conditions on 8-bit architectures 2025-06-19 10:01:24 -03:00
spi drivers/rpmsg_port_spi_slave: add getrecvbuf callback for zero-copy receive 2026-01-26 21:17:27 +08:00
syslog driver/ramlog: Implement the rate limiting function for ramlog driver. 2026-01-27 03:17:05 +08:00
timers drivers/timers/capture: fix typo in capture.h 2026-01-22 00:06:45 +08:00
usb arch/sim: Optimize sim usbhost isoc endpoint transmission 2026-01-05 09:59:06 +08:00
usrsock include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
vhost drivers/vhost: add vhost framework for NuttX 2024-10-03 17:37:40 +08:00
video video/fb: add FBIOGET_PANINFOCNT ioctl 2025-10-14 17:50:42 +08:00
virtio virtio/vhost: update virtqueue_get_available_buffer() api 2025-12-31 02:36:29 +08:00
wireless net/wireless: fix compile warning 2025-12-25 18:05:33 +08:00
.gitignore
addrenv.h addrenv: support addrenv when mpu is used 2026-01-26 16:27:19 +08:00
allsyms.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
arch.h sched/hrtimer: fix hrtimer regression introduced by recent update 2026-01-27 19:35:31 +08:00
ascii.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
atexit.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
atomic.h include/nuttx/atomic.h: fix C++ definition conflicts 2025-12-22 15:27:39 +08:00
bits.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
board.h boards/boardctl: Add BOARDIOC_MACADDR command 2026-01-22 22:13:31 +08:00
cache.h nuttx/cache.h: fix the compile warning in sim when enable OpenAMP 2025-12-31 02:36:29 +08:00
can.h drivers/can: move CAN utils to CAN common files 2025-05-14 10:30:25 -03:00
cancelpt.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
circbuf.h lib/circbuf: add static initialize macro helper 2024-12-17 20:48:23 +08:00
clock.h sched/hrtimer: Replace hrtimer_gettime with clock_systime_nsec. 2026-01-26 16:37:10 +08:00
compiler.h compiler: Add PRAGMA and unroll_loop. 2026-01-06 19:46:30 +08:00
coredump.h coredump: fix issue that nvic region overlapped by board memory region 2025-01-24 09:15:56 +08:00
crc8.h libc/crc: Add crc8rohcincr for incremental CRC8 ROHC calculation 2025-09-30 17:30:46 -03:00
crc16.h libs/libc/crc16: Separate implementation of crc16xmodem from crc16 2025-04-10 16:47:28 +08:00
crc32.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
crc64.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
elf.h nuttx/elf.h: Fix build error with unknown type name 'bool'. 2024-10-15 12:35:10 +08:00
environ.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
envpath.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
ethtool.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
event.h [!] sched/event: Remove wait object dependency from event implementation 2025-10-31 19:56:32 -03:00
fdcheck.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
fdt.h qemu/armv7a: register cfi flash 2025-02-11 17:23:44 +08:00
gdbstub.h gdbstub: change send buffer to const char 2025-01-20 20:07:13 +08:00
hashtable.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
hrtimer.h sched/hrtimer: Fix the functional correctness issue in hrtimer_start. 2026-01-26 16:37:10 +08:00
idr.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
init.h sched: add trace points during system startup and board initialization 2026-01-27 03:18:11 +08:00
instrument.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
ipcc.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
irq.h sched/irq: Consolidate IRQ bounds checking into IRQ_TO_NDX macro 2026-01-28 13:35:30 +08:00
kmalloc.h userspace: Exclude nuttx/arch.h 2024-11-01 16:59:37 +08:00
kthread.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
lin.h LIN:adjust the LIN flag 2026-01-08 23:15:31 +08:00
lirc.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
list.h list: Fix the list conflicts. 2026-01-19 14:12:09 +08:00
list_type.h list: Fix the list conflicts. 2026-01-19 14:12:09 +08:00
macro.h macro: use portable variadic macros 2026-01-22 22:14:00 +08:00
memoryregion.h libs/misc/memoryregion: remove unused memory_region 2024-10-18 21:32:48 +08:00
mmcsd.h mmcsd:add postsleep fields for mmc_ioc_cmd 2024-10-15 02:06:00 +08:00
module.h libc/elf: rename modlib to libelf 2025-04-11 09:43:22 +08:00
mqueue.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
mutex.h sched/pthread: move pthread mutex from syscall to user-space 2026-01-22 12:40:49 -03:00
notifier.h assert: fix DEBUGASSERT recursive triggering 2026-01-24 17:03:57 +08:00
nuttx.h macro/align: Fix ALIGN_UP and ALIGN_DOWN 2025-01-11 12:13:10 +08:00
page.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
panic_notifier.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
pgalloc.h mm/gran: add gran_alloc_align API 2025-05-12 15:01:37 +08:00
progmem.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
pthread.h pthread: move pthread_cond to userspace 2026-01-26 16:26:39 +08:00
queue.h include: queue.h: Make flink clear after sq_rem 2024-10-16 13:56:49 +08:00
random.h libc: Refine the arc4random_buf implementation 2024-10-26 18:04:21 -03:00
reboot_notifier.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
rwsem.h sched/sem_rw.c: Add downgrade_write API for sem_rw 2026-01-07 22:47:09 +08:00
sched.h sched/spinlock: Add configuration to record busywait. 2026-01-27 21:59:14 +08:00
sched_note.h note: add NOTE_DUMP_BINARY support for binary log dumping 2026-01-27 21:56:03 +08:00
scsi.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
sdio.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
sdio_slave.h style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
semaphore.h sched/semaphore: add support to customize semaphore max allowed value 2025-09-04 09:48:34 +08:00
seqlock.h seqlock: Fix struct name and constants. 2025-12-22 10:22:06 -03:00
signal.h sched/signal: Remove shadow definitions to reduce unnecessary API 2025-10-14 17:40:18 +08:00
spawn.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
spinlock.h sched/spinlock: Add time statistics in func enter_critical_section(). 2026-01-27 21:59:14 +08:00
spinlock_type.h seqlock: Fix struct name and constants. 2025-12-22 10:22:06 -03:00
streams.h libc/stream: Add support for lib_scanf 2025-06-20 09:48:39 +08:00
symtab.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
tee.h drivers/misc/optee: Expanded RPC support. 2025-08-06 02:29:33 +08:00
thermal.h drivers/thermal: Add support for passive trip point 2025-02-16 11:22:41 -03:00
tls.h pthread: remove tl_lock 2026-01-26 20:56:12 +08:00
trace.h trace: fix macro line continuation formatting 2026-01-25 10:45:26 -03:00
uorb.h drivers/sensors: Add new features. 2026-01-27 19:34:33 +08:00
userspace.h sched/signal: Add support for partially disabling signals 2026-01-18 08:24:13 -03:00
vt100.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
wdog.h sched/wdog : remove critical section. 2026-01-27 17:59:07 +08:00
wqueue.h list: Fix the list conflicts. 2026-01-19 14:12:09 +08:00
zoneinfo.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00