linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
To: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
	linux-m68k-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-m32r-rQhvJZKUsGBRYuoOT4C5/9i2O/JbrIOy@public.gmane.org,
	linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-cris-kernel-VrBV9hrLPhE@public.gmane.org,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Chris Metcalf <cmetcalf-kv+TWInifGbQT0dZR+AlfA@public.gmane.org>,
	David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-am33-list-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] atomic: add *_dec_not_zero
Date: Mon, 09 May 2011 08:15:39 +1000	[thread overview]
Message-ID: <1304892939.2513.503.camel@pasglop> (raw)
In-Reply-To: <1304458235-28473-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>

On Tue, 2011-05-03 at 23:30 +0200, Sven Eckelmann wrote:
> Introduce an *_dec_not_zero operation.  Make this a special case of
> *_add_unless because batman-adv uses atomic_dec_not_zero in different
> places like re-broadcast queue or aggregation queue management. There
> are other non-final patches which may also want to use this macro.

For arch/powerpc:

Acked-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>

(Sorry for catching up late)

Cheers,
Ben.

> diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
> index b8f152e..906f49a 100644
> --- a/arch/powerpc/include/asm/atomic.h
> +++ b/arch/powerpc/include/asm/atomic.h
> @@ -213,6 +213,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
>  }
>  
>  #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
> +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
>  
>  #define atomic_sub_and_test(a, v)	(atomic_sub_return((a), (v)) == 0)
>  #define atomic_dec_and_test(v)		(atomic_dec_return((v)) == 0)
> @@ -469,6 +470,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
>  }
>  
>  #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
> +#define atomic64_dec_not_zero(v) atomic64_add_unless((v), -1, 0)
>  
>  #else  /* __powerpc64__ */
>  #include <asm-generic/atomic64.h>
> diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
> index c2410af..3d4c58a 100644
> --- a/arch/powerpc/include/asm/local.h
> +++ b/arch/powerpc/include/asm/local.h
> @@ -134,6 +134,7 @@ static __inline__ int local_add_unless(local_t *l, long a, long u)
>  }
>  
>  #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
> +#define local_dec_not_zero(l) local_add_unless((l), -1, 0)
>  
>  #define local_sub_and_test(a, l)	(local_sub_return((a), (l)) == 0)
>  #define local_dec_and_test(l)		(local_dec_return((l)) == 0)

WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Sven Eckelmann <sven@narfation.org>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-mips@linux-mips.org, linux-m32r@ml.linux-m32r.org,
	linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org,
	linux-cris-kernel@axis.com, linux-s390@vger.kernel.org,
	linux-sh@vger.kernel.org, x86@kernel.org,
	Chris Metcalf <cmetcalf@tilera.com>,
	David Howells <dhowells@redhat.com>,
	linux-m68k@vger.kernel.org, linux-am33-list@redhat.com,
	linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] atomic: add *_dec_not_zero
Date: Mon, 09 May 2011 08:15:39 +1000	[thread overview]
Message-ID: <1304892939.2513.503.camel@pasglop> (raw)
Message-ID: <20110508221539.LA-ABgzrAloJ151NAs71qeh5JM4_Wb7Q32-Qb_4Apf8@z> (raw)
In-Reply-To: <1304458235-28473-1-git-send-email-sven@narfation.org>

On Tue, 2011-05-03 at 23:30 +0200, Sven Eckelmann wrote:
> Introduce an *_dec_not_zero operation.  Make this a special case of
> *_add_unless because batman-adv uses atomic_dec_not_zero in different
> places like re-broadcast queue or aggregation queue management. There
> are other non-final patches which may also want to use this macro.

For arch/powerpc:

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

(Sorry for catching up late)

Cheers,
Ben.

> diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
> index b8f152e..906f49a 100644
> --- a/arch/powerpc/include/asm/atomic.h
> +++ b/arch/powerpc/include/asm/atomic.h
> @@ -213,6 +213,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
>  }
>  
>  #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
> +#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
>  
>  #define atomic_sub_and_test(a, v)	(atomic_sub_return((a), (v)) == 0)
>  #define atomic_dec_and_test(v)		(atomic_dec_return((v)) == 0)
> @@ -469,6 +470,7 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
>  }
>  
>  #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
> +#define atomic64_dec_not_zero(v) atomic64_add_unless((v), -1, 0)
>  
>  #else  /* __powerpc64__ */
>  #include <asm-generic/atomic64.h>
> diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
> index c2410af..3d4c58a 100644
> --- a/arch/powerpc/include/asm/local.h
> +++ b/arch/powerpc/include/asm/local.h
> @@ -134,6 +134,7 @@ static __inline__ int local_add_unless(local_t *l, long a, long u)
>  }
>  
>  #define local_inc_not_zero(l) local_add_unless((l), 1, 0)
> +#define local_dec_not_zero(l) local_add_unless((l), -1, 0)
>  
>  #define local_sub_and_test(a, l)	(local_sub_return((a), (l)) == 0)
>  #define local_dec_and_test(l)		(local_dec_return((l)) == 0)




  parent reply	other threads:[~2011-05-08 22:15 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 21:30 [PATCH] atomic: add *_dec_not_zero Sven Eckelmann
2011-05-03 21:30 ` Sven Eckelmann
2011-05-04  4:44 ` Mike Frysinger
2011-05-04  4:44   ` Mike Frysinger
2011-05-04 15:04   ` James Bottomley
2011-05-04 15:04     ` James Bottomley
2011-05-04  6:12 ` David Miller
2011-05-04  6:12   ` David Miller
2011-05-04  7:03 ` Ingo Molnar
2011-05-04  7:03   ` Ingo Molnar
2011-05-04  8:05 ` David Laight
2011-05-04  8:05   ` David Laight
2011-05-04  8:21   ` Sven Eckelmann
2011-05-04  8:21     ` Sven Eckelmann
2011-05-04  8:33   ` Mike Frysinger
     [not found] ` <1304458235-28473-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
2011-05-04 10:48   ` Jesper Nilsson
2011-05-04 11:02   ` Ralf Baechle
2011-05-04 11:02     ` Ralf Baechle
2011-05-04 11:53   ` David Howells
2011-05-04 11:53     ` David Howells
2011-05-08 22:15   ` Benjamin Herrenschmidt [this message]
2011-05-08 22:15     ` Benjamin Herrenschmidt
2011-05-04 12:09 ` Chris Metcalf
2011-05-04 12:09   ` Chris Metcalf
2011-05-04 12:17 ` Geert Uytterhoeven
2011-05-04 12:17   ` Geert Uytterhoeven
2011-05-04 17:27 ` Will Deacon
2011-05-04 17:27   ` Will Deacon
2011-05-04 18:13 ` Matt Turner
2011-05-08  9:24 ` Russell King - ARM Linux
2011-05-08  9:24   ` Russell King - ARM Linux
2011-05-08  9:33   ` Sven Eckelmann
2011-05-08  9:33     ` Sven Eckelmann
2011-05-09  2:38     ` Mike Frysinger
2011-05-09  2:38       ` Mike Frysinger
2011-05-18 19:49 ` [PATCHv2] " Sven Eckelmann
2011-05-23  7:13   ` Paul Mundt
2011-05-23  7:13     ` Paul Mundt
2011-05-23  7:27   ` Heiko Carstens
2011-05-29  7:13   ` [PATCHv3] " Sven Eckelmann
2011-05-29  7:13     ` Sven Eckelmann
2011-06-02  5:44     ` Hirokazu Takata
2011-06-02  5:44       ` Hirokazu Takata
2011-06-17 10:38     ` [PATCHv3-resend] " Sven Eckelmann
2011-06-17 10:38       ` Sven Eckelmann
2011-06-17 15:13       ` Arnd Bergmann
2011-06-17 17:32         ` Sven Eckelmann
2011-06-17 17:32           ` Sven Eckelmann
2011-06-17 21:20           ` Arnd Bergmann
2011-06-17 21:20             ` Arnd Bergmann

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=1304892939.2513.503.camel@pasglop \
    --to=benh-xvmvhmargas8u2djnn8i7kb+6bgklq7r@public.gmane.org \
    --cc=cmetcalf-kv+TWInifGbQT0dZR+AlfA@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-am33-list-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-cris-kernel-VrBV9hrLPhE@public.gmane.org \
    --cc=linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-m32r-rQhvJZKUsGBRYuoOT4C5/9i2O/JbrIOy@public.gmane.org \
    --cc=linux-m68k-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org \
    --cc=uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).