atomic_cmpxchg
emit_mov_i(ctx, MIPS_R_T9, (u32)&atomic_cmpxchg);
old = atomic_cmpxchg(&nmi_running, old, new);
if (!atomic_cmpxchg(&nmi_running, 0, MOD_CODE_WRITE_FLAG))
} while (atomic_cmpxchg(&nmi_running, 0, MOD_CODE_WRITE_FLAG));
rc = atomic_cmpxchg(&cb->is_handle_destroyed, 0, 1);
do_ctx_switch = atomic_cmpxchg(&ctx->thread_ctx_switch_token, 1, 0);
rc = atomic_cmpxchg(&hdev->captured_err_info.cs_timeout.write_enable, 1, 0);
if (atomic_cmpxchg(&hdev->captured_err_info.razwi_info.razwi_detected, 0, 1))
if (atomic_cmpxchg(&pgf_info->page_fault_detected, 0, 1))
if (atomic_cmpxchg(&info->event_detected, 0, 1))
if (atomic_cmpxchg(&info->event_detected, 0, 1))
if (atomic_cmpxchg(&info->event_detected, 0, 1))
if (atomic_cmpxchg(&free_node->in_use, 0, 1)) {
if (atomic_cmpxchg(&buf->mmap, 0, 1)) {
if (atomic_cmpxchg(&vdev->pm->reset_pending, 0, 1) == 0) {
(r = atomic_cmpxchg(&device->md_io.in_use, 0, 1)) == 0 ||
if (atomic_cmpxchg(&ba431->reset_pending, 0, 1))
if (atomic_cmpxchg(&drvdata->pending_hw, 0, 1) == 0) {
if (atomic_cmpxchg(&drvdata->pending_hw, 0, 1) == 0) {
} else if (atomic_cmpxchg(&pretimeout_since_last_heartbeat, 1, 0)) {
if (atomic_cmpxchg(&cxlrd->region_id, id, rc) != id) {
if (atomic_cmpxchg(&reused->state,
if (atomic_cmpxchg(&device->state,
if (atomic_cmpxchg(&device->state,
if (atomic_cmpxchg(&device->state,
if (atomic_cmpxchg(&device->state,
if (atomic_cmpxchg(&device->state,
atomic_cmpxchg(&scmi_syspower_registered, 0, 1)) {
ret = atomic_cmpxchg(&xfer->busy, SCMI_XFER_FREE, SCMI_XFER_BUSY);
ret = atomic_cmpxchg(inflight, INFLIGHT_NONE, xfer->hdr.seq);
int abiv = atomic_cmpxchg(&cdata->watch_abi_version, 0, version);
ret = atomic_cmpxchg(&aca->ue_update_flag, 0, 1) == 0;
} while (atomic_cmpxchg(&drv->last_seq, last_seq, seq) != last_seq);
ret = atomic_cmpxchg(&mca->ue_update_flag, 0, 1) == 0;
if (amdgpu_ras_is_rma(adev) && atomic_cmpxchg(&ras->rma_in_recovery, 0, 1) == 0)
if (atomic_cmpxchg(&amdgpu_ras_in_intr, 0, 1) == 0) {
if (atomic_cmpxchg(&ras->in_recovery, 0, 1) == 0) {
if (!atomic_cmpxchg(&adev->uvd.handles[i], 0, handle)) {
atomic_cmpxchg(&adev->uvd.handles[i], handle, 0);
if (!atomic_cmpxchg(&p->adev->vce.handles[i], 0, handle)) {
old_poison = atomic_cmpxchg(&p->poison, 0, 1);
if (atomic_cmpxchg(&prange->invalid, invalid, 0) != invalid)
if (atomic_cmpxchg(&svms->evicted_ranges, evicted_ranges, 0) !=
if (atomic_cmpxchg(&ce->pin_count, 1, 2) == 1) {
enum preempt_state cur = atomic_cmpxchg(&a5xx_gpu->preempt_state,
enum a6xx_preempt_state cur = atomic_cmpxchg(&a6xx_gpu->preempt_state,
if (atomic_cmpxchg(&cgrp->rc, NVKM_CGRP_RC_NONE, NVKM_CGRP_RC_PENDING) != NVKM_CGRP_RC_NONE)
state = atomic_cmpxchg(&cgrp->rc, NVKM_CGRP_RC_PENDING, NVKM_CGRP_RC_RUNNING);
old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
old = atomic_cmpxchg(&dsi->do_ext_te_update, 1, 0);
if (!atomic_cmpxchg(&ptdev->reset.pending, 0, 1) &&
if (ret && atomic_cmpxchg(&ptdev->pm.recovery_needed, 1, 0) == 1)
if (!atomic_cmpxchg(&p->rdev->uvd.handles[i], 0, handle)) {
atomic_cmpxchg(&p->rdev->uvd.handles[i], handle, 0);
if (!atomic_cmpxchg(&p->rdev->vce.handles[i], 0, handle)) {
atomic_cmpxchg(&p->rdev->vce.handles[i], handle, 0);
const pid_t pid = atomic_cmpxchg(&dev_priv->mksstat_kern_pids[_##kern_cntr.slot], current->pid, MKSSTAT_PID_RESERVED); \
pid = atomic_cmpxchg(&dev_priv->mksstat_user_pids[slot], pgid, MKSSTAT_PID_RESERVED);
if (!atomic_cmpxchg(&dev_priv->mksstat_kern_pids[slot], 0, MKSSTAT_PID_RESERVED)) {
const pid_t pid1 = atomic_cmpxchg(&dev_priv->mksstat_user_pids[i], pid0, MKSSTAT_PID_RESERVED);
const pid_t pid1 = atomic_cmpxchg(&dev_priv->mksstat_kern_pids[i], pid0, MKSSTAT_PID_RESERVED);
if (!atomic_cmpxchg(&dev_priv->mksstat_user_pids[slot], 0, MKSSTAT_PID_RESERVED))
ret = atomic_cmpxchg(&du->vkms.atomic_lock,
ret = atomic_cmpxchg(&du->vkms.atomic_lock,
ret = atomic_cmpxchg(&du->vkms.atomic_lock,
} while ((u32)atomic_cmpxchg(&sp->min_val, old, live) != old);
if (WARN_ON_ONCE(atomic_cmpxchg(&msc->user_count, -1, 0) != -1))
count = atomic_cmpxchg(&msc->user_count, 0, -1);
return atomic_cmpxchg(&uobj->usecnt, 0, -1) == 0 ? 0 : -EBUSY;
old_state = atomic_cmpxchg(&dev->admin_state, IONIC_ADMIN_ACTIVE,
if (atomic_cmpxchg(&cq->armed, 1, 0))
if (!atomic_cmpxchg(&iwcq->armed, 0, 1) || promo_event) {
if (atomic_cmpxchg(&dev->update_sl, 1, 0))
if (atomic_cmpxchg(&dev->update_sl, 1, 0))
if (atomic_cmpxchg(&msi_data->initialized, false, true))
if (!atomic_cmpxchg(&ch->rx_status, 0, GPUEB_MBOX_FULL | GPUEB_MBOX_BLOCKED))
status = atomic_cmpxchg(&ch->rx_status, GPUEB_MBOX_FULL | GPUEB_MBOX_BLOCKED,
} while (atomic_cmpxchg(&c->rescale, r, r + next) != r);
count = atomic_cmpxchg(&ca->io_count, old, new);
errors = atomic_cmpxchg(&ca->io_errors,
actual = atomic_cmpxchg(&data_vio->compression.status, expected, replacement);
if (atomic_cmpxchg(&pool->processing, false, true))
return (atomic_cmpxchg(&context->state, old, new) == old);
return (atomic_cmpxchg(&zone->timer_state, old, new) == old);
if (atomic_cmpxchg(&vdo->processing_message, 0, 1) != 0)
if (atomic_cmpxchg(&admin->busy, 0, 1) != 0) {
if ((atomic_read(&queue->idle) != 1) || (atomic_cmpxchg(&queue->idle, 1, 0) != 1))
prior_state = atomic_cmpxchg(&counter->state, LOCK_COUNTER_STATE_SUSPENDED,
prior_state = atomic_cmpxchg(&journal->lock_counter.state,
prior_state = atomic_cmpxchg(&counter->state, LOCK_COUNTER_STATE_NOT_NOTIFYING,
atomic_cmpxchg(&allocator->depot->vdo->state, VDO_RECOVERING,
if (atomic_cmpxchg(&fh->v4l_reading, 1, 0) == 1) {
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
if (atomic_cmpxchg(&fh->v4l_reading, 1, 0) == 1) {
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
if (atomic_cmpxchg(stopping, 1, 0)) {
if (brightness != LED_OFF && atomic_cmpxchg(&rr3->flash, 0, 1) == 0) {
if (atomic_cmpxchg(&BOND_AD_INFO(bond).agg_select_timer,
} while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
} while (atomic_cmpxchg(flags, flags_old, flags_new) != flags_old);
old = atomic_cmpxchg((v), c, c + a);
old = atomic_cmpxchg((v), c, c - a);
atomic_cmpxchg(octeon_dev->adapter_fw_state,
fw_state = atomic_cmpxchg(octeon_dev->adapter_fw_state,
if (atomic_cmpxchg(&tx->dqo_compl.free_pending_packets,
if (atomic_cmpxchg(&tx->dqo_compl.free_tx_qpl_buf_head,
state = atomic_cmpxchg(&pf->ipsec.cpt_state,
if (atomic_cmpxchg(&rep->rep_data[rep_type].state,
if (atomic_cmpxchg(&rep->rep_data[rep_type].state,
if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0)) {
} else if (atomic_cmpxchg(&tx_queue->flush_outstanding,
if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0))
} else if (atomic_cmpxchg(&tx_queue->flush_outstanding,
state = atomic_cmpxchg(&ipa->modem_state, IPA_MODEM_STATE_STOPPED,
state = atomic_cmpxchg(&ipa->modem_state, IPA_MODEM_STATE_RUNNING,
if (atomic_cmpxchg(&array[*idx].allocated, 0, 1) == 0)
atomic_cmpxchg(&wcid->non_aql_packets, pending, 0);
cur = atomic_cmpxchg(&hal->roc_chanctx_idx,
cur = atomic_cmpxchg(&hal->roc_chanctx_idx, idx,
cur = atomic_cmpxchg(&wait->cond, RTW89_WAIT_COND_IDLE, cond);
cur = atomic_cmpxchg(&wait->cond, cond, RTW89_WAIT_COND_IDLE);
if (atomic_cmpxchg(&dev_data->available, 1, 0) == 0)
if (atomic_cmpxchg(&dev_data->available, 1, 0) == 0)
} while (atomic_cmpxchg(&service->poll_flags, value,
} while (atomic_cmpxchg(&state->poll_services[index],
if (atomic_cmpxchg(&port->state,
if (atomic_cmpxchg (&device->tasklet_scheduled, 0, 1) != 0)
if (atomic_cmpxchg(&block->tasklet_scheduled, 0, 1) != 0)
if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0)
if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0)
if (!atomic_cmpxchg(&q_indicators[i].count, 0, 1))
switch (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_ESTABLISHED,
if (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_UNINITIALIZED,
if (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_ALLOCATED,
if (atomic_cmpxchg(&phba->dbg_log_dmping, 0, 1) != 0)
if (old_val == atomic_cmpxchg(&fcport->shadow_disc_state,
old = atomic_cmpxchg((v), c, dec);
if (old && atomic_cmpxchg(&sdev->restarts, old, 0) == old)
if (!atomic_cmpxchg(&cmd_cnt->stopped, 0, 1))
opened = atomic_cmpxchg(&v->opened, 0, 1);
opened = atomic_cmpxchg(&v->opened, 0, 1);
old = atomic_cmpxchg(&ddata->do_update, 1, 0);
atomic_cmpxchg(&volume->cb_v_check, cb_v_check, op->cb_v_break);
} while (atomic_cmpxchg(&node->ulp_delivered, oval, nval) != oval);
} while (atomic_cmpxchg(&node->seq_next, oval, nval) != oval);
} while (atomic_cmpxchg((atomic_t *)&folio->private, orig, v) != orig);
if (old_state != atomic_cmpxchg(&sbi->attr_tree_state,
if (atomic_cmpxchg(&entry->e_refcnt, 2, 0) != 2)
atomic_cmpxchg(&entry->e_refcnt, 1, 0) != 1) {
if (atomic_cmpxchg(&c->need_wait_space, 0, 1) == 0) {
int ret = likely(atomic_cmpxchg(&page->_refcount, count, 0) == count);
atomic_cmpxchg(index, old, new);
if (atomic_cmpxchg(&req->poll_refs, 1, 0) != 1)
atomic_cmpxchg(&selem->state, SELEM_UNLINKED, SELEM_TOFREE) == SELEM_UNLINKED)
BPF_R0 = (u32) atomic_cmpxchg(
(void)atomic_cmpxchg(&work->node.a_flags, flags, flags & ~IRQ_WORK_BUSY);
if (!atomic_cmpxchg(&key->enabled, 0, -1)) {
if (atomic_cmpxchg(&key->enabled, 1, 0) == 1)
if (atomic_cmpxchg(&optimizer_state,
if (atomic_cmpxchg(&ldev->in_use, 0, 1))
atomic_cmpxchg(&group->rtpoll_wakeup, 1, 0) ||
atomic_cmpxchg(&nr_records, i, index + 1);
} while ((v = atomic_cmpxchg(&cl->remaining, old, new)) != old);
if (atomic_cmpxchg(&ctx->in_use, 0, 1) == 0)
if (atomic_cmpxchg(&huge_zero_refcount, 1, 0) == 1) {
KUNIT_EXPECT_KASAN_FAIL(test, atomic_cmpxchg(unsafe, 21, 42));
state = atomic_cmpxchg(&prdev->state, state, PAGE_REPORTING_IDLE);
atomic_cmpxchg(&mm->tlb_flush_batched, batch,
atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending,
atomic_cmpxchg(&local->aql_ac_pending_airtime[ac],
} while (atomic_cmpxchg(priv->counter, oval, nval) != oval);
} while (atomic_cmpxchg(&info->master->count, oval, nval) != oval);
if (atomic_cmpxchg(&ic->i_credits, oldval, newval) != oldval)
return atomic_cmpxchg(&cp->cp_state, old, new) == old;
!atomic_cmpxchg(&rx->key_distr, 0, KEY_DISTR_SCHED)) {
atomic_cmpxchg(&rx->peer_rx_active, cur, new) == cur) {
if (atomic_cmpxchg(&rx->key_distr,
atomic_cmpxchg(&rx->key_distr, KEY_DISTR_COMPL, 0);
} while (atomic_cmpxchg(&tmp->users, cur, val) != cur);
return atomic_cmpxchg(v, old, new);
atomic_cmpxchg(&ima_setxattr_allowed_hash_algorithms,
#define atomic_cmpxchg_relaxed atomic_cmpxchg
#define atomic_cmpxchg_release atomic_cmpxchg
ret = atomic_cmpxchg(ptr, old, new);