The patch titled asm-generic/atomic.h: allow SMP peeps to leverage this has been added to the -mm tree. Its filename is asm-generic-atomich-allow-smp-peeps-to-leverage-this.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: asm-generic/atomic.h: allow SMP peeps to leverage this From: Mike Frysinger <vapier@xxxxxxxxxx> Only a few core funcs need to be implemented for SMP systems, so allow the arches to override them while getting the rest for free. At least, this is enough to allow the Blackfin SMP port to use things. Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx> Cc: Arun Sharma <asharma@xxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/asm-generic/atomic.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff -puN include/asm-generic/atomic.h~asm-generic-atomich-allow-smp-peeps-to-leverage-this include/asm-generic/atomic.h --- a/include/asm-generic/atomic.h~asm-generic-atomich-allow-smp-peeps-to-leverage-this +++ a/include/asm-generic/atomic.h @@ -16,7 +16,11 @@ #define __ASM_GENERIC_ATOMIC_H #ifdef CONFIG_SMP -#error not SMP safe +/* Force people to define core atomics */ +# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ + !defined(atomic_clear_mask) || !defined(atomic_set_mask) +# error "SMP requires a little arch-specific magic" +# endif #endif /* @@ -34,7 +38,9 @@ * * Atomically reads the value of @v. */ +#ifndef atomic_read #define atomic_read(v) (*(volatile int *)&(v)->counter) +#endif /** * atomic_set - set atomic variable @@ -55,6 +61,7 @@ * * Atomically adds @i to @v and returns the result */ +#ifndef atomic_add_return static inline int atomic_add_return(int i, atomic_t *v) { unsigned long flags; @@ -68,6 +75,7 @@ static inline int atomic_add_return(int return temp; } +#endif /** * atomic_sub_return - subtract integer from atomic variable @@ -76,6 +84,7 @@ static inline int atomic_add_return(int * * Atomically subtracts @i from @v and returns the result */ +#ifndef atomic_sub_return static inline int atomic_sub_return(int i, atomic_t *v) { unsigned long flags; @@ -89,6 +98,7 @@ static inline int atomic_sub_return(int return temp; } +#endif static inline int atomic_add_negative(int i, atomic_t *v) { @@ -147,6 +157,7 @@ static inline int __atomic_add_unless(at * * Atomically clears the bits set in @mask from @v */ +#ifndef atomic_clear_mask static inline void atomic_clear_mask(unsigned long mask, atomic_t *v) { unsigned long flags; @@ -156,6 +167,7 @@ static inline void atomic_clear_mask(uns v->counter &= mask; raw_local_irq_restore(flags); } +#endif /** * atomic_set_mask - Atomically set bits in atomic variable @@ -164,6 +176,7 @@ static inline void atomic_clear_mask(uns * * Atomically sets the bits set in @mask in @v */ +#ifndef atomic_set_mask static inline void atomic_set_mask(unsigned int mask, atomic_t *v) { unsigned long flags; @@ -172,6 +185,7 @@ static inline void atomic_set_mask(unsig v->counter |= mask; raw_local_irq_restore(flags); } +#endif /* Assume that atomic operations are already serializing */ #define smp_mb__before_atomic_dec() barrier() _ Patches currently in -mm which might be from vapier@xxxxxxxxxx are mm-nommuc-fix-remap_pfn_range.patch linux-next.patch asm-generic-systemh-drop-useless-__kernel__.patch ptrace-unify-show_regs-prototype.patch ptrace-unify-show_regs-prototype-fix.patch atomic-use-linux-atomich.patch atomic-move-atomic_add_unless-to-generic-code.patch atomic-cleanup-asm-generic-atomich-inclusion.patch atomic-update-comments-in-atomich.patch asm-generic-atomich-simplify-inc-dec-test-helpers.patch asm-generic-atomich-fix-type-used-in-atomic_clear_mask.patch asm-generic-atomich-add-atomic_set_mask-helper.patch asm-generic-atomich-allow-smp-peeps-to-leverage-this.patch blackfin-smp-punt-unused-atomic_test_mask-helper.patch blackfin-smp-convert-to-common-asm-generic-atomich.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html