From patchwork Fri Jul 15 06:51:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corneliu ZUZU X-Patchwork-Id: 9231215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3522160865 for ; Fri, 15 Jul 2016 06:54:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 231382819A for ; Fri, 15 Jul 2016 06:54:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17EA728319; Fri, 15 Jul 2016 06:54:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA55F2819A for ; Fri, 15 Jul 2016 06:54:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNwyX-0000PR-Qr; Fri, 15 Jul 2016 06:51:53 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNwyW-0000P9-J6 for xen-devel@lists.xen.org; Fri, 15 Jul 2016 06:51:52 +0000 Received: from [193.109.254.147] by server-2.bemta-14.messagelabs.com id DF/0D-29243-70888875; Fri, 15 Jul 2016 06:51:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRWlGSWpSXmKPExsUSfTxjoS57R0e 4weNtYhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bXjktsBW9kKp7Mes7cwHhdoouRk0NIwENi 6uXXjF2MXED2WkaJNRv2MUM4Jxkl/l2+wwhT9eLWDiaIxGqgxPw+sASbgLbEuUP3mEBsEQFpi WufL4PFmQVCJab+fcACYgsLxEqsX3uWGcRmEVCVePlpJpDNwcEr4Czxdl4oiCkhICex4EI6iM kp4CZx+nQhxFZXiY17T4A1SgjkSBxcfZcNolpK4n+rEsgxEgLLWCTeLVzNCFEjI/Fo4k22CYx CCxgZVjFqFKcWlaUW6Roa6SUVZaZnlOQmZuboGhqa6OWmFhcnpqfmJCYV6yXn525iBAYhAxDs YDw7zfkQoyQHk5Io78aUjnAhvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErx724BygkWp6akVaZk5w HiASUtw8CiJ8GaCpHmLCxJzizPTIVKnGBWlxHmzQRICIImM0jy4NlgMXmKUlRLmZQQ6RIinIL UoN7MEVf4VozgHo5IwbzLIFJ7MvBK46a+AFjMBLbY2bwdZXJKIkJJqYFRLvGHUcyr0lPLyf+4 Piq+LBVVEz//660psrR9zY13zLLaFbW9lF3zQ+v/uQ1H25j/RSVWTLjQ/fah9++iBnPsm2xcp tPH2eJtdflJ0zX3alHWTmko3c/6We91Qb3Q817+4YrZmvUgTS5r+JT52B2GVx64qtxyT7e+4S Rat4M1e9iY62SNwqRJLcUaioRZzUXEiAE43gb68AgAA X-Env-Sender: czuzu@bitdefender.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1468565510!54058769!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4472 invoked from network); 15 Jul 2016 06:51:51 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-13.tower-27.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 15 Jul 2016 06:51:51 -0000 Received: (qmail 13273 invoked from network); 15 Jul 2016 09:51:50 +0300 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 15 Jul 2016 09:51:50 +0300 Received: from smtp03.buh.bitdefender.org (unknown [10.17.80.77]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id E45627FC07 for ; Fri, 15 Jul 2016 09:51:49 +0300 (EEST) Received: (qmail 32473 invoked from network); 15 Jul 2016 09:51:49 +0300 Received: from unknown (HELO czuzu-dev-vm.clj.bitdefender.biz) (czuzu@bitdefender.com@91.199.104.243) by smtp03.buh.bitdefender.org with SMTP; 15 Jul 2016 09:51:49 +0300 From: Corneliu ZUZU To: xen-devel@lists.xen.org Date: Fri, 15 Jul 2016 09:51:29 +0300 Message-Id: <1468565489-339-1-git-send-email-czuzu@bitdefender.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1468565278-32535-1-git-send-email-czuzu@bitdefender.com> References: <1468565278-32535-1-git-send-email-czuzu@bitdefender.com> X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp03.buh.bitdefender.org, sigver: 7.66328 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 426555, Stamp: 3], Multi: [Enabled, t: (0.000009, 0.003862)], BW: [Enabled, t: (0.000007,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.003255), Flags: 85D2ED72; NN_NO_CONTENT_TYPE; NN_LEGIT_SUMM_400_WORDS; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.010647)], URL: [Enabled, t: (0.000005)], RTDA: [Enabled, t: (0.015934), Hit: No, Details: v2.3.10; Id: 2m1ghic.1aml0sh1c.1nlgf], total: 0(775) X-BitDefender-CF-Stamp: none Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v4 6/7] asm-arm/atomic.h: atomic_{inc, dec}_return: macros to inline functions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Stefano Stabellini --- 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;