Skip to content

Commit

Permalink
spinlock: Due to semantic inconsistency, remove/rename some functions…
Browse files Browse the repository at this point in the history
… with the _wo_note suffix.

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Jan 22, 2025
1 parent aefafc4 commit 57188e6
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 97 deletions.
16 changes: 8 additions & 8 deletions drivers/note/note_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@ void sched_note_filter_mode(FAR struct note_filter_named_mode_s *oldm,
irqstate_t irq_mask;
FAR struct note_driver_s **driver;

irq_mask = spin_lock_irqsave_wo_note(&g_note_lock);
irq_mask = raw_spin_lock_irqsave(&g_note_lock);

if (oldm != NULL)
{
Expand Down Expand Up @@ -1877,7 +1877,7 @@ void sched_note_filter_mode(FAR struct note_filter_named_mode_s *oldm,
}
}

spin_unlock_irqrestore_wo_note(&g_note_lock, irq_mask);
raw_spin_unlock_irqrestore(&g_note_lock, irq_mask);
}

/****************************************************************************
Expand Down Expand Up @@ -1907,7 +1907,7 @@ void sched_note_filter_syscall(FAR struct note_filter_named_syscall_s *oldf,
irqstate_t irq_mask;
FAR struct note_driver_s **driver;

irq_mask = spin_lock_irqsave_wo_note(&g_note_lock);
irq_mask = raw_spin_lock_irqsave(&g_note_lock);

if (oldf != NULL)
{
Expand Down Expand Up @@ -1943,7 +1943,7 @@ void sched_note_filter_syscall(FAR struct note_filter_named_syscall_s *oldf,
}
}

spin_unlock_irqrestore_wo_note(&g_note_lock, irq_mask);
raw_spin_unlock_irqrestore(&g_note_lock, irq_mask);
}
#endif

Expand Down Expand Up @@ -1974,7 +1974,7 @@ void sched_note_filter_irq(FAR struct note_filter_named_irq_s *oldf,
irqstate_t irq_mask;
FAR struct note_driver_s **driver;

irq_mask = spin_lock_irqsave_wo_note(&g_note_lock);
irq_mask = raw_spin_lock_irqsave(&g_note_lock);

if (oldf != NULL)
{
Expand Down Expand Up @@ -2010,7 +2010,7 @@ void sched_note_filter_irq(FAR struct note_filter_named_irq_s *oldf,
}
}

spin_unlock_irqrestore_wo_note(&g_note_lock, irq_mask);
raw_spin_unlock_irqrestore(&g_note_lock, irq_mask);
}
#endif

Expand Down Expand Up @@ -2041,7 +2041,7 @@ void sched_note_filter_tag(FAR struct note_filter_named_tag_s *oldf,
FAR struct note_driver_s **driver;
irqstate_t irq_mask;

irq_mask = spin_lock_irqsave_wo_note(&g_note_lock);
irq_mask = raw_spin_lock_irqsave(&g_note_lock);

if (oldf != NULL)
{
Expand Down Expand Up @@ -2077,7 +2077,7 @@ void sched_note_filter_tag(FAR struct note_filter_named_tag_s *oldf,
}
}

spin_unlock_irqrestore_wo_note(&g_note_lock, irq_mask);
raw_spin_unlock_irqrestore(&g_note_lock, irq_mask);
}
#endif

Expand Down
26 changes: 13 additions & 13 deletions drivers/note/noteram_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ static ssize_t noteram_read(FAR struct file *filep, FAR char *buffer,

if (ctx->mode == NOTERAM_MODE_READ_BINARY)
{
flags = spin_lock_irqsave_wo_note(&drv->lock);
flags = raw_spin_lock_irqsave(&drv->lock);
ret = noteram_get(drv, (FAR uint8_t *)buffer, buflen);
spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
}
else
{
Expand All @@ -481,9 +481,9 @@ static ssize_t noteram_read(FAR struct file *filep, FAR char *buffer,

/* Get the next note (removing it from the buffer) */

flags = spin_lock_irqsave_wo_note(&drv->lock);
flags = raw_spin_lock_irqsave(&drv->lock);
ret = noteram_get(drv, note, sizeof(note));
spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
if (ret <= 0)
{
return ret;
Expand All @@ -508,7 +508,7 @@ static int noteram_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
int ret = -ENOSYS;
FAR struct noteram_driver_s *drv = filep->f_inode->i_private;
irqstate_t flags = spin_lock_irqsave_wo_note(&drv->lock);
irqstate_t flags = raw_spin_lock_irqsave(&drv->lock);

/* Handle the ioctl commands */

Expand Down Expand Up @@ -600,7 +600,7 @@ static int noteram_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
}

spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
return ret;
}

Expand All @@ -622,7 +622,7 @@ static int noteram_poll(FAR struct file *filep, FAR struct pollfd *fds,
DEBUGASSERT(inode != NULL && inode->i_private != NULL);
drv = inode->i_private;

flags = spin_lock_irqsave_wo_note(&drv->lock);
flags = raw_spin_lock_irqsave(&drv->lock);

/* Ignore waits that do not include POLLIN */

Expand Down Expand Up @@ -655,7 +655,7 @@ static int noteram_poll(FAR struct file *filep, FAR struct pollfd *fds,

if (noteram_unread_length(drv) > 0)
{
spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
poll_notify(&drv->pfd, 1, POLLIN);
return ret;
}
Expand All @@ -666,7 +666,7 @@ static int noteram_poll(FAR struct file *filep, FAR struct pollfd *fds,
}

errout:
spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
return ret;
}

Expand Down Expand Up @@ -698,11 +698,11 @@ static void noteram_add(FAR struct note_driver_s *driver,
unsigned int space;
irqstate_t flags;

flags = spin_lock_irqsave_wo_note(&drv->lock);
flags = raw_spin_lock_irqsave(&drv->lock);

if (drv->ni_overwrite == NOTERAM_MODE_OVERWRITE_OVERFLOW)
{
spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
return;
}

Expand All @@ -716,7 +716,7 @@ static void noteram_add(FAR struct note_driver_s *driver,
/* Stop recording if not in overwrite mode */

drv->ni_overwrite = NOTERAM_MODE_OVERWRITE_OVERFLOW;
spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
return;
}

Expand All @@ -737,7 +737,7 @@ static void noteram_add(FAR struct note_driver_s *driver,
memcpy(drv->ni_buffer + head, note, space);
memcpy(drv->ni_buffer, buf + space, notelen - space);
drv->ni_head = noteram_next(drv, head, NOTE_ALIGN(notelen));
spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
poll_notify(&drv->pfd, 1, POLLIN);
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/note/noterpmsg_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ static bool noterpmsg_transfer(FAR struct noterpmsg_driver_s *drv,
static void noterpmsg_work(FAR void *priv)
{
FAR struct noterpmsg_driver_s *drv = priv;
irqstate_t flags = spin_lock_irqsave_wo_note(&drv->lock);
irqstate_t flags = raw_spin_lock_irqsave(&drv->lock);

if (!noterpmsg_transfer(drv, false))
{
work_queue(HPWORK, &drv->work, noterpmsg_work, drv,
NOTE_RPMSG_WORK_DELAY);
}

spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
}

static void noterpmsg_add(FAR struct note_driver_s *driver,
Expand All @@ -199,7 +199,7 @@ static void noterpmsg_add(FAR struct note_driver_s *driver,
irqstate_t flags;
size_t space;

flags = spin_lock_irqsave_wo_note(&drv->lock);
flags = raw_spin_lock_irqsave(&drv->lock);

space = CONFIG_DRIVERS_NOTERPMSG_BUFSIZE - noterpmsg_length(drv);
if (space < notelen)
Expand Down Expand Up @@ -236,7 +236,7 @@ static void noterpmsg_add(FAR struct note_driver_s *driver,
NOTE_RPMSG_WORK_DELAY);
}

spin_unlock_irqrestore_wo_note(&drv->lock, flags);
raw_spin_unlock_irqrestore(&drv->lock, flags);
}

static int noterpmsg_ept_cb(FAR struct rpmsg_endpoint *ept,
Expand Down
4 changes: 2 additions & 2 deletions drivers/segger/config/SEGGER_RTT_Conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ extern spinlock_t g_segger_lock;

/* Lock RTT (nestable) (i.e. disable interrupts) */

#define SEGGER_RTT_LOCK() irqstate_t __flags = spin_lock_irqsave_wo_note(&g_segger_lock)
#define SEGGER_RTT_LOCK() irqstate_t __flags = raw_spin_lock_irqsave(&g_segger_lock)

/* Unlock RTT (nestable) (i.e. enable previous interrupt lock state) */

#define SEGGER_RTT_UNLOCK() spin_unlock_irqrestore_wo_note(&g_segger_lock, __flags)
#define SEGGER_RTT_UNLOCK() raw_spin_unlock_irqrestore(&g_segger_lock, __flags)

/* Disable RTT SEGGER_RTT_WriteSkipNoLock */

Expand Down
8 changes: 4 additions & 4 deletions drivers/syslog/syslog_intbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void syslog_add_intbuffer(FAR const char *buffer, size_t buflen)

/* Disable concurrent modification from interrupt handling logic */

flags = spin_lock_irqsave_wo_note(&g_syslog_intbuffer.splock);
flags = raw_spin_lock_irqsave(&g_syslog_intbuffer.splock);

space = circbuf_space(&g_syslog_intbuffer.circ);

Expand All @@ -172,7 +172,7 @@ void syslog_add_intbuffer(FAR const char *buffer, size_t buflen)
buffer + space, buflen - space);
}

spin_unlock_irqrestore_wo_note(&g_syslog_intbuffer.splock, flags);
raw_spin_unlock_irqrestore(&g_syslog_intbuffer.splock, flags);
}

/****************************************************************************
Expand All @@ -198,9 +198,9 @@ void syslog_flush_intbuffer(bool force)
{
irqstate_t flags;

flags = spin_lock_irqsave_wo_note(&g_syslog_intbuffer.splock);
flags = raw_spin_lock_irqsave(&g_syslog_intbuffer.splock);
syslog_flush_internal(force, sizeof(g_syslog_intbuffer.buffer));
spin_unlock_irqrestore_wo_note(&g_syslog_intbuffer.splock, flags);
raw_spin_unlock_irqrestore(&g_syslog_intbuffer.splock, flags);
}

#endif /* CONFIG_SYSLOG_INTBUFFER */
2 changes: 1 addition & 1 deletion include/nuttx/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
do \
{ \
g_cpu_irqset = 0; \
spin_unlock_wo_note(&g_cpu_irqlock); \
raw_spin_unlock(&g_cpu_irqlock); \
} \
while (0)
#endif
Expand Down
Loading

0 comments on commit 57188e6

Please sign in to comment.