nuttx/atomic: replace atomic_fetch_xxx with atomic_xxx just like zephyr

Rename atomic_fetch_add/sub/or/and/xor to atomic_add/sub/or/and/xor
to avoid conflicts with the C/C++ standard library naming. The
atomic_fetch_xxx naming is reserved by the standard; keeping it causes
function name conflicts when source files indirectly include both
<nuttx/atomic.h> and <atomic>/<stdatomic.h>.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
This commit is contained in:
zhangyu117 2026-08-12 15:28:17 +08:00 committed by Xiang Xiao
parent aee6fa1462
commit d7771b6158
42 changed files with 78 additions and 78 deletions

View file

@ -72,7 +72,7 @@ static atomic_t g_gic_init_done;
#if defined(CONFIG_SMP) && CONFIG_SMP_NCPUS > 1
static void arm_gic_init_done(void)
{
atomic_fetch_or(&g_gic_init_done, 1 << this_cpu());
atomic_or(&g_gic_init_done, 1 << this_cpu());
}
static void arm_gic_wait_done(cpu_set_t cpuset)

View file

@ -876,7 +876,7 @@ static void *device_mutex[5];
static void device_mutex_init(uint32_t device)
{
irqstate_t status;
if (atomic_fetch_or(&mutex_init, (1 << device)) & (1 << device) == 0)
if (atomic_or(&mutex_init, (1 << device)) & (1 << device) == 0)
{
rtw_mutex_init(&device_mutex[device]);
}

View file

@ -476,7 +476,7 @@ static int imx9_scmi_tx(uint32_t channel, uint32_t protocol_id,
*header = SCMI_HEADER_MSG(message_id)
| SCMI_HEADER_PROTOCOL(protocol_id)
| SCMI_HEADER_TYPE(0UL)
| SCMI_HEADER_TOKEN(atomic_fetch_add(&g_token, 1));
| SCMI_HEADER_TOKEN(atomic_add(&g_token, 1));
msg->header = *header;
/* Send message via transport */

View file

@ -174,8 +174,8 @@ static void update_stats(struct mm_heap_s *heap, void *mem, size_t size,
list_add_tail(&heap->alloclist, &node->node);
spin_unlock_irqrestore(&heap->lock, flags);
atomic_fetch_add(&heap->aordblks, 1);
atomic_fetch_add(&heap->uordblks, size);
atomic_add(&heap->aordblks, 1);
atomic_add(&heap->uordblks, size);
usmblks = atomic_read(&heap->usmblks);
do
{
@ -189,8 +189,8 @@ static void update_stats(struct mm_heap_s *heap, void *mem, size_t size,
list_delete(&node->node);
spin_unlock_irqrestore(&heap->lock, flags);
atomic_fetch_sub(&heap->aordblks, 1);
atomic_fetch_sub(&heap->uordblks, size);
atomic_sub(&heap->aordblks, 1);
atomic_sub(&heap->uordblks, size);
}
}

View file

@ -1180,7 +1180,7 @@ static void i3c_master_handle_ibi(FAR void *arg)
}
master->ops->recycle_ibi_slot(dev, slot);
atomic_fetch_sub(&dev->ibi->pending_ibis, 1);
atomic_sub(&dev->ibi->pending_ibis, 1);
if (!atomic_read(&dev->ibi->pending_ibis))
{
sem_post(&dev->ibi->all_ibis_handled);
@ -1800,7 +1800,7 @@ err_free_dev:
void i3c_master_queue_ibi(FAR struct i3c_dev_desc *dev,
FAR struct i3c_ibi_slot *slot)
{
atomic_fetch_add(&dev->ibi->pending_ibis, 1);
atomic_add(&dev->ibi->pending_ibis, 1);
work_queue(HPWORK, &slot->work, i3c_master_handle_ibi, slot, 0);
}

View file

@ -169,7 +169,7 @@ static FAR netpkt_t *netpkt_get(FAR struct net_driver_s *dev,
* cases will be limited by netdev_upper_can_tx and seldom reaches here.
*/
if (atomic_fetch_sub(&upper->lower->quota_ptr[type], 1) <= 0)
if (atomic_sub(&upper->lower->quota_ptr[type], 1) <= 0)
{
nwarn("WARNING: Allowing temporarily exceeding quota of %s.\n",
dev->d_ifname);
@ -196,7 +196,7 @@ static void netpkt_put(FAR struct net_driver_s *dev, FAR netpkt_t *pkt,
DEBUGASSERT(dev && pkt);
atomic_fetch_add(&upper->lower->quota_ptr[type], 1);
atomic_add(&upper->lower->quota_ptr[type], 1);
netdev_iob_replace_l2(dev, pkt);
}
@ -1723,9 +1723,9 @@ FAR netpkt_t *netpkt_alloc(FAR struct netdev_lowerhalf_s *dev,
{
FAR netpkt_t *pkt;
if (atomic_fetch_sub(&dev->quota_ptr[type], 1) <= 0)
if (atomic_sub(&dev->quota_ptr[type], 1) <= 0)
{
atomic_fetch_add(&dev->quota_ptr[type], 1);
atomic_add(&dev->quota_ptr[type], 1);
return NULL;
}
@ -1742,7 +1742,7 @@ FAR netpkt_t *netpkt_alloc(FAR struct netdev_lowerhalf_s *dev,
if (pkt == NULL)
{
atomic_fetch_add(&dev->quota_ptr[type], 1);
atomic_add(&dev->quota_ptr[type], 1);
return NULL;
}
@ -1766,7 +1766,7 @@ FAR netpkt_t *netpkt_alloc(FAR struct netdev_lowerhalf_s *dev,
void netpkt_free(FAR struct netdev_lowerhalf_s *dev, FAR netpkt_t *pkt,
enum netpkt_type_e type)
{
atomic_fetch_add(&dev->quota_ptr[type], 1);
atomic_add(&dev->quota_ptr[type], 1);
iob_free_chain(pkt);
}

View file

@ -219,7 +219,7 @@ static inline void notesnap_common(FAR struct note_driver_s *drv,
/* Atomic operation, equivalent to snap.index++; */
index = atomic_fetch_add(&snap->index, 1);
index = atomic_add(&snap->index, 1);
note = &snap->buffer[index % CONFIG_DRIVERS_NOTESNAP_NBUFFERS];
note->type = type;

View file

@ -289,7 +289,7 @@ reset_control_get_internal(FAR struct reset_controller_dev *rcdev,
return NULL;
}
atomic_fetch_add(&rstc->refcnt, 1);
atomic_add(&rstc->refcnt, 1);
return rstc;
}
}
@ -341,7 +341,7 @@ static void reset_control_put_internal(FAR struct reset_control *rstc)
{
DEBUGASSERT(nxmutex_is_locked(&g_reset_list_mutex));
if (atomic_fetch_sub(&rstc->refcnt, 1) == 1)
if (atomic_sub(&rstc->refcnt, 1) == 1)
{
DEBUGASSERT(nxmutex_is_locked(&g_reset_list_mutex));
list_delete(&rstc->list);
@ -864,7 +864,7 @@ int reset_control_reset(FAR struct reset_control *rstc)
return -EINVAL;
}
if (atomic_fetch_add(&rstc->triggered_count, 1) != 0)
if (atomic_add(&rstc->triggered_count, 1) != 0)
{
return 0;
}
@ -883,7 +883,7 @@ int reset_control_reset(FAR struct reset_control *rstc)
if (rstc->shared && ret < 0)
{
atomic_fetch_sub(&rstc->triggered_count, 1);
atomic_sub(&rstc->triggered_count, 1);
}
return ret;
@ -940,7 +940,7 @@ int reset_control_assert(FAR struct reset_control *rstc)
return -EINVAL;
}
if (atomic_fetch_sub(&rstc->deassert_count, 1) != 1)
if (atomic_sub(&rstc->deassert_count, 1) != 1)
{
return 0;
}
@ -1019,7 +1019,7 @@ int reset_control_deassert(FAR struct reset_control *rstc)
return -EINVAL;
}
if (atomic_fetch_add(&rstc->deassert_count, 1) != 0)
if (atomic_add(&rstc->deassert_count, 1) != 0)
{
return 0;
}

View file

@ -605,8 +605,8 @@ void rpmsg_modify_signals(FAR struct rpmsg_s *rpmsg,
FAR struct metal_list *node;
bool needlock;
atomic_fetch_and_acquire(&rpmsg->signals, ~clrflags);
atomic_fetch_or_acquire(&rpmsg->signals, setflags);
atomic_and_acquire(&rpmsg->signals, ~clrflags);
atomic_or_acquire(&rpmsg->signals, setflags);
/* Send signal to Router Hub */

View file

@ -329,7 +329,7 @@ static void rpmsg_port_hold_rx_buffer(FAR struct rpmsg_device *rdev,
{
FAR struct rpmsg_hdr *rphdr = RPMSG_LOCATE_HDR(rxbuf);
atomic_fetch_add(&rphdr->reserved, 1 << RPMSG_BUF_HELD_SHIFT);
atomic_add(&rphdr->reserved, 1 << RPMSG_BUF_HELD_SHIFT);
}
/****************************************************************************
@ -345,7 +345,7 @@ static void rpmsg_port_release_rx_buffer(FAR struct rpmsg_device *rdev,
FAR struct rpmsg_port_header_s *hdr =
metal_container_of(rphdr, struct rpmsg_port_header_s, buf);
uint32_t reserved =
atomic_fetch_sub(&rphdr->reserved, 1 << RPMSG_BUF_HELD_SHIFT);
atomic_sub(&rphdr->reserved, 1 << RPMSG_BUF_HELD_SHIFT);
if ((reserved & RPMSG_BUF_HELD_MASK) == (1 << RPMSG_BUF_HELD_SHIFT))
{

View file

@ -268,7 +268,7 @@ static void rpmsg_port_spi_exchange(FAR struct rpmsg_port_spi_s *rpspi)
int pending;
IOEXP_WRITEPIN(rpspi->ioe, rpspi->mreq, 0);
pending = atomic_fetch_add(&rpspi->transferring, 1);
pending = atomic_add(&rpspi->transferring, 1);
if (pending > 0)
{
if (pending > 1)

View file

@ -243,7 +243,7 @@ static void rpmsg_port_spi_exchange(FAR struct rpmsg_port_spi_s *rpspi)
{
FAR struct rpmsg_port_header_s *txhdr;
if (atomic_fetch_add(&rpspi->transferring, 1))
if (atomic_add(&rpspi->transferring, 1))
{
return;
}

View file

@ -420,12 +420,12 @@ static int bt_bridge_open(FAR struct bt_driver_s *drv)
FAR struct bt_bridge_s *bridge = device->bridge;
FAR struct bt_driver_s *driver = bridge->driver;
if (atomic_fetch_add(&bridge->refs, 1) == 0)
if (atomic_add(&bridge->refs, 1) == 0)
{
int ret = driver->open(driver);
if (ret < 0)
{
atomic_fetch_sub(&bridge->refs, 1);
atomic_sub(&bridge->refs, 1);
}
return ret;
@ -514,7 +514,7 @@ static void bt_bridge_close(FAR struct bt_driver_s *drv)
FAR struct bt_bridge_s *bridge = device->bridge;
FAR struct bt_driver_s *driver = bridge->driver;
if (atomic_fetch_sub(&bridge->refs, 1) == 1)
if (atomic_sub(&bridge->refs, 1) == 1)
{
driver->close(driver);
};

View file

@ -79,7 +79,7 @@ int nxevent_close(FAR nxevent_t *event)
* now.
*/
if (atomic_fetch_sub(&inode->i_crefs, 1) <= 1)
if (atomic_sub(&inode->i_crefs, 1) <= 1)
{
nxevent_destroy(&nevent->ne_event);
group_free(NULL, nevent);

View file

@ -186,7 +186,7 @@ int nxevent_open(FAR nxevent_t **event, FAR const char *name,
/* Initialize the inode */
INODE_SET_NAMEDEVENT(inode);
atomic_fetch_add(&inode->i_crefs, 1);
atomic_add(&inode->i_crefs, 1);
/* Initialize the event groups */

View file

@ -75,7 +75,7 @@ static void fdlist_get_by_index(FAR struct fdlist *list,
*filep = fdp1->f_file;
if (*filep != NULL)
{
atomic_fetch_add(&(*filep)->f_refs, 1);
atomic_add(&(*filep)->f_refs, 1);
}
spin_unlock_irqrestore_notrace(&list->fl_lock, flags);
@ -605,7 +605,7 @@ int fdlist_dupfile(FAR struct fdlist *list, int oflags, int minfd,
fdp = &list->fl_fds[i][j];
if (fdp->f_file == NULL)
{
atomic_fetch_add(&filep->f_refs, 1);
atomic_add(&filep->f_refs, 1);
fdp->f_file = filep;
fdp->f_cloexec = !!(oflags & O_CLOEXEC);
#ifdef CONFIG_FDSAN
@ -836,7 +836,7 @@ void file_ref(FAR struct file *filep)
/* This interface is used to increase the reference count of filep */
DEBUGASSERT(filep);
atomic_fetch_add(&filep->f_refs, 1);
atomic_add(&filep->f_refs, 1);
}
/****************************************************************************
@ -862,7 +862,7 @@ int file_put(FAR struct file *filep)
/* If refs is zero, the close() had called, closing it now. */
if (atomic_fetch_sub(&filep->f_refs, 1) == 1)
if (atomic_sub(&filep->f_refs, 1) == 1)
{
ret = file_close(filep);
if (ret < 0)

View file

@ -47,6 +47,6 @@ void inode_addref(FAR struct inode *inode)
{
if (inode)
{
atomic_fetch_add(&inode->i_crefs, 1);
atomic_add(&inode->i_crefs, 1);
}
}

View file

@ -68,7 +68,7 @@ int inode_find(FAR struct inode_search_s *desc)
/* Increment the reference count on the inode */
atomic_fetch_add(&inode->i_crefs, 1);
atomic_add(&inode->i_crefs, 1);
}
inode_runlock();

View file

@ -53,7 +53,7 @@ void inode_release(FAR struct inode *inode)
{
/* Decrement the references of the inode */
if (atomic_fetch_sub(&inode->i_crefs, 1) <= 1)
if (atomic_sub(&inode->i_crefs, 1) <= 1)
{
DEBUGASSERT(inode->i_peer == NULL);
inode_free(inode);

View file

@ -119,7 +119,7 @@ static FAR struct inode *inode_unlink(FAR const char *path)
inode->i_peer = NULL;
inode->i_parent = NULL;
atomic_fetch_sub(&inode->i_crefs, 1);
atomic_sub(&inode->i_crefs, 1);
}
errout:

View file

@ -436,7 +436,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
if (drvr_inode != NULL)
#endif
{
atomic_fetch_add(&drvr_inode->i_crefs, 1);
atomic_add(&drvr_inode->i_crefs, 1);
}
#endif
@ -464,7 +464,7 @@ int nx_mount(FAR const char *source, FAR const char *target,
if (drvr_inode != NULL)
#endif
{
atomic_fetch_sub(&drvr_inode->i_crefs, 1);
atomic_sub(&drvr_inode->i_crefs, 1);
}
#endif

View file

@ -151,7 +151,7 @@ int nx_umount2(FAR const char *target, unsigned int flags)
{
/* Just decrement the reference count (without deleting it) */
atomic_fetch_sub(&mountpt_inode->i_crefs, 1);
atomic_sub(&mountpt_inode->i_crefs, 1);
inode_unlock();
}
else

View file

@ -337,7 +337,7 @@ static int file_mq_vopen(FAR struct file *mq, FAR const char *mq_name,
/* Set the initial reference count on this inode to one */
atomic_fetch_add(&inode->i_crefs, 1);
atomic_add(&inode->i_crefs, 1);
if (created)
{

View file

@ -87,7 +87,7 @@ int nxsem_close(FAR sem_t *sem)
* now.
*/
if (atomic_fetch_sub(&inode->i_crefs, 1) <= 1)
if (atomic_sub(&inode->i_crefs, 1) <= 1)
{
nxsem_destroy(&nsem->ns_sem);
group_free(NULL, nsem);

View file

@ -211,7 +211,7 @@ int nxsem_open(FAR sem_t **sem, FAR const char *name, int oflags, ...)
/* Initialize the inode */
INODE_SET_NAMEDSEM(inode);
atomic_fetch_add(&inode->i_crefs, 1);
atomic_add(&inode->i_crefs, 1);
/* Initialize the semaphore */

View file

@ -155,7 +155,7 @@ static int file_shm_open(FAR struct file *shm, FAR const char *name,
INODE_SET_SHM(inode);
inode->u.i_ops = &g_shmfs_operations;
inode->i_private = NULL;
atomic_fetch_add(&inode->i_crefs, 1);
atomic_add(&inode->i_crefs, 1);
}
/* Associate the inode with a file structure */

View file

@ -220,7 +220,7 @@ static off_t seek_pseudodir(FAR struct file *filep, off_t offset)
{
/* Increment the reference count on this next node */
atomic_fetch_add(&curr->i_crefs, 1);
atomic_add(&curr->i_crefs, 1);
}
inode_unlock();
@ -389,7 +389,7 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir,
{
/* Increment the reference count on this next node */
atomic_fetch_add(&pdir->next->i_crefs, 1);
atomic_add(&pdir->next->i_crefs, 1);
}
inode_unlock();

View file

@ -358,7 +358,7 @@ int file_open(FAR struct file *filep, FAR const char *path, int oflags, ...)
if (ret >= OK)
{
atomic_fetch_add(&filep->f_refs, 1);
atomic_add(&filep->f_refs, 1);
}
return ret;

View file

@ -50,6 +50,6 @@ void fs_profile_stop(FAR clock_t *start, FAR atomic64_t *total,
clock_t stop = perf_gettime();
clock_t delta = stop - *start;
atomic64_fetch_add(total, delta);
atomic_fetch_add(count, 1);
atomic64_add(total, delta);
atomic_add(count, 1);
}

View file

@ -551,7 +551,7 @@ int pseudofile_create(FAR struct inode **node, FAR const char *path,
(*node)->u.i_ops = &g_pseudofile_ops;
(*node)->i_private = pf;
atomic_fetch_add(&(*node)->i_crefs, 1);
atomic_add(&(*node)->i_crefs, 1);
inode_unlock();
#ifdef CONFIG_FS_NOTIFY

View file

@ -183,7 +183,7 @@ static inline_function void rspin_lock_init(FAR rspinlock_t *lock)
static inline_function void spin_lock_notrace(FAR volatile spinlock_t *lock)
{
#ifdef CONFIG_TICKET_SPINLOCK
int ticket = atomic_fetch_add(&lock->next, 1);
int ticket = atomic_add(&lock->next, 1);
while (atomic_read(&lock->owner) != ticket)
#else /* CONFIG_TICKET_SPINLOCK */
while (up_testset(lock) == SP_LOCKED)
@ -375,7 +375,7 @@ spin_unlock_notrace(FAR volatile spinlock_t *lock)
{
UP_DMB();
#ifdef CONFIG_TICKET_SPINLOCK
atomic_fetch_add(&lock->owner, 1);
atomic_add(&lock->owner, 1);
#else
*lock = SP_UNLOCKED;
#endif
@ -1105,7 +1105,7 @@ static inline_function void read_unlock(FAR volatile rwlock_t *lock)
DEBUGASSERT(atomic_read(lock) >= RW_SP_READ_LOCKED);
UP_DMB();
atomic_fetch_sub(lock, 1);
atomic_sub(lock, 1);
UP_DSB();
UP_SEV();
}

View file

@ -140,7 +140,7 @@ void lib_put_tempbuffer(FAR char *buffer)
{
DEBUGASSERT((atomic_read(&g_tempbuffer.free_bitmap) &
(1u << index)) == 0);
atomic_fetch_or_acquire(&g_tempbuffer.free_bitmap, 1u << index);
atomic_or_acquire(&g_tempbuffer.free_bitmap, 1u << index);
return;
}

View file

@ -113,7 +113,7 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond,
sinfo("Give up mutex...\n");
atomic_fetch_add(COND_WAIT_COUNT(cond), 1);
atomic_add(COND_WAIT_COUNT(cond), 1);
/* Give up the mutex */

View file

@ -90,7 +90,7 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex)
sinfo("Give up mutex / take cond\n");
atomic_fetch_add(COND_WAIT_COUNT(cond), 1);
atomic_add(COND_WAIT_COUNT(cond), 1);
ret = pthread_mutex_breaklock(mutex, &nlocks);
status = -nxsem_wait_uninterruptible(&cond->sem);

View file

@ -469,7 +469,7 @@ void addrenv_take(FAR struct addrenv_s *addrenv)
if (addrenv != NULL)
{
atomic_fetch_add(&addrenv->refs, 1);
atomic_add(&addrenv->refs, 1);
}
}
@ -495,7 +495,7 @@ int addrenv_give(FAR struct addrenv_s *addrenv)
* address environment has become unreferenced and should be destroyed.
*/
return addrenv ? atomic_fetch_sub(&addrenv->refs, 1) - 1 : 1;
return addrenv ? atomic_sub(&addrenv->refs, 1) - 1 : 1;
}
/****************************************************************************

View file

@ -982,7 +982,7 @@ void nxsem_release_all(FAR struct tcb_s *htcb)
* that was taken by sem_wait() or sem_post().
*/
atomic_fetch_add(NXSEM_COUNT(sem), 1);
atomic_add(NXSEM_COUNT(sem), 1);
}
}
}

View file

@ -96,7 +96,7 @@ int nxsem_post_slow(FAR sem_t *sem)
/* Lock the mutex for us by setting the blocking bit */
mholder = atomic_fetch_or(NXSEM_MHOLDER(sem), NXSEM_MBLOCKING_BIT);
mholder = atomic_or(NXSEM_MHOLDER(sem), NXSEM_MBLOCKING_BIT);
/* Mutex post from another thread is not allowed, unless
* called from nxsem_reset. The comparison uses the same encoding

View file

@ -112,14 +112,14 @@ void nxsem_recover(FAR struct tcb_s *tcb)
if (dq_empty(SEM_WAITLIST(sem)))
{
uint32_t mholder =
atomic_fetch_and(NXSEM_MHOLDER(sem), ~NXSEM_MBLOCKING_BIT);
atomic_and(NXSEM_MHOLDER(sem), ~NXSEM_MBLOCKING_BIT);
DEBUGASSERT(NXSEM_MBLOCKING(mholder));
}
}
else
{
DEBUGASSERT(atomic_read(NXSEM_COUNT(sem)) < 0);
atomic_fetch_add(NXSEM_COUNT(sem), 1);
atomic_add(NXSEM_COUNT(sem), 1);
}
#ifdef CONFIG_MM_KMAP

View file

@ -117,7 +117,7 @@ int nxsem_trywait_slow(FAR sem_t *sem)
}
else
{
atomic_fetch_add(NXSEM_COUNT(sem), 1);
atomic_add(NXSEM_COUNT(sem), 1);
}
}
else

View file

@ -117,7 +117,7 @@ int nxsem_wait_slow(FAR sem_t *sem)
* this is all that is needed if we block
*/
mholder = atomic_fetch_or(NXSEM_MHOLDER(sem), NXSEM_MBLOCKING_BIT);
mholder = atomic_or(NXSEM_MHOLDER(sem), NXSEM_MBLOCKING_BIT);
/* Avoid mutex recursion, which is not allowed. The comparison uses
* the lock side's encoding so that ids of either sign compare the
@ -143,7 +143,7 @@ int nxsem_wait_slow(FAR sem_t *sem)
}
else
{
unlocked = atomic_fetch_sub(NXSEM_COUNT(sem), 1) > 0;
unlocked = atomic_sub(NXSEM_COUNT(sem), 1) > 0;
}
if (unlocked)
@ -160,7 +160,7 @@ int nxsem_wait_slow(FAR sem_t *sem)
}
else
{
atomic_fetch_add(NXSEM_COUNT(sem), 1);
atomic_add(NXSEM_COUNT(sem), 1);
}
leave_critical_section(flags);

View file

@ -105,12 +105,12 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
{
if (dq_empty(SEM_WAITLIST(sem)))
{
atomic_fetch_and(NXSEM_MHOLDER(sem), ~NXSEM_MBLOCKING_BIT);
atomic_and(NXSEM_MHOLDER(sem), ~NXSEM_MBLOCKING_BIT);
}
}
else
{
atomic_fetch_add(NXSEM_COUNT(sem), 1);
atomic_add(NXSEM_COUNT(sem), 1);
}
/* Indicate that the wait is over. */

View file

@ -40,12 +40,12 @@
#define bt_atomic_set(ptr, value) atomic_set(ptr, value);
#define bt_atomic_get(ptr) atomic_read(ptr)
#define bt_atomic_testbit(ptr, bitno) ((atomic_read(ptr) & (1 << (bitno))) != 0)
#define bt_atomic_incr(ptr) atomic_fetch_add(ptr, 1)
#define bt_atomic_decr(ptr) atomic_fetch_sub(ptr, 1)
#define bt_atomic_setbit(ptr, bitno) atomic_fetch_or(ptr, (1 << (bitno)))
#define bt_atomic_clrbit(ptr, bitno) atomic_fetch_and(ptr, ~(1 << (bitno)))
#define bt_atomic_testsetbit(ptr, bitno) ((atomic_fetch_or(ptr, (1 << (bitno))) & (1 << (bitno))) != 0)
#define bt_atomic_testclrbit(ptr, bitno) ((atomic_fetch_and(ptr, ~(1 << (bitno))) & (1 << (bitno))) != 0)
#define bt_atomic_incr(ptr) atomic_add(ptr, 1)
#define bt_atomic_decr(ptr) atomic_sub(ptr, 1)
#define bt_atomic_setbit(ptr, bitno) atomic_or(ptr, (1 << (bitno)))
#define bt_atomic_clrbit(ptr, bitno) atomic_and(ptr, ~(1 << (bitno)))
#define bt_atomic_testsetbit(ptr, bitno) ((atomic_or(ptr, (1 << (bitno))) & (1 << (bitno))) != 0)
#define bt_atomic_testclrbit(ptr, bitno) ((atomic_and(ptr, ~(1 << (bitno))) & (1 << (bitno))) != 0)
/****************************************************************************
* Public Types