guesshaha opened a new pull request, #20849:
URL: https://github.com/apache/nuttx/pull/20849

   - Use `nxsem_post()` and `nxsem_wait_uninterruptible()` for IBI completion 
synchronization.
   - Initialize `all_ibis_handled` with a zero count and wait until all pending 
IBIs are handled.
   - Keep the completion semaphore alive across IBI disable operations.
   - Destroy the semaphore when IBI resources are freed or IBI allocation fails.
   
   Assisted-by: Codex
   
   *Note: Please adhere to [[Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md)](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   Fix IBI completion semaphore handling in the I3C master driver.
   
   Previously, the completion semaphore was initialized with a count of one and 
destroyed during IBI disable operations. This could lead to incorrect 
synchronization and prevent the semaphore from being reused safely when IBI is 
enabled again.
   
   This change initializes the semaphore with a count of zero, uses 
`nxsem_post()` and `nxsem_wait_uninterruptible()` for completion 
synchronization, and waits in a loop until no pending IBIs remain. The 
semaphore is kept alive across disable operations and destroyed only when IBI 
resources are freed or IBI allocation fails.
   
   ## Impact
   
   - Improves IBI completion synchronization in the NuttX I3C master driver.
   - Allows the completion semaphore to be reused across IBI disable and 
re-enable operations.
   - Ensures the semaphore is cleaned up when IBI resources are released or 
allocation fails.
   - No changes to the public I3C API are intended.
   


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