daniel-p-carvalho opened a new pull request, #20847:
URL: https://github.com/apache/nuttx/pull/20847

   ## Summary
   
   `smps_open()` stored the open count only on the first open. After a second 
open the count stayed at 1, so the first `close()` that followed took it to 
zero and called the lower half `shutdown()` while another descriptor was still 
open. The count is now stored on every open.
   
   The function also always returned `OK`, even when the lower half `setup()` 
of the first open failed. It now returns the result of `setup()`.
   
   A blank line after a declaration, reported by nxstyle in the same function, 
is also added.
   
   ## Impact
   
   - Only `drivers/power/supply/smps.c` changes (6 lines added, 1 removed).
   - In-tree users of the SMPS upper half are `b-g474e-dpow1` and 
`stm32f334-disco` (buckboost configs). A second open now keeps the converter 
running when a first descriptor is closed, and a failing `setup()` is reported 
to the caller instead of `OK`. I could not run these boards, so the behavior 
there follows from reading the code.
   - No Kconfig, API or ABI change.
   
   ## Testing
   
   Found and verified on an LM51772 on a custom STM32G4 board (out-of-tree 
lower half, not part of this PR):
   
   - Before: a monitoring program that opened and closed `/dev/smps0` while 
another program held the converter running switched the converter off at its 
`close()`.
   - After: the converter keeps running across the other opens and closes, and 
still stops at the last close.
   
   Style: `tools/nxstyle drivers/power/supply/smps.c` passes.
   


-- 
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