nuttx/sched
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
..
addrenv sched/addrenv: replace critical section with spinlock for refs protection 2026-01-20 11:29:22 +08:00
clock libc/perf: userspace PMU access 2026-01-26 21:14:38 +08:00
environ libc/environ: add interrupt context check to getenv 2026-01-21 10:37:55 +08:00
event sched/event: Fix uninitialized need_switch flag issue in event_post() 2025-11-04 21:43:59 +08:00
group sched: move process ID from kernel to TLS for faster access 2026-01-20 22:33:45 +08:00
hrtimer sched/hrtimer: fix hrtimer regression introduced by recent update 2026-01-27 19:35:31 +08:00
init sched: add trace points during system startup and board initialization 2026-01-27 03:18:11 +08:00
instrument gprof: move gprof function from sched to libbuiltin/libgcc 2024-11-13 02:42:31 +08:00
irq sched/irq: Consolidate IRQ bounds checking into IRQ_TO_NDX macro 2026-01-28 13:35:30 +08:00
misc sched/spinlock: Call spinlock nopreempt when need disable context switch. 2026-01-27 19:33:58 +08:00
module libc/elf: rename modlib to libelf 2025-04-11 09:43:22 +08:00
mqueue sched: After nxsched_add_readytorun, change first parameter to up_switch_context to this_task() 2025-08-20 10:16:43 +08:00
paging sched/sleep: replace all Signal-based sleep implement to Scheduled sleep 2025-10-17 14:05:02 +08:00
pthread pthread: move pthread_cond to userspace 2026-01-26 16:26:39 +08:00
sched sched/sched/sched_get_stackinfo.c: coverity HIS_metric_violation: RETURN 2026-01-28 01:24:58 +08:00
semaphore sem_trywait.c: coverity HIS_metric_violation(HIS_GOTO) 2026-01-27 14:29:33 -03:00
signal sched/signal: Optimize code logic 2026-01-27 21:24:31 +08:00
task pthread: move pthread_cond to userspace 2026-01-26 16:26:39 +08:00
timer sched/timer: Fix MISRA Rule 10.3 2026-01-22 22:14:00 +08:00
tls pthread: remove tl_lock 2026-01-26 20:56:12 +08:00
wdog sched/sched: enable OS tickless mode support using hrtimer 2026-01-27 19:35:31 +08:00
wqueue sched/wqueue: add configuring the stack of an hpwork/lpwork as static 2026-01-27 10:18:24 +08:00
CMakeLists.txt sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
Kconfig sched: Remove FS_PROCFS dependency for SCHED_CRITMONITOR 2026-01-27 22:01:02 +08:00
Makefile sched/hrtimer: Fix hrtimer compilation. 2026-01-08 22:26:11 +08:00