All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH 01/36] atomic64_test: Simplify the #ifdef for atomic64_dec_if_positive() test
Date: Wed, 18 Jul 2012 14:33:57 +1000	[thread overview]
Message-ID: <1342586037.3669.16.camel@pasglop> (raw)
In-Reply-To: <1341608777-12982-2-git-send-email-catalin.marinas@arm.com>

On Fri, 2012-07-06 at 22:05 +0100, Catalin Marinas wrote:
> This patch introduces ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE and uses this
> instead of the multitude of #if defined() checks in atomic64_test.c
> 
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

I'll let other paint the bike shed as to whether ARCH_HAS_* is the right
thing here, but as far as the powerpc change is concerned:

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Cheers,
Ben.

> ---
>  arch/arm/include/asm/atomic.h      |    1 +
>  arch/mips/include/asm/atomic.h     |    1 +
>  arch/powerpc/include/asm/atomic.h  |    1 +
>  arch/s390/include/asm/atomic.h     |    1 +
>  arch/x86/include/asm/atomic64_32.h |    1 +
>  arch/x86/include/asm/atomic64_64.h |    1 +
>  lib/atomic64_test.c                |    3 +--
>  7 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
> index 68374ba..a2f5a44 100644
> --- a/arch/arm/include/asm/atomic.h
> +++ b/arch/arm/include/asm/atomic.h
> @@ -395,6 +395,7 @@ static inline u64 atomic64_xchg(atomic64_t *ptr, u64 new)
>  	return result;
>  }
>  
> +#define ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
>  static inline u64 atomic64_dec_if_positive(atomic64_t *v)
>  {
>  	u64 result;
> diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
> index 3f4c5cb..4af30f2 100644
> --- a/arch/mips/include/asm/atomic.h
> +++ b/arch/mips/include/asm/atomic.h
> @@ -736,6 +736,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
>   * atomic64_dec_if_positive - decrement by 1 if old value positive
>   * @v: pointer of type atomic64_t
>   */
> +#define ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
>  #define atomic64_dec_if_positive(v)	atomic64_sub_if_positive(1, v)
>  
>  /*
> diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
> index da29032..e235d76 100644
> --- a/arch/powerpc/include/asm/atomic.h
> +++ b/arch/powerpc/include/asm/atomic.h
> @@ -439,6 +439,7 @@ static __inline__ long atomic64_dec_return(atomic64_t *v)
>   * Atomically test *v and decrement if it is greater than 0.
>   * The function returns the old value of *v minus 1.
>   */
> +#define ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
>  static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
>  {
>  	long t;
> diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
> index 748347b..dcd174f 100644
> --- a/arch/s390/include/asm/atomic.h
> +++ b/arch/s390/include/asm/atomic.h
> @@ -297,6 +297,7 @@ static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
>  	return c != u;
>  }
>  
> +#define ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
>  static inline long long atomic64_dec_if_positive(atomic64_t *v)
>  {
>  	long long c, old, dec;
> diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h
> index b154de7..4690ce2 100644
> --- a/arch/x86/include/asm/atomic64_32.h
> +++ b/arch/x86/include/asm/atomic64_32.h
> @@ -302,6 +302,7 @@ static inline int atomic64_inc_not_zero(atomic64_t *v)
>  	return r;
>  }
>  
> +#define ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
>  static inline long long atomic64_dec_if_positive(atomic64_t *v)
>  {
>  	long long r;
> diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h
> index 0e1cbfc..2dd1ae3 100644
> --- a/arch/x86/include/asm/atomic64_64.h
> +++ b/arch/x86/include/asm/atomic64_64.h
> @@ -224,6 +224,7 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
>   * The function returns the old value of *v minus 1, even if
>   * the atomic variable, v, was not decremented.
>   */
> +#define ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
>  static inline long atomic64_dec_if_positive(atomic64_t *v)
>  {
>  	long c, old, dec;
> diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c
> index cb99b91..4f8429d 100644
> --- a/lib/atomic64_test.c
> +++ b/lib/atomic64_test.c
> @@ -114,8 +114,7 @@ static __init int test_atomic64(void)
>  	r += one;
>  	BUG_ON(v.counter != r);
>  
> -#if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
> -    defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H) || defined(CONFIG_ARM)
> +#if defined(ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE) || defined(CONFIG_GENERIC_ATOMIC64)
>  	INIT(onestwos);
>  	BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1));
>  	r -= one;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



  reply	other threads:[~2012-07-18  4:34 UTC|newest]

Thread overview: 185+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06 21:05 [PATCH 00/36] AArch64 Linux kernel port Catalin Marinas
2012-07-06 21:05 ` [PATCH 01/36] atomic64_test: Simplify the #ifdef for atomic64_dec_if_positive() test Catalin Marinas
2012-07-18  4:33   ` Benjamin Herrenschmidt [this message]
2012-07-18  9:06     ` Catalin Marinas
2012-07-06 21:05 ` [PATCH 02/36] ipc: Add COMPAT_SHMLBA support Catalin Marinas
2012-07-18  5:53   ` Jon Masters
2012-07-18  9:03     ` Will Deacon
2012-07-06 21:05 ` [PATCH 03/36] ipc: allow compat IPC version field parsing if !ARCH_WANT_OLD_COMPAT_IPC Catalin Marinas
2012-07-06 21:05 ` [PATCH 04/36] ipc: compat: use signed size_t types for msgsnd and msgrcv Catalin Marinas
2012-07-06 21:05 ` [PATCH 05/36] fs: Build sys_stat64() and friends if __ARCH_WANT_COMPAT_STAT64 Catalin Marinas
2012-07-06 21:05 ` [PATCH 06/36] fdt: Add generic dt_memblock_reserve() function Catalin Marinas
2012-07-07 21:18   ` Rob Herring
2012-07-07 21:18     ` Rob Herring
2012-07-08  9:43     ` Catalin Marinas
2012-07-08  9:43       ` Catalin Marinas
2012-07-06 21:05 ` [PATCH 07/36] AArch64: Assembly macros and definitions Catalin Marinas
2012-07-07  5:57   ` Greg KH
2012-07-08  9:23     ` Catalin Marinas
2012-07-20 14:22   ` [07/36] " Christopher Covington
2012-07-24 16:40     ` Catalin Marinas
2012-07-06 21:05 ` [PATCH 08/36] AArch64: Kernel booting and initialisation Catalin Marinas
2012-07-06 21:32   ` Stephen Warren
2012-07-08  9:18     ` Catalin Marinas
2012-07-23 17:48       ` Stephen Warren
2012-07-23 17:58         ` Catalin Marinas
2012-07-18  6:57   ` Jon Masters
2012-07-18  9:07     ` Will Deacon
2012-07-20  7:11       ` Jon Masters
2012-07-19 17:31     ` Christopher Covington
2012-07-20  7:10       ` Jon Masters
2012-07-20  8:28         ` Arnd Bergmann
2012-07-20 10:52           ` Catalin Marinas
2012-07-20 12:32             ` Geert Uytterhoeven
2012-07-20 13:16               ` Catalin Marinas
2012-07-20 13:47         ` Christopher Covington
2012-07-20 13:52           ` Catalin Marinas
2012-07-20 13:48       ` Catalin Marinas
2012-07-20 14:53         ` Christopher Covington
2012-07-23 20:52   ` [08/36] " Christopher Covington
2012-07-24 16:24     ` Catalin Marinas
2012-07-24 18:53       ` Arnd Bergmann
2012-07-24 23:20         ` Frank Rowand
2012-07-25  8:34         ` Catalin Marinas
2012-07-24 19:42   ` Christopher Covington
2012-07-25  8:47     ` Catalin Marinas
2012-07-25 13:39       ` Christopher Covington
2012-07-06 21:05 ` [PATCH 09/36] AArch64: Exception handling Catalin Marinas
2012-08-09 17:05   ` [09/36] " Christopher Covington
2012-08-09 17:23     ` Catalin Marinas
2012-08-09 19:19       ` Christopher Covington
2012-07-06 21:05 ` [PATCH 10/36] AArch64: MMU definitions Catalin Marinas
2012-10-02  0:43   ` Jon Masters
2012-10-02 15:39     ` Catalin Marinas
2012-07-06 21:05 ` [PATCH 11/36] AArch64: MMU initialisation Catalin Marinas
2012-07-06 21:05 ` [PATCH 12/36] AArch64: MMU fault handling and page table management Catalin Marinas
2012-07-06 21:05 ` [PATCH 13/36] AArch64: Process management Catalin Marinas
2012-07-06 21:05 ` [PATCH 14/36] AArch64: CPU support Catalin Marinas
2012-07-06 21:05 ` [PATCH 15/36] AArch64: Cache maintenance routines Catalin Marinas
2012-07-06 21:05 ` [PATCH 16/36] AArch64: TLB maintenance functionality Catalin Marinas
2012-07-06 21:05 ` [PATCH 17/36] AArch64: IRQ handling Catalin Marinas
2012-07-06 21:05 ` [PATCH 18/36] AArch64: Atomic operations Catalin Marinas
2012-07-06 21:06 ` [PATCH 19/36] AArch64: Device specific operations Catalin Marinas
2012-07-06 21:06 ` [PATCH 20/36] AArch64: DMA mapping API Catalin Marinas
2012-07-06 21:06 ` [PATCH 21/36] AArch64: SMP support Catalin Marinas
2012-07-06 21:06 ` [PATCH 22/36] AArch64: ELF definitions Catalin Marinas
2012-07-06 21:06 ` [PATCH 23/36] AArch64: System calls handling Catalin Marinas
2012-07-06 21:06 ` [PATCH 24/36] AArch64: VDSO support Catalin Marinas
2012-07-06 21:06 ` [PATCH 25/36] AArch64: Signal handling support Catalin Marinas
2012-07-06 21:06 ` [PATCH 26/36] AArch64: User access library functions Catalin Marinas
2012-07-06 21:06 ` [PATCH 27/36] AArch64: 32-bit (compat) applications support Catalin Marinas
2012-07-06 21:06 ` [PATCH 28/36] AArch64: Floating point and SIMD Catalin Marinas
2012-07-06 21:06 ` [PATCH 29/36] AArch64: Debugging support Catalin Marinas
2012-07-06 21:06 ` [PATCH 30/36] AArch64: Performance counters support Catalin Marinas
2012-07-06 21:06 ` [PATCH 31/36] AArch64: Miscellaneous library functions Catalin Marinas
2012-07-06 21:06 ` [PATCH 32/36] AArch64: Loadable modules Catalin Marinas
2012-07-06 21:06 ` [PATCH 33/36] AArch64: Generic timers support Catalin Marinas
2012-07-12  0:18   ` Linus Walleij
2012-07-12 10:09     ` Marc Zyngier
2012-07-12 10:56       ` Linus Walleij
2012-07-12 16:57         ` John Stultz
2012-07-12 17:31           ` Marc Zyngier
2012-07-12 17:39             ` John Stultz
2012-07-13 12:40               ` Arnd Bergmann
2012-07-13 16:02                 ` Catalin Marinas
2012-07-13 16:32                   ` Arnd Bergmann
2012-07-13 18:30                   ` John Stultz
2012-07-06 21:06 ` [PATCH 34/36] AArch64: Miscellaneous header files Catalin Marinas
2012-07-06 21:06 ` [PATCH 35/36] AArch64: Build infrastructure Catalin Marinas
2012-07-06 21:06 ` [PATCH 36/36] AArch64: MAINTAINERS update Catalin Marinas
2012-08-10 16:24   ` [36/36] " Christopher Covington
2012-08-10 16:24     ` Christopher Covington
2012-07-06 22:58 ` [PATCH 00/36] AArch64 Linux kernel port Alan Cox
2012-07-07 21:30   ` Arnd Bergmann
2012-07-07 23:14   ` Catalin Marinas
2012-07-07 23:29     ` Alan Cox
2012-07-09 11:35       ` Catalin Marinas
2012-07-09 13:51         ` Alan Cox
2012-07-09 15:32           ` Arnd Bergmann
2012-07-09 15:49             ` Alan Cox
2012-07-09 16:02             ` Catalin Marinas
2012-07-09 16:33               ` Arnd Bergmann
2012-07-07  3:29 ` Matthew Garrett
2012-07-09 12:32   ` Mark Brown
2012-07-09 13:06     ` Matthew Garrett
2012-07-09 13:56       ` Mark Brown
2012-07-09 14:02         ` Matthew Garrett
2012-07-09 15:46           ` Mark Brown
2012-07-07  3:53 ` Olof Johansson
2012-07-07 19:27   ` Arnd Bergmann
2012-07-07 23:45     ` Jan Engelhardt
2012-07-08  5:05       ` Henrique de Moraes Holschuh
2012-07-08 20:28         ` Jan Engelhardt
2012-07-08  7:54     ` Jon Masters
2012-07-08 11:17       ` Dr. David Alan Gilbert
2012-07-08 18:13         ` Jon Masters
2012-07-08 18:31       ` Jon Masters
2012-07-08 22:24         ` Dennis Gilmore
2012-07-09  2:01           ` Jon Masters
2012-07-09  8:57             ` Catalin Marinas
2012-07-09 13:33             ` Geert Uytterhoeven
2012-07-08 20:31       ` Jan Engelhardt
2012-07-08 23:32         ` Jon Masters
2012-07-10  7:10     ` Ingo Molnar
2012-07-10 10:10       ` Catalin Marinas
2012-07-10 15:33         ` Alan Cox
2012-07-10 16:52           ` Arnd Bergmann
2012-07-10 20:35             ` Ingo Molnar
2012-07-10 21:19               ` Arnd Bergmann
2012-07-10 21:48                 ` Catalin Marinas
2012-07-11  8:20                 ` Ingo Molnar
2012-07-11 11:30                 ` Alan Cox
2012-07-10 21:44               ` Catalin Marinas
2012-07-11  8:55                 ` Catalin Marinas
2012-07-11  5:26             ` Rusty Russell
2012-07-11 10:53               ` Catalin Marinas
2012-07-12  2:08                 ` Rusty Russell
2012-07-10 16:57           ` Catalin Marinas
2012-07-10 16:52         ` Dennis Gilmore
2012-07-10 17:14         ` Joe Perches
2012-07-10 18:01           ` Jan Ceuleers
2012-07-10 18:05             ` richard -rw- weinberger
2012-07-10 20:16           ` Alexander Holler
2012-07-14 22:16             ` Jon Masters
2012-07-10 22:08         ` Chris Adams
2012-07-14  9:30         ` Pavel Machek
2012-07-15 12:16           ` Catalin Marinas
2012-07-15 19:43             ` Arnd Bergmann
2012-07-15 21:33               ` Catalin Marinas
2012-07-16 12:16                 ` Pavel Machek
2012-07-17  7:05                   ` Jon Masters
2012-07-17  8:02                     ` Arnd Bergmann
2012-07-17  9:50                       ` Alan Cox
2012-07-18  2:36                         ` Jon Masters
2012-07-17 10:45                   ` Catalin Marinas
2012-07-16  9:26               ` Geert Uytterhoeven
2012-07-17  6:53               ` Christoph Hellwig
2012-07-17  8:07                 ` Arnd Bergmann
2012-07-16  8:24             ` Avi Kivity
2012-07-17  7:09               ` Jon Masters
2012-07-17  8:37               ` Catalin Marinas
2012-07-15 23:21         ` Måns Rullgård
2012-07-15 23:53           ` Linus Torvalds
2012-07-17 22:18             ` Catalin Marinas
2012-07-17 22:35               ` Joe Perches
2012-07-18  2:33                 ` Jon Masters
2012-07-18 15:27                   ` Dennis Gilmore
2012-07-18 17:14                     ` Catalin Marinas
2012-07-18 17:25                       ` Måns Rullgård
2012-07-18 19:35                       ` Jon Masters
2012-07-18 19:55                         ` Linus Torvalds
2012-07-19 14:16     ` Guillem Jover
2012-07-07 23:42   ` Jan Engelhardt
2012-07-08 10:18   ` Catalin Marinas
2012-07-09 12:31     ` Jan Engelhardt
2012-07-07  9:30 ` Mikael Pettersson
2012-07-07 19:21   ` Kirill A. Shutemov
2012-07-10 10:12   ` Catalin Marinas
2012-07-14  9:35     ` Pavel Machek
2012-07-15 11:36       ` Catalin Marinas
2012-07-16 16:19         ` Pavel Machek
2012-07-16 19:45           ` Arnd Bergmann
2012-07-16 19:47           ` Måns Rullgård
2012-07-18  5:35 ` Jon Masters
2012-07-18  9:13   ` Catalin Marinas
2012-07-26 11:59 ` Catalin Marinas
     [not found] <jknWN-4WG-3@gated-at.bofh.it>
     [not found] ` <jkulA-O3-3@gated-at.bofh.it>
     [not found]   ` <jkIRz-2Hu-11@gated-at.bofh.it>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342586037.3669.16.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.