yangsong8-a1 opened a new pull request, #22190:
URL: https://github.com/apache/nuttx/pull/22190

   ## Summary
     
     Remove the redundant enter_critical_section()/leave_critical_section()
     calls in the powerled upper-half driver's open and close paths.
     
     Both powerled_open() and powerled_close() already hold the closelock
     mutex while calling ops->setup() and ops->shutdown(). The critical
     section inside the mutex-protected region is unnecessary: the mutex
     serializes concurrent open/close calls, and the lower-half callbacks
     are not called from interrupt context.
     
     The same pattern (mutex + critical section) also exists in
     drivers/power/supply/smps.c; this patch only addresses powerled.c.
     
     ## Impact
     
     No functional change.  The setup() and shutdown() callbacks are still
     serialized by the closelock mutex.
     
     The only in-tree lower-half implementation is
     boards/arm/stm32f3/stm32f334-disco/src/stm32_powerled.c.
     
     ## Testing
     
     Ubuntu 22.04, host gcc.  sim:nsh with DRIVERS_POWERLED, CMake, no new
     warnings; stm32f334-disco:powerled also builds.  A temporary test program
     (not part of this PR) registers a dummy lower half and opens and closes
     /dev/powerled0 200 times from each of two threads.  The output is the
     same on master and with this change:
     
     nsh> hello
     powerled_register: 0
     setup 200 shutdown 400 still on 0 out-of-order 200
    
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to