#ifndef __ASM_GENERIC_CMPXCHG_LOCAL_H #define __ASM_GENERIC_CMPXCHG_LOCAL_H #include <linux/types.h> #include <linux/irqflags.h> extern unsigned long wrong_size_cmpxchg(volatile void *ptr) __noreturn; /* * Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned * long parameter, supporting various types of architectures. */
static inline unsigned long __cmpxchg_local_generic(volatile void *ptr, unsigned long old, unsigned long new, int size) { unsigned long flags, prev; /* * Sanity checking, compile-time. */ if (size == 8 && sizeof(unsigned long) != 8) wrong_size_cmpxchg(ptr); raw_local_irq_save(flags); switch (size) { case 1: prev = *(u8 *)ptr; if (prev == old) *(u8 *)ptr = (u8)new; break; case 2: prev = *(u16 *)ptr; if (prev == old) *(u16 *)ptr = (u16)new; break; case 4: prev = *(u32 *)ptr; if (prev == old) *(u32 *)ptr = (u32)new; break; case 8: prev = *(u64 *)ptr; if (prev == old) *(u64 *)ptr = (u64)new; break; default: wrong_size_cmpxchg(ptr); } raw_local_irq_restore(flags); return prev; }Contributors
Person | Tokens | Prop | Commits | CommitProp | |
mathieu desnoyers | mathieu desnoyers | 197 | 98.99% | 1 | 50.00% |
ingo molnar | ingo molnar | 2 | 1.01% | 1 | 50.00% |
Total | 199 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
mathieu desnoyers | mathieu desnoyers | 60 | 96.77% | 1 | 50.00% |
ingo molnar | ingo molnar | 2 | 3.23% | 1 | 50.00% |
Total | 62 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
mathieu desnoyers | mathieu desnoyers | 277 | 95.85% | 1 | 25.00% |
behan webster | behan webster | 5 | 1.73% | 1 | 25.00% |
ingo molnar | ingo molnar | 4 | 1.38% | 1 | 25.00% |
david howells | david howells | 3 | 1.04% | 1 | 25.00% |
Total | 289 | 100.00% | 4 | 100.00% |