X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=include%2Flinux%2Fbitops.h;h=be5fd38bd5a05d83eaac250055defcccacafe054;hb=00a1a053ebe5febcfc2ec498bd894f035ad2aa06;hp=abc9ca7784568ba5737add4fce84577348428eac;hpb=7acd71879ce408af2d2ca3cd3ec3a86d0667ceae;p=~andy%2Flinux diff --git a/include/linux/bitops.h b/include/linux/bitops.h index abc9ca77845..be5fd38bd5a 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -196,6 +196,21 @@ static inline unsigned long __ffs64(u64 word) #ifdef __KERNEL__ +#ifndef set_mask_bits +#define set_mask_bits(ptr, _mask, _bits) \ +({ \ + const typeof(*ptr) mask = (_mask), bits = (_bits); \ + typeof(*ptr) old, new; \ + \ + do { \ + old = ACCESS_ONCE(*ptr); \ + new = (old & ~mask) | bits; \ + } while (cmpxchg(ptr, old, new) != old); \ + \ + new; \ +}) +#endif + #ifndef find_last_bit /** * find_last_bit - find the last set bit in a memory region