diff options
| author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2016-07-06 07:25:55 -0700 |
|---|---|---|
| committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2016-07-06 07:25:55 -0700 |
| commit | ea1a25c3348abc33d7d94db28501766adf3d1c7d (patch) | |
| tree | ca3c5c8b72532117034dd2d57a2a85eead13db7b /include/linux/bitops.h | |
| parent | 5e7ff2ca7f2da55fe777167849d0c93403bd0dc8 (diff) | |
| parent | 262e2bfd7d1e1f1ee48b870e5dfabb87c06b975e (diff) | |
Merge branch 'jejb-fixes' into fixes
Diffstat (limited to 'include/linux/bitops.h')
| -rw-r--r-- | include/linux/bitops.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index defeaac0745f..299e76b59fe9 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -227,6 +227,22 @@ static inline unsigned long __ffs64(u64 word) }) #endif +#ifndef bit_clear_unless +#define bit_clear_unless(ptr, _clear, _test) \ +({ \ + const typeof(*ptr) clear = (_clear), test = (_test); \ + typeof(*ptr) old, new; \ + \ + do { \ + old = ACCESS_ONCE(*ptr); \ + new = old & ~clear; \ + } while (!(old & test) && \ + cmpxchg(ptr, old, new) != old); \ + \ + !(old & test); \ +}) +#endif + #ifndef find_last_bit /** * find_last_bit - find the last set bit in a memory region |
