From patchwork Sun Jul 8 19:22:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 169661 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2577E2C0217 for ; Mon, 9 Jul 2012 05:22:40 +1000 (EST) Received: from localhost ([::1]:42868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Snx41-0001NI-Su for incoming@patchwork.ozlabs.org; Sun, 08 Jul 2012 15:22:37 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Snx3j-0001AE-1B for qemu-devel@nongnu.org; Sun, 08 Jul 2012 15:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Snx3h-0003dQ-2L for qemu-devel@nongnu.org; Sun, 08 Jul 2012 15:22:18 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:47640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Snx3g-0003d4-Pl for qemu-devel@nongnu.org; Sun, 08 Jul 2012 15:22:16 -0400 Received: by eaak12 with SMTP id k12so5466923eaa.4 for ; Sun, 08 Jul 2012 12:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references; bh=06g8X3woSZuHIkHJN2AdsGX8kPZhMN2DiCHL8rrNjEE=; b=kVNjULxG67ThDO0ZX8KcVTcjpgu/J1p7rokC4aHhpsUFZUwddoarUclO4hyuRuz3Wj tgFOfeUZUhc7sdhEOALv+YIXRO3gU4d5LDWPKeQ177F5TFiGtfNT2uKxPBAHWzACGTi+ TKWodcclPEA8ax0RXuMYJB/irmO3LOQwJC/TB2edLJcuCkRLJ2NSqcbzJUxy0lVfbIdB rm7zYi6IbwqkMAi3X5PT1rxSdWD3UEUjYbR/ouL3QUoIYhYE/mDsNf1zSBuz+nA6MvAl iwoOf3DAuBgErVgO3d+XVTGkPdaSgsmFKR5TUCrzDrkVakkHpJTI5bkJIPMH788fkYKl ejqA== Received: by 10.14.27.137 with SMTP id e9mr8456675eea.105.1341775334869; Sun, 08 Jul 2012 12:22:14 -0700 (PDT) Received: from localhost.localdomain (blueswirl.broker.freenet6.net. [2001:5c0:1400:b::d5a3]) by mx.google.com with ESMTPS id x52sm87679565eea.11.2012.07.08.12.22.13 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 08 Jul 2012 12:22:14 -0700 (PDT) From: blauwirbel@gmail.com To: qemu-devel@nongnu.org Date: Sun, 8 Jul 2012 19:22:32 +0000 Message-Id: <1bc42618f0651b6903bc0bec9a26914da30c7bcf.1341775234.git.blauwirbel@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.173 Cc: blueswirl@gmail.com Subject: [Qemu-devel] [PATCH v2 2/3] bitops: drop volatile qualifier X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Blue Swirl Qualifier 'volatile' is not useful for applications, it's too strict for single threaded code but does not give the real atomicity guarantees needed for multithreaded code. Drop them. Signed-off-by: Blue Swirl Reviewed-by: Peter Maydell --- bitops.h | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/bitops.h b/bitops.h index f6ac721..bc99727 100644 --- a/bitops.h +++ b/bitops.h @@ -114,7 +114,7 @@ static inline unsigned int ffz(unsigned long word) * @nr: the bit to set * @addr: the address to start counting from */ -static inline void set_bit(unsigned int nr, volatile unsigned long *addr) +static inline void set_bit(unsigned int nr, unsigned long *addr) { unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); @@ -127,7 +127,7 @@ static inline void set_bit(unsigned int nr, volatile unsigned long *addr) * @nr: Bit to clear * @addr: Address to start counting from */ -static inline void clear_bit(unsigned int nr, volatile unsigned long *addr) +static inline void clear_bit(unsigned int nr, unsigned long *addr) { unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); @@ -140,7 +140,7 @@ static inline void clear_bit(unsigned int nr, volatile unsigned long *addr) * @nr: Bit to change * @addr: Address to start counting from */ -static inline void change_bit(unsigned int nr, volatile unsigned long *addr) +static inline void change_bit(unsigned int nr, unsigned long *addr) { unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); @@ -153,8 +153,7 @@ static inline void change_bit(unsigned int nr, volatile unsigned long *addr) * @nr: Bit to set * @addr: Address to count from */ -static inline int test_and_set_bit(unsigned int nr, - volatile unsigned long *addr) +static inline int test_and_set_bit(unsigned int nr, unsigned long *addr) { unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); @@ -169,8 +168,7 @@ static inline int test_and_set_bit(unsigned int nr, * @nr: Bit to clear * @addr: Address to count from */ -static inline int test_and_clear_bit(unsigned int nr, - volatile unsigned long *addr) +static inline int test_and_clear_bit(unsigned int nr, unsigned long *addr) { unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); @@ -185,8 +183,7 @@ static inline int test_and_clear_bit(unsigned int nr, * @nr: Bit to change * @addr: Address to count from */ -static inline int test_and_change_bit(unsigned int nr, - volatile unsigned long *addr) +static inline int test_and_change_bit(unsigned int nr, unsigned long *addr) { unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); @@ -201,8 +198,7 @@ static inline int test_and_change_bit(unsigned int nr, * @nr: bit number to test * @addr: Address to start counting from */ -static inline int test_bit(unsigned int nr, - const volatile unsigned long *addr) +static inline int test_bit(unsigned int nr, const unsigned long *addr) { return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); }