wireless: Replace nxsem_get_value with NXSEM_COUNT#18254
Closed
wangzhi16 wants to merge 1 commit intoapache:masterfrom
Closed
wireless: Replace nxsem_get_value with NXSEM_COUNT#18254wangzhi16 wants to merge 1 commit intoapache:masterfrom
wangzhi16 wants to merge 1 commit intoapache:masterfrom
Conversation
linguini1
requested changes
Jan 29, 2026
Contributor
linguini1
left a comment
There was a problem hiding this comment.
These should all be separate PRs, they are unrelated changes.
Also, please read the contributing guidelines. This PR does not meet the PR standards.
Contributor
|
@wangzhi16 please follow the contributing guide |
Use the atomic operation `atomic_read` to access shared resources more securely. Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
| int sval; | ||
| DEBUGASSERT(nxsem_get_value(&priv->opsem, &sval) == 0 | ||
| && sval == 1); | ||
| DEBUGASSERT(atomic_read(NXSEM_COUNT(&priv->opsem)) |
Contributor
There was a problem hiding this comment.
why change to atomic_read
Contributor
Author
There was a problem hiding this comment.
To simplify the code, the two operations, nxsem_get_value(&priv->opsem, &sval) == 0 and sval == 1, are combined into one step for easier understanding.
Contributor
There was a problem hiding this comment.
it's debug assert why do you want to optimize the debug path?
jerpelea
approved these changes
Feb 2, 2026
Contributor
jerpelea
left a comment
There was a problem hiding this comment.
for the future please use a proper PR title
ex
wireless: Replace nxsem_get_value with NXSEM_COUNT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Using the atomic operation
atomic_readprovides safer access to shared resources. At the same time, the interface is more unified.Impact
None
Testing
./tools/configure.sh -l armv7a:smp make -j$(nproc)ostest