You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "guesshaha (via GitHub)" <gi...@apache.org> on 2026/10/21 02:05:36 UTC
[PR] drivers/i3c/master.c: Fix IBI completion semaphore handling [nuttx]
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/i3c/master.c: Fix IBI completion semaphore handling [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #20849:
URL: https://github.com/apache/nuttx/pull/20849#discussion_r4332639085
##########
drivers/i3c/master.c:
##########
@@ -1190,7 +1191,7 @@ static void i3c_master_handle_ibi(FAR void *arg)
atomic_sub(&dev->ibi->pending_ibis, 1);
if (!atomic_read(&dev->ibi->pending_ibis))
Review Comment:
merge atomic_sub and atomic_read into one line
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/i3c/master.c: Fix IBI completion semaphore handling [nuttx]
Posted by "guesshaha (via GitHub)" <gi...@apache.org>.
guesshaha commented on code in PR #20849:
URL: https://github.com/apache/nuttx/pull/20849#discussion_r4333549081
##########
drivers/i3c/master.c:
##########
@@ -1190,7 +1191,7 @@ static void i3c_master_handle_ibi(FAR void *arg)
atomic_sub(&dev->ibi->pending_ibis, 1);
if (!atomic_read(&dev->ibi->pending_ibis))
Review Comment:
change to this
` if (atomic_sub(&dev->ibi->pending_ibis, 1) == 1)`
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/i3c/master.c: Fix IBI completion semaphore handling [nuttx]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20849:
URL: https://github.com/apache/nuttx/pull/20849#issuecomment-6307553743
<!-- membrowse-pr-comment -->
## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report · [Explore what changed →](https://membrowse.com/public/apache/nuttx?commit_sha=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94)
*No memory changes detected for:*
- [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
- [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=1fb6bc2a705c4c5c272c6b54d90aecbab2b3ff94&base=1e6d30aaee997166fd5ca69da45d6d1030d7b489)
---
<sub>Catch memory regressions in CI with [MemBrowse](https://membrowse.com). Free for open source.</sub>
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] drivers/i3c/master.c: Fix IBI completion semaphore handling [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #20849:
URL: https://github.com/apache/nuttx/pull/20849
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org