#ifndef __TOOLS_ASM_GENERIC_ATOMIC_H #define __TOOLS_ASM_GENERIC_ATOMIC_H #include #include /* * Atomic operations that C can't guarantee us. Useful for * resource counting etc.. * * Excerpts obtained from the Linux kernel sources. */ #define ATOMIC_INIT(i) { (i) } /** * atomic_read - read atomic variable * @v: pointer of type atomic_t * * Atomically reads the value of @v. */ static inline int atomic_read(const atomic_t *v) { return ACCESS_ONCE((v)->counter); } /** * atomic_set - set atomic variable * @v: pointer of type atomic_t * @i: required value * * Atomically sets the value of @v to @i. */ static inline void atomic_set(atomic_t *v, int i) { v->counter = i; } /** * atomic_inc - increment atomic variable * @v: pointer of type atomic_t * * Atomically increments @v by 1. */ static inline void atomic_inc(atomic_t *v) { __sync_add_and_fetch(&v->counter, 1); } /** * atomic_dec_and_test - decrement and test * @v: pointer of type atomic_t * * Atomically decrements @v by 1 and * returns true if the result is 0, or false for all other * cases. */ static inline int atomic_dec_and_test(atomic_t *v) { return __sync_sub_and_fetch(&v->counter, 1) == 0; } #endif /* __TOOLS_ASM_GENERIC_ATOMIC_H */ -loop-back net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-30 13:18:12 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-30 13:18:12 -0800
commit751321b3dd5040dc5be19bd23f985e80c914621a (patch)
tree967928e24b38dc7fed918f932bb1b243af42bf7f /net/unix/Makefile
parent566cf877a1fcb6d6dc0126b076aad062054c2637 (diff)
parent586655d278ba08af7b198b93217746f9a506ee8a (diff)
Merge tag 'rtc-4.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC fix from Alexandre Belloni: "A single fix for this cycle. It is worth taking it for 4.10 so that distributions will not have CONFIG_RTC_DRV_JZ4740 switching from m to y in their config. Summary: - Allow jz4740 to build as a module again by using kernel_halt()" * tag 'rtc-4.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: rtc: jz4740: make the driver buildable as a module again
Diffstat (limited to 'net/unix/Makefile')