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
+4 -2
View File
@@ -42,6 +42,8 @@
* Private Data
****************************************************************************/
static spinlock_t g_modifyreg_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -63,11 +65,11 @@ 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(NULL, flags);
spin_unlock_irqrestore(&g_modifyreg_lock, flags);
}