Message ID | 1468579299-19731-1-git-send-email-czuzu@bitdefender.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 15/07/16 11:41, Corneliu ZUZU wrote: > Move duplicate macros between asm-arm/arm32/atomic.h and asm-arm/arm64/atomic.h > to asm-arm/atomic.h. > > Signed-off-by: Corneliu ZUZU <czuzu@bitdefender.com> > Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Acked-by: Julien Grall <julien.grall@arm.com> Regards, > --- > Changed since v4: > * remove paragraph(s) from README.LinuxPrimitives file > * no empty line additions > --- > xen/arch/arm/README.LinuxPrimitives | 8 ++++++++ > xen/include/asm-arm/arm32/atomic.h | 13 ------------- > xen/include/asm-arm/arm64/atomic.h | 13 ------------- > xen/include/asm-arm/atomic.h | 13 +++++++++++++ > 4 files changed, 21 insertions(+), 26 deletions(-) > > diff --git a/xen/arch/arm/README.LinuxPrimitives b/xen/arch/arm/README.LinuxPrimitives > index 3115f51..028e872 100644 > --- a/xen/arch/arm/README.LinuxPrimitives > +++ b/xen/arch/arm/README.LinuxPrimitives > @@ -23,6 +23,10 @@ atomics: last sync @ v3.16-rc6 (last commit: 8715466b6027) > > linux/arch/arm64/include/asm/atomic.h xen/include/asm-arm/arm64/atomic.h > > +The following functions were taken from Linux: > + atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(), > + atomic_cmpxchg(), __atomic_add_unless() > + > --------------------------------------------------------------------- > > mem*: last sync @ v3.16-rc6 (last commit: d875c9b37240) > @@ -91,6 +95,10 @@ atomics: last sync @ v3.16-rc6 (last commit: 030d0178bdbd) > > linux/arch/arm/include/asm/atomic.h xen/include/asm-arm/arm32/atomic.h > > +The following functions were taken from Linux: > + atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(), > + atomic_cmpxchg(), __atomic_add_unless() > + > --------------------------------------------------------------------- > > mem*: last sync @ v3.16-rc6 (last commit: d98b90ea22b0) > diff --git a/xen/include/asm-arm/arm32/atomic.h b/xen/include/asm-arm/arm32/atomic.h > index 7ec712f..c03eb68 100644 > --- a/xen/include/asm-arm/arm32/atomic.h > +++ b/xen/include/asm-arm/arm32/atomic.h > @@ -147,19 +147,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) > return oldval; > } > > -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) > - > -#define atomic_inc(v) atomic_add(1, v) > -#define atomic_dec(v) atomic_sub(1, v) > - > -#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) > -#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) > -#define atomic_inc_return(v) (atomic_add_return(1, v)) > -#define atomic_dec_return(v) (atomic_sub_return(1, v)) > -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) > - > -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) > - > #endif /* __ARCH_ARM_ARM32_ATOMIC__ */ > /* > * Local variables: > diff --git a/xen/include/asm-arm/arm64/atomic.h b/xen/include/asm-arm/arm64/atomic.h > index b49219e..bce38d4 100644 > --- a/xen/include/asm-arm/arm64/atomic.h > +++ b/xen/include/asm-arm/arm64/atomic.h > @@ -113,8 +113,6 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new) > return oldval; > } > > -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) > - > static inline int __atomic_add_unless(atomic_t *v, int a, int u) > { > int c, old; > @@ -125,17 +123,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) > return c; > } > > -#define atomic_inc(v) atomic_add(1, v) > -#define atomic_dec(v) atomic_sub(1, v) > - > -#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) > -#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) > -#define atomic_inc_return(v) (atomic_add_return(1, v)) > -#define atomic_dec_return(v) (atomic_sub_return(1, v)) > -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) > - > -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) > - > #endif > /* > * Local variables: > diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h > index 29ab265..18cb2e1 100644 > --- a/xen/include/asm-arm/atomic.h > +++ b/xen/include/asm-arm/atomic.h > @@ -138,6 +138,19 @@ static inline void _atomic_set(atomic_t *v, int i) > # error "unknown ARM variant" > #endif > > +#define atomic_inc(v) atomic_add(1, v) > +#define atomic_dec(v) atomic_sub(1, v) > + > +#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) > +#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) > +#define atomic_inc_return(v) (atomic_add_return(1, v)) > +#define atomic_dec_return(v) (atomic_sub_return(1, v)) > +#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) > + > +#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) > + > +#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) > + > #endif /* __ARCH_ARM_ATOMIC__ */ > /* > * Local variables: >
diff --git a/xen/arch/arm/README.LinuxPrimitives b/xen/arch/arm/README.LinuxPrimitives index 3115f51..028e872 100644 --- a/xen/arch/arm/README.LinuxPrimitives +++ b/xen/arch/arm/README.LinuxPrimitives @@ -23,6 +23,10 @@ atomics: last sync @ v3.16-rc6 (last commit: 8715466b6027) linux/arch/arm64/include/asm/atomic.h xen/include/asm-arm/arm64/atomic.h +The following functions were taken from Linux: + atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(), + atomic_cmpxchg(), __atomic_add_unless() + --------------------------------------------------------------------- mem*: last sync @ v3.16-rc6 (last commit: d875c9b37240) @@ -91,6 +95,10 @@ atomics: last sync @ v3.16-rc6 (last commit: 030d0178bdbd) linux/arch/arm/include/asm/atomic.h xen/include/asm-arm/arm32/atomic.h +The following functions were taken from Linux: + atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(), + atomic_cmpxchg(), __atomic_add_unless() + --------------------------------------------------------------------- mem*: last sync @ v3.16-rc6 (last commit: d98b90ea22b0) diff --git a/xen/include/asm-arm/arm32/atomic.h b/xen/include/asm-arm/arm32/atomic.h index 7ec712f..c03eb68 100644 --- a/xen/include/asm-arm/arm32/atomic.h +++ b/xen/include/asm-arm/arm32/atomic.h @@ -147,19 +147,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) return oldval; } -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) - -#define atomic_inc(v) atomic_add(1, v) -#define atomic_dec(v) atomic_sub(1, v) - -#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) -#define atomic_inc_return(v) (atomic_add_return(1, v)) -#define atomic_dec_return(v) (atomic_sub_return(1, v)) -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) - -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) - #endif /* __ARCH_ARM_ARM32_ATOMIC__ */ /* * Local variables: diff --git a/xen/include/asm-arm/arm64/atomic.h b/xen/include/asm-arm/arm64/atomic.h index b49219e..bce38d4 100644 --- a/xen/include/asm-arm/arm64/atomic.h +++ b/xen/include/asm-arm/arm64/atomic.h @@ -113,8 +113,6 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new) return oldval; } -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) - static inline int __atomic_add_unless(atomic_t *v, int a, int u) { int c, old; @@ -125,17 +123,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) return c; } -#define atomic_inc(v) atomic_add(1, v) -#define atomic_dec(v) atomic_sub(1, v) - -#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) -#define atomic_inc_return(v) (atomic_add_return(1, v)) -#define atomic_dec_return(v) (atomic_sub_return(1, v)) -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) - -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) - #endif /* * Local variables: diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h index 29ab265..18cb2e1 100644 --- a/xen/include/asm-arm/atomic.h +++ b/xen/include/asm-arm/atomic.h @@ -138,6 +138,19 @@ static inline void _atomic_set(atomic_t *v, int i) # error "unknown ARM variant" #endif +#define atomic_inc(v) atomic_add(1, v) +#define atomic_dec(v) atomic_sub(1, v) + +#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) +#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) +#define atomic_inc_return(v) (atomic_add_return(1, v)) +#define atomic_dec_return(v) (atomic_sub_return(1, v)) +#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) + +#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) + +#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) + #endif /* __ARCH_ARM_ATOMIC__ */ /* * Local variables: