From dbdec45049dd628675f6aa1c9df6954f8e05cb4a Mon Sep 17 00:00:00 2001 From: Abdelatif Guettouche Date: Wed, 25 Aug 2021 11:25:28 +0200 Subject: [PATCH] arch/xtensa/src/common: Use irq_spin APIs in modifyregXX Replace enter_critical_section with spin_lock_irqsave. Replace leave_critical_section with spin_unlock_irqrestore. Signed-off-by: Abdelatif Guettouche --- arch/xtensa/src/common/xtensa_modifyreg16.c | 5 +++-- arch/xtensa/src/common/xtensa_modifyreg32.c | 5 +++-- arch/xtensa/src/common/xtensa_modifyreg8.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/xtensa/src/common/xtensa_modifyreg16.c b/arch/xtensa/src/common/xtensa_modifyreg16.c index 68ee8c1973..0b9a92111c 100644 --- a/arch/xtensa/src/common/xtensa_modifyreg16.c +++ b/arch/xtensa/src/common/xtensa_modifyreg16.c @@ -29,6 +29,7 @@ #include #include +#include #include "xtensa.h" @@ -49,10 +50,10 @@ void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits) irqstate_t flags; uint16_t regval; - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); regval = getreg16(addr); regval &= ~clearbits; regval |= setbits; putreg16(regval, addr); - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); } diff --git a/arch/xtensa/src/common/xtensa_modifyreg32.c b/arch/xtensa/src/common/xtensa_modifyreg32.c index 511754ba6f..5c7e876c16 100644 --- a/arch/xtensa/src/common/xtensa_modifyreg32.c +++ b/arch/xtensa/src/common/xtensa_modifyreg32.c @@ -29,6 +29,7 @@ #include #include +#include #include "xtensa.h" @@ -49,10 +50,10 @@ void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits) irqstate_t flags; uint32_t regval; - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); regval = getreg32(addr); regval &= ~clearbits; regval |= setbits; putreg32(regval, addr); - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); } diff --git a/arch/xtensa/src/common/xtensa_modifyreg8.c b/arch/xtensa/src/common/xtensa_modifyreg8.c index e1211901d6..1ebcb6c27c 100644 --- a/arch/xtensa/src/common/xtensa_modifyreg8.c +++ b/arch/xtensa/src/common/xtensa_modifyreg8.c @@ -29,6 +29,7 @@ #include #include +#include #include "xtensa.h" @@ -49,10 +50,10 @@ void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits) irqstate_t flags; uint8_t regval; - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); regval = getreg8(addr); regval &= ~clearbits; regval |= setbits; putreg8(regval, addr); - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); }