| /linux/arch/sh/include/asm/ |
| H A D | bitops-cas.h | 5 static inline unsigned __bo_cas(volatile unsigned *p, unsigned old, unsigned new) in __bo_cas() argument 9 : "r"(old), "z"(p) in __bo_cas() 16 unsigned mask, old; in set_bit() local 22 do old = *a; in set_bit() 23 while (__bo_cas(a, old, old|mask) != old); in set_bit() 28 unsigned mask, old; in clear_bit() local 34 do old = *a; in clear_bit() 35 while (__bo_cas(a, old, old&~mask) != old); in clear_bit() 40 unsigned mask, old; in change_bit() local 46 do old = *a; in change_bit() [all …]
|
| H A D | spinlock-cas.h | 13 static inline unsigned __sl_cas(volatile unsigned *p, unsigned old, unsigned new) in __sl_cas() argument 17 : "r"(old), "z"(p) in __sl_cas() 54 unsigned old; in arch_read_lock() local 55 do old = rw->lock; in arch_read_lock() 56 while (!old || __sl_cas(&rw->lock, old, old-1) != old); in arch_read_lock() 61 unsigned old; in arch_read_unlock() local 62 do old = rw->lock; in arch_read_unlock() 63 while (__sl_cas(&rw->lock, old, old+1) != old); in arch_read_unlock() 78 unsigned old; in arch_read_trylock() local 79 do old = rw->lock; in arch_read_trylock() [all …]
|
| /linux/arch/s390/include/asm/ |
| H A D | cmpxchg.h | 18 static __always_inline u32 __cs_asm(u64 ptr, u32 old, u32 new) in __cs_asm() argument 21 " cs %[old],%[new],%[ptr]" in __cs_asm() 22 : [old] "+d" (old), [ptr] "+Q" (*(u32 *)ptr) in __cs_asm() 25 return old; in __cs_asm() 28 static __always_inline u64 __csg_asm(u64 ptr, u64 old, u64 new) in __csg_asm() argument 31 " csg %[old],%[new],%[ptr]" in __csg_asm() 32 : [old] "+d" (old), [ptr] "+QS" (*(u64 *)ptr) in __csg_asm() 35 return old; in __csg_asm() 38 static inline u8 __arch_cmpxchg1(u64 ptr, u8 old, u8 new) in __arch_cmpxchg1() argument 52 if (old32.b[i] != old) in __arch_cmpxchg1() [all …]
|
| H A D | spinlock.h | 76 int old = 0; in arch_spin_trylock_once() local 79 return likely(arch_try_cmpxchg(&lp->lock, &old, spinlock_lockval())); in arch_spin_trylock_once() 126 int old; in arch_read_lock() local 128 old = __atomic_add(1, &rw->cnts); in arch_read_lock() 129 if (old & 0xffff0000) in arch_read_lock() 140 int old = 0; in arch_write_lock() local 142 if (!arch_try_cmpxchg(&rw->cnts, &old, 0x30000)) in arch_write_lock() 154 int old; in arch_read_trylock() local 156 old = READ_ONCE(rw->cnts); in arch_read_trylock() 157 return (!(old & 0xffff0000) && arch_try_cmpxchg(&rw->cnts, &old, old + 1)); in arch_read_trylock() [all …]
|
| /linux/arch/powerpc/include/asm/ |
| H A D | cmpxchg.h | 42 u32 __cmpxchg_##type##sfx(volatile void *p, u32 old, u32 new) \ 49 old <<= bitoff; \ 67 : "r" (p), "r" (old), "r" (new), "r" (prev_mask) \ 269 * Compare and exchange - if *p == old, set it to new, 270 * and return the old value of *p. 283 __cmpxchg_u8(volatile unsigned char *p, unsigned long old, unsigned long new) in __cmpxchg_u8() argument 298 : "r" (p), "r" (old), "r" (new) in __cmpxchg_u8() 305 __cmpxchg_u8_local(volatile unsigned char *p, unsigned long old, in __cmpxchg_u8_local() argument 318 : "r" (p), "r" (old), "r" (new) in __cmpxchg_u8_local() 325 __cmpxchg_u8_relaxed(u8 *p, unsigned long old, unsigned long new) in __cmpxchg_u8_relaxed() argument [all …]
|
| /linux/security/safesetid/ |
| H A D | lsm.c | 145 * Check whether a caller with old credentials @old is allowed to switch to 148 static bool id_permitted_for_cred(const struct cred *old, kid_t new_id, enum setid_type new_type) in id_permitted_for_cred() argument 152 /* If our old creds already had this ID in it, it's fine. */ in id_permitted_for_cred() 154 if (uid_eq(new_id.uid, old->uid) || uid_eq(new_id.uid, old->euid) || in id_permitted_for_cred() 155 uid_eq(new_id.uid, old->suid)) in id_permitted_for_cred() 158 if (gid_eq(new_id.gid, old->gid) || gid_eq(new_id.gid, old->egid) || in id_permitted_for_cred() 159 gid_eq(new_id.gid, old->sgid)) in id_permitted_for_cred() 165 * Transitions to new UIDs require a check against the policy of the old in id_permitted_for_cred() 169 setid_policy_lookup((kid_t){.uid = old->uid}, new_id, new_type) != SIDPOL_CONSTRAINED; in id_permitted_for_cred() 174 __kuid_val(old->uid), __kuid_val(old->euid), in id_permitted_for_cred() [all …]
|
| /linux/drivers/input/joystick/iforce/ |
| H A D | iforce-ff.c | 178 struct ff_effect *old, in need_condition_modifier() argument 191 ret |= old->u.condition[i].right_saturation != new->u.condition[i].right_saturation in need_condition_modifier() 192 || old->u.condition[i].left_saturation != new->u.condition[i].left_saturation in need_condition_modifier() 193 || old->u.condition[i].right_coeff != new->u.condition[i].right_coeff in need_condition_modifier() 194 || old->u.condition[i].left_coeff != new->u.condition[i].left_coeff in need_condition_modifier() 195 || old->u.condition[i].deadband != new->u.condition[i].deadband in need_condition_modifier() 196 || old->u.condition[i].center != new->u.condition[i].center; in need_condition_modifier() 206 struct ff_effect *old, in need_magnitude_modifier() argument 215 return old->u.constant.level != effect->u.constant.level; in need_magnitude_modifier() 222 static int need_envelope_modifier(struct iforce *iforce, struct ff_effect *old, in need_envelope_modifier() argument [all …]
|
| /linux/arch/s390/lib/ |
| H A D | spinlock.c | 106 static inline int arch_try_cmpxchg_niai8(int *lock, int old, int new) in arch_try_cmpxchg_niai8() argument 112 " cs %[old],%[new],%[lock]" in arch_try_cmpxchg_niai8() 113 : [old] "+d" (old), [lock] "+Q" (*lock), "=@cc" (cc) in arch_try_cmpxchg_niai8() 121 static inline int arch_try_cmpxchg_niai8(int *lock, int old, int new) in arch_try_cmpxchg_niai8() argument 123 int expected = old; in arch_try_cmpxchg_niai8() 127 " cs %[old],%[new],%[lock]" in arch_try_cmpxchg_niai8() 128 : [old] "+d" (old), [lock] "+Q" (*lock) in arch_try_cmpxchg_niai8() 131 return expected == old; in arch_try_cmpxchg_niai8() 159 int lockval, ix, node_id, tail_id, old, new, owner, count; in arch_spin_lock_queued() local 169 old = READ_ONCE(lp->lock); in arch_spin_lock_queued() [all …]
|
| /linux/arch/sparc/kernel/ |
| H A D | ftrace.c | 26 static int ftrace_modify_code(unsigned long ip, u32 old, u32 new) in ftrace_modify_code() argument 32 "1: cas [%[ip]], %[old], %[new]\n" in ftrace_modify_code() 47 : [new] "0" (new), [old] "r" (old), [ip] "r" (ip) in ftrace_modify_code() 50 if (replaced != old && replaced != new) in ftrace_modify_code() 59 u32 old, new; in ftrace_make_nop() local 61 old = ftrace_call_replace(ip, addr); in ftrace_make_nop() 63 return ftrace_modify_code(ip, old, new); in ftrace_make_nop() 69 u32 old, new; in ftrace_make_call() local 71 old = ftrace_nop; in ftrace_make_call() 73 return ftrace_modify_code(ip, old, new); in ftrace_make_call() [all …]
|
| /linux/kernel/ |
| H A D | tracepoint.c | 115 static inline void release_probes(struct tracepoint *tp, struct tracepoint_func *old) in release_probes() argument 117 if (old) { in release_probes() 118 struct tp_probes *tp_probes = container_of(old, in release_probes() 146 struct tracepoint_func *old, *new; in func_add() local 147 int iter_probes; /* Iterate over old probe array. */ in func_add() 155 old = *funcs; in func_add() 156 if (old) { in func_add() 158 for (iter_probes = 0; old[iter_probes].func; iter_probes++) { in func_add() 159 if (old[iter_probes].func == tp_stub_func) in func_add() 161 if (old[iter_probes].func == tp_func->func && in func_add() [all …]
|
| H A D | cred.c | 182 const struct cred *old; in prepare_creds() local 191 old = task->cred; in prepare_creds() 192 memcpy(new, old, sizeof(struct cred)); in prepare_creds() 215 if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) in prepare_creds() 359 * the old set. Both the objective and the subjective credentials pointers are 371 const struct cred *old = task->real_cred; in commit_creds() local 376 BUG_ON(task->cred != old); in commit_creds() 382 if (!uid_eq(old->euid, new->euid) || in commit_creds() 383 !gid_eq(old->egid, new->egid) || in commit_creds() 384 !uid_eq(old in commit_creds() 560 const struct cred *old; prepare_kernel_cred() local [all...] |
| /linux/net/smc/ |
| H A D | smc_cdc.h | 146 /* calculate cursor difference between old and new, where old <= new and 150 union smc_host_cursor *old, in smc_curs_diff() argument 153 if (old->wrap != new->wrap) in smc_curs_diff() 155 ((size - old->count) + new->count)); in smc_curs_diff() 157 return max_t(int, 0, (new->count - old->count)); in smc_curs_diff() 160 /* calculate cursor difference between old and new - returns negative 161 * value in case old > new 164 union smc_host_cursor *old, in smc_curs_comp() argument 167 if (old->wrap > new->wrap || in smc_curs_comp() 168 (old->wrap == new->wrap && old->count > new->count)) in smc_curs_comp() [all …]
|
| /linux/tools/testing/selftests/bpf/progs/ |
| H A D | map_kptr_race.c | 44 struct prog_test_ref_kfunc *p, *old; in test_htab_leak() local 59 old = bpf_kptr_xchg(&v->ref_ptr, p); in test_htab_leak() 60 if (old) in test_htab_leak() 61 bpf_kfunc_call_test_release(old); in test_htab_leak() 68 old = bpf_kptr_xchg(&v->ref_ptr, p); in test_htab_leak() 69 if (old) in test_htab_leak() 70 bpf_kfunc_call_test_release(old); in test_htab_leak() 77 struct prog_test_ref_kfunc *p, *old; in fill_percpu_kptr() local 82 old = bpf_kptr_xchg(&v->ref_ptr, p); in fill_percpu_kptr() 83 if (old) in fill_percpu_kptr() [all …]
|
| /linux/arch/sparc/include/asm/ |
| H A D | cmpxchg_64.h | 11 __cmpxchg_u32(volatile int *m, int old, int new) in __cmpxchg_u32() argument 15 : "0" (new), "r" (m), "r" (old) in __cmpxchg_u32() 78 /* Read the old value */ in xchg16() 106 * Atomic compare and exchange. Compare OLD with MEM, if identical, 108 * indicated by comparing RETURN with OLD. 115 __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) in __cmpxchg_u64() argument 119 : "0" (new), "r" (m), "r" (old) in __cmpxchg_u64() 131 __cmpxchg_u8(volatile unsigned char *m, unsigned char old, unsigned char new) in __cmpxchg_u8() argument 142 old32 = (load32 & ~mask) | (old << bit_shift); in __cmpxchg_u8() 145 return old; in __cmpxchg_u8() [all …]
|
| /linux/Documentation/ |
| H A D | atomic_t.txt | 279 int atomic_cmpxchg(atomic_t *ptr, int old, int new); 287 int ret, old = *oldp; 288 ret = atomic_cmpxchg(ptr, old, new); 289 if (ret != old) 291 return ret == old; 296 int atomic_cmpxchg(atomic_t *ptr, int old, int new) 298 (void)atomic_try_cmpxchg(ptr, &old, new); 299 return old; 304 old = atomic_read(&v); old = atomic_read(&v); 306 new = func(old); new = func(old); [all …]
|
| /linux/arch/sparc/lib/ |
| H A D | atomic32.c | 83 int arch_atomic_cmpxchg(atomic_t *v, int old, int new) in arch_atomic_cmpxchg() argument 90 if (likely(ret == old)) in arch_atomic_cmpxchg() 125 unsigned long old, flags; in sp32___set_bit() local 128 old = *addr; in sp32___set_bit() 129 *addr = old | mask; in sp32___set_bit() 132 return old & mask; in sp32___set_bit() 138 unsigned long old, flags; in sp32___clear_bit() local 141 old = *addr; in sp32___clear_bit() 142 *addr = old & ~mask; in sp32___clear_bit() 145 return old & mask; in sp32___clear_bit() [all …]
|
| /linux/arch/alpha/include/asm/ |
| H A D | atomic.h | 205 int c, new, old; in ATOMIC_OPS() local 208 "1: ldl_l %[old],%[mem]\n" in ATOMIC_OPS() 209 " cmpeq %[old],%[u],%[c]\n" in ATOMIC_OPS() 210 " addl %[old],%[a],%[new]\n" in ATOMIC_OPS() 218 : [old] "=&r"(old), [new] "=&r"(new), [c] "=&r"(c) in ATOMIC_OPS() 222 return old; in ATOMIC_OPS() 228 s64 c, new, old; in arch_atomic64_fetch_add_unless() local 231 "1: ldq_l %[old],%[mem]\n" in arch_atomic64_fetch_add_unless() 232 " cmpeq %[old],%[u],%[c]\n" in arch_atomic64_fetch_add_unless() 233 " addq %[old],%[a],%[new]\n" in arch_atomic64_fetch_add_unless() [all …]
|
| /linux/arch/x86/include/asm/ |
| H A D | cmpxchg.h | 40 * returns the old value. 81 * Atomic compare and exchange. Compare OLD with MEM, if identical, 83 * indicated by comparing RETURN with OLD. 85 #define __raw_cmpxchg(ptr, old, new, size, lock) \ argument 88 __typeof__(*(ptr)) __old = (old); \ 133 #define __cmpxchg(ptr, old, new, size) \ argument 134 __raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX) 136 #define __sync_cmpxchg(ptr, old, new, size) \ argument 137 __raw_cmpxchg((ptr), (old), (new), (size), "lock ") 139 #define __cmpxchg_local(ptr, old, new, size) \ argument [all …]
|
| /linux/lib/ |
| H A D | errseq.c | 64 errseq_t cur, old; in errseq_set() local 73 old = READ_ONCE(*eseq); in errseq_set() 77 return old; in errseq_set() 83 new = (old & ~(ERRNO_MASK | ERRSEQ_SEEN)) | -err; in errseq_set() 86 if (old & ERRSEQ_SEEN) in errseq_set() 90 if (new == old) { in errseq_set() 96 cur = cmpxchg(eseq, old, new); in errseq_set() 102 if (likely(cur == old || cur == new)) in errseq_set() 106 old = cur; in errseq_set() 117 * If the error has been "seen", new callers will not see an old error. [all …]
|
| /linux/sound/soc/sof/ |
| H A D | ops.c | 19 unsigned int old, new; in snd_sof_pci_update_bits_unlocked() local 23 old = ret; in snd_sof_pci_update_bits_unlocked() 24 dev_dbg(sdev->dev, "Debug PCIR: %8.8x at %8.8x\n", old & mask, offset); in snd_sof_pci_update_bits_unlocked() 26 new = (old & ~mask) | (value & mask); in snd_sof_pci_update_bits_unlocked() 28 if (old == new) in snd_sof_pci_update_bits_unlocked() 49 unsigned int old, new; 54 old = ret; in snd_sof_dsp_update_bits_unlocked() local 55 new = (old & ~mask) | (value & mask); in snd_sof_dsp_update_bits_unlocked() 57 if (old == new) in snd_sof_dsp_update_bits_unlocked() 69 u64 old, ne in snd_sof_dsp_update_bits_unlocked() 74 u64 old, new; snd_sof_dsp_update_bits64_unlocked() local 122 unsigned int old, new; snd_sof_dsp_update_bits_forced_unlocked() local [all...] |
| /linux/rust/helpers/ |
| H A D | atomic.c | 399 rust_helper_atomic_cmpxchg(atomic_t *v, int old, int new) in rust_helper_atomic_xchg_relaxed() 401 return atomic_cmpxchg(v, old, new); in rust_helper_atomic_xchg_relaxed() 405 rust_helper_atomic_cmpxchg_acquire(atomic_t *v, int old, int new) in rust_helper_atomic_cmpxchg() 407 return atomic_cmpxchg_acquire(v, old, new); in rust_helper_atomic_cmpxchg() 411 rust_helper_atomic_cmpxchg_release(atomic_t *v, int old, int new) in rust_helper_atomic_cmpxchg_acquire() 413 return atomic_cmpxchg_release(v, old, new); in rust_helper_atomic_cmpxchg_acquire() 417 rust_helper_atomic_cmpxchg_relaxed(atomic_t *v, int old, int new) in rust_helper_atomic_cmpxchg_release() 419 return atomic_cmpxchg_relaxed(v, old, new); in rust_helper_atomic_cmpxchg_release() 423 rust_helper_atomic_try_cmpxchg(atomic_t *v, int *old, int new) in rust_helper_atomic_cmpxchg_relaxed() 425 return atomic_try_cmpxchg(v, old, ne in rust_helper_atomic_cmpxchg_relaxed() 404 rust_helper_atomic_cmpxchg(atomic_t * v,int old,int new) rust_helper_atomic_cmpxchg() argument 410 rust_helper_atomic_cmpxchg_acquire(atomic_t * v,int old,int new) rust_helper_atomic_cmpxchg_acquire() argument 416 rust_helper_atomic_cmpxchg_release(atomic_t * v,int old,int new) rust_helper_atomic_cmpxchg_release() argument 422 rust_helper_atomic_cmpxchg_relaxed(atomic_t * v,int old,int new) rust_helper_atomic_cmpxchg_relaxed() argument 428 rust_helper_atomic_try_cmpxchg(atomic_t * v,int * old,int new) rust_helper_atomic_try_cmpxchg() argument 434 rust_helper_atomic_try_cmpxchg_acquire(atomic_t * v,int * old,int new) rust_helper_atomic_try_cmpxchg_acquire() argument 440 rust_helper_atomic_try_cmpxchg_release(atomic_t * v,int * old,int new) rust_helper_atomic_try_cmpxchg_release() argument 446 rust_helper_atomic_try_cmpxchg_relaxed(atomic_t * v,int * old,int new) rust_helper_atomic_try_cmpxchg_relaxed() argument 914 rust_helper_atomic64_cmpxchg(atomic64_t * v,s64 old,s64 new) rust_helper_atomic64_cmpxchg() argument 920 rust_helper_atomic64_cmpxchg_acquire(atomic64_t * v,s64 old,s64 new) rust_helper_atomic64_cmpxchg_acquire() argument 926 rust_helper_atomic64_cmpxchg_release(atomic64_t * v,s64 old,s64 new) rust_helper_atomic64_cmpxchg_release() argument 932 rust_helper_atomic64_cmpxchg_relaxed(atomic64_t * v,s64 old,s64 new) rust_helper_atomic64_cmpxchg_relaxed() argument 938 rust_helper_atomic64_try_cmpxchg(atomic64_t * v,s64 * old,s64 new) rust_helper_atomic64_try_cmpxchg() argument 944 rust_helper_atomic64_try_cmpxchg_acquire(atomic64_t * v,s64 * old,s64 new) rust_helper_atomic64_try_cmpxchg_acquire() argument 950 rust_helper_atomic64_try_cmpxchg_release(atomic64_t * v,s64 * old,s64 new) rust_helper_atomic64_try_cmpxchg_release() argument 956 rust_helper_atomic64_try_cmpxchg_relaxed(atomic64_t * v,s64 * old,s64 new) rust_helper_atomic64_try_cmpxchg_relaxed() argument [all...] |
| /linux/arch/s390/kvm/ |
| H A D | dat.c | 166 * @old: Expected old value. 178 bool dat_crstep_xchg_atomic(union crste *crstep, union crste old, union crste new, gfn_t gfn, in dat_crstep_xchg_atomic() argument 181 if (old.h.i) in dat_crstep_xchg_atomic() 182 return arch_try_cmpxchg((long *)crstep, &old.val, new.val); in dat_crstep_xchg_atomic() 184 return crdte_crste(crstep, old, new, gfn, asce); in dat_crstep_xchg_atomic() 185 return cspg_crste(crstep, old, new); in dat_crstep_xchg_atomic() 195 static void dat_move_storage_key(union pte old, union pte new) in dat_move_storage_key() argument 197 page_set_storage_key(pte_origin(new), page_get_storage_key(pte_origin(old)), 1); in dat_move_storage_key() 217 union pte old = READ_ONCE(*ptep); in __dat_ptep_xchg() local 225 if (!old.h.i) { in __dat_ptep_xchg() [all …]
|
| /linux/include/asm-generic/bitops/ |
| H A D | lock.h | 10 * arch_test_and_set_bit_lock - Set a bit and return its old value, for lock 21 long old; in arch_test_and_set_bit_lock() local 28 old = raw_atomic_long_fetch_or_acquire(mask, (atomic_long_t *)p); in arch_test_and_set_bit_lock() 29 return !!(old & mask); in arch_test_and_set_bit_lock() 61 unsigned long old; in arch___clear_bit_unlock() local 64 old = READ_ONCE(*p); in arch___clear_bit_unlock() 65 old &= ~BIT_MASK(nr); in arch___clear_bit_unlock() 66 raw_atomic_long_set_release((atomic_long_t *)p, old); in arch___clear_bit_unlock() 73 long old; in arch_xor_unlock_is_negative_byte() local 75 old = raw_atomic_long_fetch_xor_release(mask, (atomic_long_t *)p); in arch_xor_unlock_is_negative_byte() [all …]
|
| /linux/arch/xtensa/include/asm/ |
| H A D | cmpxchg.h | 25 __cmpxchg_u32(volatile int *p, int old, int new) in __cmpxchg_u32() argument 39 : [new] "a" (new), [addr] "a" (p), [cmp] "a" (old) in __cmpxchg_u32() 49 : [cmp] "a" (old) in __cmpxchg_u32() 57 " l32i %[old], %[mem]\n" in __cmpxchg_u32() 58 " bne %[old], %[cmp], 1f\n" in __cmpxchg_u32() 63 : [old] "=&a" (old), [mem] "+m" (*p) in __cmpxchg_u32() 64 : [cmp] "a" (old), [new] "r" (new) in __cmpxchg_u32() 66 return old; in __cmpxchg_u32() 75 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) in __cmpxchg() argument 78 case 1: return cmpxchg_emu_u8(ptr, old, new); in __cmpxchg() [all …]
|
| /linux/arch/parisc/include/asm/ |
| H A D | cmpxchg.h | 60 extern u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new_); 61 extern u16 __cmpxchg_u16(volatile u16 *ptr, u16 old, u16 new_); 62 extern u32 __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); 63 extern u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new_); 67 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) in __cmpxchg() argument 71 size == 8 ? __cmpxchg_u64(ptr, old, new_) : in __cmpxchg() 73 size == 4 ? __cmpxchg_u32(ptr, old, new_) : in __cmpxchg() 74 size == 2 ? __cmpxchg_u16(ptr, old, new_) : in __cmpxchg() 75 size == 1 ? __cmpxchg_u8(ptr, old, new_) : in __cmpxchg() 76 (__cmpxchg_called_with_bad_pointer(), old); in __cmpxchg() [all …]
|