Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752007AbcDQFnb (ORCPT ); Sun, 17 Apr 2016 01:43:31 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:62323 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751217AbcDQFna (ORCPT ); Sun, 17 Apr 2016 01:43:30 -0400 X-IronPort-AV: E=Sophos;i="5.24,495,1454972400"; d="scan'208";a="174722929" Date: Sun, 17 Apr 2016 07:43:26 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: Joe Perches cc: Andrew Morton , Andy Whitcroft , linux-kernel@vger.kernel.org, Davidlohr Bueso , Davidlohr Bueso Subject: Re: [PATCH] checkpatch: Whine about ACCESS_ONCE In-Reply-To: <1460836099.19090.82.camel@perches.com> Message-ID: References: <1460828078-5224-1-git-send-email-dave@stgolabs.net> <1460833453.19090.79.camel@perches.com> <1460836099.19090.82.camel@perches.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 566 Lines: 32 On Sat, 16 Apr 2016, Joe Perches wrote: > On Sat, 2016-04-16 at 12:04 -0700, Joe Perches wrote: > > Add a test for use of ACCESS_ONCE that could be written using > > READ_ONCE or WRITE_ONCE. > > > > --fix it too if desired. > > And here's a simple coccinelle script that does a > rather better job: > > $ cat access_once.cocci > @@ > expression e1; > expression e2; > @@ > > - ACCESS_ONCE(e1) = e2 > + WRITE_ONCE(e1, e2) > > @@ > expression e1; > @@ > > - ACCESS_ONCE(e1) > + READ_ONCE(e1) Looks good to me. Is this something to put in the kernel? julia