Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751673AbcDQLRw (ORCPT ); Sun, 17 Apr 2016 07:17:52 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:15657 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751277AbcDQLRv (ORCPT ); Sun, 17 Apr 2016 07:17:51 -0400 X-IronPort-AV: E=Sophos;i="5.24,497,1454972400"; d="scan'208";a="214624186" Date: Sun, 17 Apr 2016 13:17:48 +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: <1460881671.19090.90.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> <1460881671.19090.90.camel@perches.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1013762233-1460891869=:2034" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1361 Lines: 52 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1013762233-1460891869=:2034 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Sun, 17 Apr 2016, Joe Perches wrote: > On Sun, 2016-04-17 at 07:43 +0200, Julia Lawall wrote: > > 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? > > Maybe. ?There are more than 500 of these ACCESS_ONCE > uses that could be converted. > > The kernel cocci scripts are typically more complicated > with virtual org/report/context/patch blocks. > > So perhaps this needs to be fleshed out more. I can do that. julia --8323328-1013762233-1460891869=:2034--