From 78d93eb6280b5f143a94c9b26a372718061e85fe Mon Sep 17 00:00:00 2001 From: ligd Date: Thu, 25 Jul 2024 22:50:23 +0800 Subject: [PATCH] ramlog: unify the lock to critical section Signed-off-by: ligd --- drivers/syslog/ramlog.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c index 6a9aec1693..79d2947452 100644 --- a/drivers/syslog/ramlog.c +++ b/drivers/syslog/ramlog.c @@ -510,7 +510,7 @@ static int ramlog_file_ioctl(FAR struct file *filep, int cmd, irqstate_t flags; int ret = 0; - flags = spin_lock_irqsave(NULL); + flags = enter_critical_section(); switch (cmd) { @@ -528,7 +528,7 @@ static int ramlog_file_ioctl(FAR struct file *filep, int cmd, break; } - spin_unlock_irqrestore(NULL, flags); + leave_critical_section(flags); return ret; } @@ -615,11 +615,11 @@ static int ramlog_file_open(FAR struct file *filep) nxsem_init(&upriv->rl_waitsem, 0, 0); #endif - flags = spin_lock_irqsave(NULL); + flags = enter_critical_section(); list_add_tail(&priv->rl_list, &upriv->rl_node); upriv->rl_tail = header->rl_head > priv->rl_bufsize ? header->rl_head - priv->rl_bufsize : 0; - spin_unlock_irqrestore(NULL, flags); + leave_critical_section(flags); filep->f_priv = upriv; return 0; @@ -636,9 +636,9 @@ static int ramlog_file_close(FAR struct file *filep) /* Get exclusive access to the rl_tail index */ - flags = spin_lock_irqsave(NULL); + flags = enter_critical_section(); list_delete(&upriv->rl_node); - spin_unlock_irqrestore(NULL, flags); + leave_critical_section(flags); #ifndef CONFIG_RAMLOG_NONBLOCKING nxsem_destroy(&upriv->rl_waitsem);