From patchwork Fri Jul 15 06:48:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corneliu ZUZU X-Patchwork-Id: 9231201 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 8570D60574 for ; Fri, 15 Jul 2016 06:51:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 726812819A for ; Fri, 15 Jul 2016 06:51:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 673FC28319; Fri, 15 Jul 2016 06:51:58 +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 DF0142819A for ; Fri, 15 Jul 2016 06:51:57 +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 1bNww0-0007zT-He; Fri, 15 Jul 2016 06:49:16 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNwvz-0007zH-8C for xen-devel@lists.xen.org; Fri, 15 Jul 2016 06:49:15 +0000 Received: from [193.109.254.147] by server-14.bemta-14.messagelabs.com id EF/23-27600-A6788875; Fri, 15 Jul 2016 06:49:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRWlGSWpSXmKPExsUSfTxjoW5me0e 4wd+blhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8b2nxvZCp7yVxz68525gfEMTxcjJ4eQgIfE 7r/7WLsYuYDstYwStx+ug3JOMkrM3bGBGabq86Y+NojEakaJOY33WUESbALaEucO3WMCsUUEp CWufb7MCGIzC/hLLDvUCxYXFgiX2NQ+DaiZg4NFQFXiytkqkDCvgKvE3O4vzCBhCQE5iQUX0k FMTgE3idOnCyG2ukps3HsC7AIJgRyJvYe/MEFUS0n8b1UCOUZCoJtFYsGdk+wQNTISjybeZJv AKLSAkWEVo0ZxalFZapGukbFeUlFmekZJbmJmjq6hoYlebmpxcWJ6ak5iUrFecn7uJkZgENYz MDDuYJx13O8QoyQHk5Io78aUjnAhvqT8lMqMxOKM+KLSnNTiQ4wyHBxKEryGbUA5waLU9NSKt MwcYDzApCU4eJREeD+1AqV5iwsSc4sz0yFSpxgVpcR5P4MkBEASGaV5cG2wGLzEKCslzMvIwM AgxFOQWpSbWYIq/4pRnINRSZjXAGQ7T2ZeCdz0V0CLmYAWW5u3gywuSURISTUwTku69PGDi3R nrBlznET6q+p71jEt4uo6h593nPZjYy8xCpB9eNJ184l/E/nXrTc6MPWn0IY50v8jL3+MX3+7 0DZZ8ixLfn6ce6gs4+6SiuU1cgHzC40mfTnQrp1mukHKbnLSOdtPM1xCJ+83NvCfoJh8PrUr6 rj87u/MDDnslfzc+QaTD4srsRRnJBpqMRcVJwIAQfo4SrwCAAA= X-Env-Sender: czuzu@bitdefender.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1468565353!53712976!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 9595 invoked from network); 15 Jul 2016 06:49:13 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-3.tower-27.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 15 Jul 2016 06:49:13 -0000 Received: (qmail 13160 invoked from network); 15 Jul 2016 09:49:12 +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:49:12 +0300 Received: from smtp01.buh.bitdefender.com (unknown [10.17.80.75]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id A1BB57FC06 for ; Fri, 15 Jul 2016 09:49:12 +0300 (EEST) Received: (qmail 10741 invoked from network); 15 Jul 2016 09:49:12 +0300 Received: from unknown (HELO czuzu-dev-vm.clj.bitdefender.biz) (czuzu@bitdefender.com@91.199.104.243) by smtp01.buh.bitdefender.com with SMTP; 15 Jul 2016 09:49:12 +0300 From: Corneliu ZUZU To: xen-devel@lists.xen.org Date: Fri, 15 Jul 2016 09:48:50 +0300 Message-Id: <1468565330-32626-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 smtp01.buh.bitdefender.com, sigver: 7.66328 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 426550, Stamp: 3], Multi: [Enabled, t: (0.000009, 0.002300)], BW: [Enabled, t: (0.000007,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.002713), Flags: 85D2ED72; NN_NO_CONTENT_TYPE; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.009558)], URL: [Enabled, t: (0.000005)], RTDA: [Enabled, t: (0.016556), Hit: No, Details: v2.3.10; Id: 2m1ghk0.1and2vvcs.iqrj], total: 0(775) X-BitDefender-CF-Stamp: none Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH v4 2/7] asm-x86/atomic.h: minor: proper atomic_inc_and_test() placement 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 Place atomic_inc_and_test() implementation after atomic_inc(). Also empty line fix. Signed-off-by: Corneliu ZUZU Reviewed-by: Andrew Cooper --- Changed since v3: --- xen/include/asm-x86/atomic.h | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/xen/include/asm-x86/atomic.h b/xen/include/asm-x86/atomic.h index d246b70..5f9f2dd 100644 --- a/xen/include/asm-x86/atomic.h +++ b/xen/include/asm-x86/atomic.h @@ -110,7 +110,6 @@ static inline int _atomic_read(atomic_t v) return v.counter; } - /** * atomic_set - set atomic variable * @v: pointer of type atomic_t @@ -217,6 +216,25 @@ static inline void atomic_inc(atomic_t *v) } /** + * atomic_inc_and_test - increment and test + * @v: pointer of type atomic_t + * + * Atomically increments @v by 1 + * and returns true if the result is zero, or false for all + * other cases. + */ +static inline int atomic_inc_and_test(atomic_t *v) +{ + unsigned char c; + + asm volatile ( + "lock; incl %0; sete %1" + : "=m" (*(volatile int *)&v->counter), "=qm" (c) + : "m" (*(volatile int *)&v->counter) : "memory" ); + return c != 0; +} + +/** * atomic_dec - decrement atomic variable * @v: pointer of type atomic_t * @@ -250,25 +268,6 @@ static inline int atomic_dec_and_test(atomic_t *v) } /** - * atomic_inc_and_test - increment and test - * @v: pointer of type atomic_t - * - * Atomically increments @v by 1 - * and returns true if the result is zero, or false for all - * other cases. - */ -static inline int atomic_inc_and_test(atomic_t *v) -{ - unsigned char c; - - asm volatile ( - "lock; incl %0; sete %1" - : "=m" (*(volatile int *)&v->counter), "=qm" (c) - : "m" (*(volatile int *)&v->counter) : "memory" ); - return c != 0; -} - -/** * atomic_add_negative - add and test if negative * @v: pointer of type atomic_t * @i: integer value to add