Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp270366ybi; Fri, 24 May 2019 03:38:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJu9SlyspRlGuHPFbeCBikLFQ/WHSZ4YZFZRRpC6+bYraMOxGBJ7LOxhcEcxSn9jv0+Eev X-Received: by 2002:a63:cc4e:: with SMTP id q14mr101677232pgi.84.1558694308048; Fri, 24 May 2019 03:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558694308; cv=none; d=google.com; s=arc-20160816; b=QaSyj1N3yoeYVYs67v6mURnPWgD8QNTvrqJm36iZ82kCRwMhskdMLvhV2VBtwxH2tt JpXeL6tfH53sPAKcy8pfbehR1sNRNve0yJzvqfuN6EwxqFy61lWrtXMhqXfQGIfsuMpC i8Q/vN79PY10z5eOsZXwlPmxZU4SH984B2aDxcodHr0dPEwiL0OBy6ZEoBAAJYTgjbV7 ejk/kWpaDF8eHEKVwnMyFYgBhd2FNpPoN3XZ2w4ZqLtKCm+Bkt/s1ZxNUFB7DdDk/lf5 PZJpQWa1X/vVSf+2OaIWSztfDw1ovqy6IM0g3CWBOILXiIJSknS98rIK2Y4Pygodx9O6 7KBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=2QncBY+O8HWHusWpmG3TvATwMEVVOER+jDNcjQdf6X8=; b=CORBWI9zs8+STCsJzdtm6QQJs32HNwr/2H4SpQUjvGexweT2Ed1NiHMUaMcYlcW03g 3k6XTkyD3P9bPsDOeeT71+O5fLrYQ2Y8/DQOCBYval/iAIXfZWPJumiIat00kssaVsJc F5vffwBJYAb+vZtc5djcqTOzHkiL+roDyaW1oEXXNahOUNEbhygE+1aQ2LhGFhSQVEiX +wKgoBBmYcikGauTnaRDzwR/Aw1HcarwA3fX/K7TKJu/Hx7Cb9tMdigFqx5Ho1Cbn5gR KCdZwgT2uMdOhLXOSbBFYbnZrSK+8P2ehdCimd1SPS5M9Ch3WVC+c4iAXRKz6EZF/XXn E3Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EVlS01Zr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n23si3632033pgk.487.2019.05.24.03.38.05; Fri, 24 May 2019 03:38:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EVlS01Zr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390561AbfEXKgU (ORCPT + 99 others); Fri, 24 May 2019 06:36:20 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54838 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389448AbfEXKgT (ORCPT ); Fri, 24 May 2019 06:36:19 -0400 Received: by mail-wm1-f66.google.com with SMTP id i3so8822645wml.4 for ; Fri, 24 May 2019 03:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2QncBY+O8HWHusWpmG3TvATwMEVVOER+jDNcjQdf6X8=; b=EVlS01ZrOUW4y5TgcO5PW42Ys40ozEuuGxT/VlB+ZHdDPVKs4LX29n9Jkr/8Z6PNse UOegy/cIjxDtwK5VzIY7E10zeWFGG8tTsr5lP2bUds+aMR5zF6msMBfDOuzwMsAVKFkQ gU27fdfkz+KNgVoLDEVbPC0ybAaS2opAbZtLg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2QncBY+O8HWHusWpmG3TvATwMEVVOER+jDNcjQdf6X8=; b=NWTkUBCAqfnj5kNwlchrZsE4Wl4cU9tW4LbT8XcDldMFALweDnnrYAUkTA1GfSojFf GzQvcc1JyNOtUUlhu1wlDg29USc+kmZG7DOIXOIrA5ELKq9dswjZ2kAaRcUbql/CrXzw qbCKRyL02ky7gfS0iFWGQICQrSJpL4W1/ATO3q+l4OOsRETfFxn6JmtqdJ1qiUyv0rlA 4fthaNZaX8ll3pYhibm5vxf30xehLBxu881dmYfmJRN/2w9SxCjdFzvrIp9KF/WwWXnu YKHhJrWFLcqsHNPmBrX/P8N0+egqdRYZCzfuUWCDtlD/DjlOuzp1E8kRVhyxsnBcJHHo 9kLA== X-Gm-Message-State: APjAAAXFgtSOqrl2sV9NHJnjzMK/VLAeX0g0hPJzlMmDaVbwmgtxgtlW hv+xUYy5woqqOGMYZLamz0msUEJuvpxIog== X-Received: by 2002:a1c:f909:: with SMTP id x9mr16477369wmh.12.1558694177408; Fri, 24 May 2019 03:36:17 -0700 (PDT) Received: from localhost.localdomain (86.100.broadband17.iol.cz. [109.80.100.86]) by smtp.gmail.com with ESMTPSA id n4sm2111272wrp.61.2019.05.24.03.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 May 2019 03:36:16 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , Arnd Bergmann , Greg Kroah-Hartman , Jorgen Hansen , Peter Zijlstra , Will Deacon , Mark Rutland , "Paul E. McKenney" Subject: [PATCH 2/2] compiler: Prevent evaluation of WRITE_ONCE() Date: Fri, 24 May 2019 12:35:36 +0200 Message-Id: <1558694136-19226-3-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558694136-19226-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1558694136-19226-1-git-send-email-andrea.parri@amarulasolutions.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that there's no single use of the value of WRITE_ONCE(), change the implementation to eliminate it. Suggested-by: Mark Rutland Signed-off-by: Andrea Parri Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Jorgen Hansen Cc: Peter Zijlstra Cc: Will Deacon Cc: Mark Rutland Cc: "Paul E. McKenney" --- include/linux/compiler.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 8aaf7cd026b06..4024c809a6c63 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -277,12 +277,11 @@ unsigned long read_word_at_a_time(const void *addr) } #define WRITE_ONCE(x, val) \ -({ \ +do { \ union { typeof(x) __val; char __c[1]; } __u = \ { .__val = (__force typeof(x)) (val) }; \ __write_once_size(&(x), __u.__c, sizeof(x)); \ - __u.__val; \ -}) +} while (0) #endif /* __KERNEL__ */ -- 2.7.4