From: Joe Perches <joe@perches.com>
To: Julia Lawall <julia@diku.dk>
Cc: H Hartley Sweeten <hartleys@visionengravers.com>,
cocci <cocci@diku.dk>,
vinod.koul@intel.com, dan.j.williams@intel.com,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [Cocci] [RFC] Convert "resource->end - resource->start + 1" to resource_size(resource) via coccinelle
Date: Tue, 07 Jun 2011 00:42:27 -0700 [thread overview]
Message-ID: <1307432547.1651.11.camel@Joe-Laptop> (raw)
In-Reply-To: <Pine.LNX.4.64.1106070741510.18329@ask.diku.dk>
On Tue, 2011-06-07 at 07:42 +0200, Julia Lawall wrote:
> On Mon, 6 Jun 2011, Joe Perches wrote:
> > Cocci already handles the parens case
> > "(foo->end-foo->start)+1"
> If you put parentheses, it will consider removing them. But I don't think
> it would go the other way around.
It does.
$ spatch -very_quiet -sp_file resource.cocci t2.c
--- t2.c 2011-06-07 00:37:48.000000000 -0700
+++ /tmp/cocci-output-3529-9bb101-t2.c 2011-06-07 00:38:31.000000000
-0700
@@ -12,7 +12,7 @@ void test_resource(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(array); i++) {
- if ((p[i].end - p[i].start) + 1 > 0x12345)
+ if (resource_size(p) > 0x12345)
printk(KERN_CRIT "Some failure\n");
}
}
next prev parent reply other threads:[~2011-06-07 7:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 20:49 [PATCH] dma: mv_xor: use resource_size() H Hartley Sweeten
2011-06-06 21:52 ` [RFC] Convert "resource->end - resource->start + 1" to resource_size(resource) via coccinelle Joe Perches
2011-06-06 21:57 ` H Hartley Sweeten
2011-06-07 1:04 ` [PATCH] treewide: Convert uses of struct resource * to resource_size(ptr) Joe Perches
2011-06-07 1:26 ` Mike Frysinger
2011-06-07 16:31 ` H Hartley Sweeten
2011-06-07 18:27 ` H Hartley Sweeten
2011-06-07 18:35 ` Joe Perches
2011-06-07 21:29 ` [TRIVIAL PATCH v2] treewide: Convert uses of struct resource " Joe Perches
2011-06-09 12:25 ` Jiri Kosina
2011-06-09 16:09 ` Joe Perches
2011-06-07 5:07 ` [Cocci] [RFC] Convert "resource->end - resource->start + 1" to resource_size(resource) via coccinelle Julia Lawall
2011-06-07 5:32 ` Joe Perches
2011-06-07 5:42 ` Julia Lawall
2011-06-07 7:42 ` Joe Perches [this message]
2011-07-13 22:02 ` [PATCH] dma: mv_xor: use resource_size() Koul, Vinod
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=1307432547.1651.11.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=cocci@diku.dk \
--cc=dan.j.williams@intel.com \
--cc=hartleys@visionengravers.com \
--cc=julia@diku.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=vinod.koul@intel.com \
/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