modifyreg16: use small lock in modifyreg16

reason:
We would like to replace the big lock with a small lock.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2024-12-18 16:08:01 +08:00
committed by Xiang Xiao
parent 391aa9b5f3
commit 75ddce6e3a
12 changed files with 78 additions and 24 deletions
+8 -2
View File
@@ -29,6 +29,12 @@
#include "ceva_internal.h"
/****************************************************************************
* Private Data
****************************************************************************/
static spinlock_t g_modifyreg_lock = SP_UNLOCKED;
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -46,10 +52,10 @@ void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits)
irqstate_t flags;
uint16_t regval;
flags = spin_lock_irqsave(NULL);
flags = spin_lock_irqsave(&g_modifyreg_lock);
regval = getreg16(addr);
regval &= ~clearbits;
regval |= setbits;
putreg16(regval, addr);
spin_unlock_irqrestore(flags);
spin_unlock_irqrestore(&g_modifyreg_lock, flags);
}