All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corneliu ZUZU <czuzu@bitdefender.com>
To: xen-devel@lists.xen.org
Cc: Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v4 6/7] asm-arm/atomic.h: atomic_{inc, dec}_return: macros to inline functions
Date: Fri, 15 Jul 2016 09:51:29 +0300	[thread overview]
Message-ID: <1468565489-339-1-git-send-email-czuzu@bitdefender.com> (raw)
In-Reply-To: <1468565278-32535-1-git-send-email-czuzu@bitdefender.com>

Turn atomic_inc_return and atomic_dec_return atomic.h macros to inline
functions. Adjust README.LinuxPrimitives in the process.

Signed-off-by: Corneliu ZUZU <czuzu@bitdefender.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changed since v3:
  * update README.LinuxPrimitives file
---
 xen/arch/arm/README.LinuxPrimitives | 18 ++++++++++--------
 xen/include/asm-arm/atomic.h        | 13 ++++++++++---
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/xen/arch/arm/README.LinuxPrimitives b/xen/arch/arm/README.LinuxPrimitives
index 2fcdfa4..efdc00c 100644
--- a/xen/arch/arm/README.LinuxPrimitives
+++ b/xen/arch/arm/README.LinuxPrimitives
@@ -27,13 +27,14 @@ The following functions were taken from Linux:
     atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(),
     atomic_cmpxchg(), __atomic_add_unless()
 
-Also, the following macros which were in the meantime moved to asm-arm/atomic.h
-and most of them turned to inline functions:
-    atomic_xchg(v, new) [still macro], atomic_inc(v), atomic_dec(v),
+Also, the following macros which were in the meantime moved to asm-arm/atomic.h:
+    atomic_xchg(v, new), atomic_inc(v), atomic_dec(v),
     atomic_inc_and_test(v), atomic_dec_and_test(v),
-    atomic_inc_return(v) [still macro], atomic_dec_return(v) [still macro],
+    atomic_inc_return(v), atomic_dec_return(v),
     atomic_sub_and_test(i, v), atomic_add_negative(i,v)
 
+    * Note: all but atomic_xchg() were turned to inline functions
+
 ---------------------------------------------------------------------
 
 mem*: last sync @ v3.16-rc6 (last commit: d875c9b37240)
@@ -106,13 +107,14 @@ The following functions were taken from Linux:
     atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(),
     atomic_cmpxchg(), __atomic_add_unless()
 
-Also, the following macros which were in the meantime moved to asm-arm/atomic.h
-and most of them turned to inline functions:
-    atomic_xchg(v, new) [still macro], atomic_inc(v), atomic_dec(v),
+Also, the following macros which were in the meantime moved to asm-arm/atomic.h:
+    atomic_xchg(v, new), atomic_inc(v), atomic_dec(v),
     atomic_inc_and_test(v), atomic_dec_and_test(v),
-    atomic_inc_return(v) [still macro], atomic_dec_return(v) [still macro],
+    atomic_inc_return(v), atomic_dec_return(v),
     atomic_sub_and_test(i, v), atomic_add_negative(i,v)
 
+	* Note: all but atomic_xchg() were turned to inline functions
+
 ---------------------------------------------------------------------
 
 mem*: last sync @ v3.16-rc6 (last commit: d98b90ea22b0)
diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h
index 78dad29..c69aae6 100644
--- a/xen/include/asm-arm/atomic.h
+++ b/xen/include/asm-arm/atomic.h
@@ -130,9 +130,6 @@ static inline void _atomic_set(atomic_t *v, int i)
 # error "unknown ARM variant"
 #endif
 
-#define atomic_inc_return(v)        (atomic_add_return(1, v))
-#define atomic_dec_return(v)        (atomic_sub_return(1, v))
-
 static inline int atomic_sub_and_test(int i, atomic_t *v)
 {
     return atomic_sub_return(i, v) == 0;
@@ -143,6 +140,11 @@ static inline void atomic_inc(atomic_t *v)
     atomic_add(1, v);
 }
 
+static inline int atomic_inc_return(atomic_t *v)
+{
+    return atomic_add_return(1, v);
+}
+
 static inline int atomic_inc_and_test(atomic_t *v)
 {
     return atomic_add_return(1, v) == 0;
@@ -153,6 +155,11 @@ static inline void atomic_dec(atomic_t *v)
     atomic_sub(1, v);
 }
 
+static inline int atomic_dec_return(atomic_t *v)
+{
+    return atomic_sub_return(1, v);
+}
+
 static inline int atomic_dec_and_test(atomic_t *v)
 {
     return atomic_sub_return(1, v) == 0;
-- 
2.5.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-07-15  6:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15  6:47 [PATCH v4 0/7] <asm/atomic.h> adjustments Corneliu ZUZU
2016-07-15  6:48 ` [PATCH v4 1/7] asm-arm/atomic.h: fix arm32|arm64 macros duplication Corneliu ZUZU
2016-07-15  9:28   ` Julien Grall
2016-07-15  9:55     ` Corneliu ZUZU
2016-07-15 10:06       ` Julien Grall
2016-07-15 10:17         ` Corneliu ZUZU
2016-07-15  6:48 ` [PATCH v4 2/7] asm-x86/atomic.h: minor: proper atomic_inc_and_test() placement Corneliu ZUZU
2016-07-15  6:49 ` [PATCH v4 3/7] asm-arm/atomic.h: reorder macros to match x86-side Corneliu ZUZU
2016-07-15  9:28   ` Julien Grall
2016-07-15  6:50 ` [PATCH v4 4/7] asm/atomic.h: common prototyping (add xen/atomic.h) Corneliu ZUZU
2016-07-15  9:30   ` Julien Grall
2016-07-15  9:59     ` Corneliu ZUZU
2016-07-15  6:50 ` [PATCH v4 5/7] xen/atomic.h: fix: make atomic_read() param const Corneliu ZUZU
2016-07-15  9:31   ` Julien Grall
2016-07-15  6:51 ` Corneliu ZUZU [this message]
2016-07-15  6:59   ` [PATCH v4 6/7] asm-arm/atomic.h: atomic_{inc, dec}_return: macros to inline functions Corneliu ZUZU
2016-07-15  6:52 ` [PATCH v4 7/7] asm/atomic.h: implement missing and add common prototypes Corneliu ZUZU
2016-07-15  9:34   ` Julien Grall

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=1468565489-339-1-git-send-email-czuzu@bitdefender.com \
    --to=czuzu@bitdefender.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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 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.