From: Julia Lawall <julia.lawall@lip6.fr>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andy Whitcroft <apw@shadowen.org>,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [PATCH] checkpatch: Whine about ACCESS_ONCE
Date: Sun, 17 Apr 2016 13:39:01 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1604171337450.2034@localhost6.localdomain6> (raw)
In-Reply-To: <1460881671.19090.90.camel@perches.com>
A suitably versatile semantic patch is below. Feel free to update
at
least the copyright line, and perhaps the initial explanation and the
strings printed in report and org modes.
julia
/// Use READ_ONCE or WRITE_ONCE instead of ACCESS_ONCE.
///
// Confidence: High
// Copyright: (C) 2016 Joe Perches, afffiliation?, license?
// Options: --no-includes --include-headers
virtual patch
virtual context
virtual org
virtual report
@written depends on patch && !context && !org && !report@
expression e1;
expression e2;
@@
- ACCESS_ONCE(e1) = e2
+ WRITE_ONCE(e1, e2)
@read depends on patch && !context && !org && !report@
expression e1;
@@
- ACCESS_ONCE(e1)
+ READ_ONCE(e1)
// ----------------------------------------------------------------------------
@written_context depends on !patch && (context || org || report)@
expression e1, e2;
position j0;
@@
* ACCESS_ONCE@j0(e1) = e2
@read_context depends on !patch && (context || org || report)@
expression e1;
position j0;
@@
* ACCESS_ONCE@j0(e1)
// ----------------------------------------------------------------------------
@script:python written_org depends on org@
j0 << written_context.j0;
@@
msg = "Use WRITE_ONCE for an ACCESS_ONCE that is written."
coccilib.org.print_todo(j0[0], msg, color="ovl-face2")
@script:python read_org depends on org@
j0 << read_context.j0;
@@
msg = "Use READ_ONCE for an ACCESS_ONCE that is read."
coccilib.org.print_todo(j0[0], msg)
// ----------------------------------------------------------------------------
@script:python written_report depends on report@
j0 << written_context.j0;
@@
msg = "Use WRITE_ONCE for an ACCESS_ONCE that is written."
coccilib.report.print_report(j0[0], msg)
@script:python read_report depends on report@
j0 << read_context.j0;
@@
msg = "Use READ_ONCE for an ACCESS_ONCE that is read."
coccilib.report.print_report(j0[0], msg)
next prev parent reply other threads:[~2016-04-17 11:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-16 17:34 [PATCH -next] kernel: Replace ACCESS_ONCE with READ/WRITE_ONCE Davidlohr Bueso
2016-04-16 19:04 ` [PATCH] checkpatch: Whine about ACCESS_ONCE Joe Perches
2016-04-16 19:48 ` Joe Perches
2016-04-17 5:43 ` Julia Lawall
2016-04-17 8:27 ` Joe Perches
2016-04-17 11:17 ` Julia Lawall
2016-04-17 11:39 ` Julia Lawall [this message]
2016-04-17 16:02 ` Joe Perches
[not found] ` <alpine.DEB.2.02.1604171944500.2004@localhost6.localdomain6>
[not found] ` <1460915801.19090.100.camel@perches.com>
[not found] ` <alpine.DEB.2.02.1604172001410.2004@localhost6.localdomain6>
2016-04-19 19:12 ` coccinelle: bool if (foo) return true; else return false; Joe Perches
2016-04-19 19:15 ` Julia Lawall
2016-04-20 7:19 ` [Cocci] " Michael Stefaniuc
2016-04-20 7:25 ` Joe Perches
2016-04-17 17:26 ` [PATCH V2] checkpatch: Whine about ACCESS_ONCE Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1604171337450.2034@localhost6.localdomain6 \
--to=julia.lawall@lip6.fr \
--cc=akpm@linux-foundation.org \
--cc=apw@shadowen.org \
--cc=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®