spinlock: Simplify instrumentation interface by removing wrapper functions #18147
+14
−48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request refactors the spinlock instrumentation interface to eliminate redundant wrapper functions. Instead of calling separate
sched_note_spinlock_lock(),sched_note_spinlock_locked(),sched_note_spinlock_abort(), andsched_note_spinlock_unlock()functions, the code now directly calls the unifiedsched_note_spinlock()function with the appropriate event type parameter. This simplification reduces code duplication, improves maintainability, and eliminates unnecessary function call overhead.Changes
File modifications:
include/nuttx/spinlock.h: Removed 4 wrapper function declarations, updated all inline calls to usesched_note_spinlock(spinlock, type)directly, added include for<nuttx/sched_note.h>drivers/note/note_driver.c: Removed 4 wrapper function implementations, modifiedsched_note_spinlock()to accept(spinlock, type)and get current task internally viarunning_task()include/nuttx/sched_note.h: Updatedsched_note_spinlock()function signature and stub macroStatistics: 14 insertions(+), 48 deletions(-) - net reduction of 34 lines
Impact
Technical Justification
Why consolidate instrumentation?
Signature change:
sched_note_spinlock(tcb, spinlock, type)sched_note_spinlock(spinlock, type)withtcbobtained viarunning_task()Testing
Verified with:
Related Work
Part of spinlock optimization series focusing on code simplification and interface consolidation.