nxmutex replace nxsem when used as a lock#6965
Conversation
ef3fe2a to
6ce12d3
Compare
|
@anjiahao1 please fix the warning: |
9b179fd to
e93f6a4
Compare
Sure, thanks for suggestion. |
considering the current PR and the work spent on it I think that we should do our best to merge it then we should think how we can avoid this situation by working with smaller PR. |
|
@pkarashchenko @masayuki2009 @jerpelea all comment get addressed, please review again. |
I think it would be better to merge the following style change in the second commit into the first commit because the first commit also changes the lines. Also, I can see similar changes in the second commit. |
|
The latest code passed my automatic tests. |
Done, move to the first patch. |
pkarashchenko
left a comment
There was a problem hiding this comment.
570 files reviewed
| { | ||
| irqstate_t irqs; | ||
|
|
||
| struct stm32l4_i2c_priv_s *priv = ((struct stm32l4_i2c_inst_s *)dev)->priv; |
There was a problem hiding this comment.
Please fix again. Here and all similar places. Move after DEBUGASSERT(dev);
|
@pkarashchenko do you have more comment for this patch? |
Please give me 1 more day to take a final look. Then we can move forward |
pkarashchenko
left a comment
There was a problem hiding this comment.
The new batch of comments mostly related to inconsistency during initialization. I do not expect that all will be changed in this PR, but rather use this review as an opportunity to highlight the things.
All major comments like missing of = NXMUTEX_INITIALIZER; or double free I'm expecting to be fixed of course. Or maybe a separate PR should be submitted for double free fix and some other critical issues, I'm not sure.
@masayuki2009 what do you think?
| @@ -67,7 +68,7 @@ struct st7032_dev_s | |||
| uint8_t col; /* Current col position to write on display */ | |||
| uint8_t buffer[ST7032_MAX_ROW * ST7032_MAX_COL]; | |||
| bool pendscroll; | |||
| sem_t sem_excl; | |||
| mutex_t lock; | |||
Signed-off-by: anjiahao <anjiahao@xiaomi.com> Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
…zation Signed-off-by: anjiahao <anjiahao@xiaomi.com> Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
also correct the order to ensure the memory free is last step Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
|
@pkarashchenko done. |
|
@pkarashchenko @masayuki2009 could we merge this patch now? |
|
Hi @anjiahao1 BL602 I2C Read seems to hang after this commit, I think it might be caused by the Semaphore Init Value. Refer to the changes for d1d4633#diff-b9e7242d24fc5f206885bdcd9fa90409e9c8356d041a968e786cfb8c8db32aeb Previously the Semaphore static void bl602_i2c_sem_init(struct bl602_i2c_priv_s *priv)
{
...
nxsem_init(&priv->sem_isr, 0, 1);Now static struct bl602_i2c_priv_s bl602_i2c0_priv =
{
...
.sem_isr = SEM_INITIALIZER(0),This causes static int bl602_i2c_transfer(struct i2c_master_s *dev,
struct i2c_msg_s * msgs,
int count)
{
...
// Hangs here
ret = nxsem_wait_uninterruptible(&priv->sem_isr);When I changed .sem_isr = SEM_INITIALIZER(1),The I2C Transfer now works OK. (Here's the log) Can you verify if this fix |
|
Sorry, I'll check all the SEM modifications later.
Sorry, I'll check all the SEM modifications later. |

Signed-off-by: anjiahao anjiahao@xiaomi.com
Summary
pull5070 is the first step, this is step 2, then change sem default behavior
Impact
schedule
Testing
CI