qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v2] Avoid address_space_rw() with a constant is_write argument
Date: Tue, 18 Feb 2020 07:33:21 -0600	[thread overview]
Message-ID: <08b37e02-49b5-1485-aa71-83ead1adf407@redhat.com> (raw)
In-Reply-To: <f87dbeeb-2259-9eb9-45c7-a30819eec2ee@redhat.com>

On 2/18/20 6:56 AM, Philippe Mathieu-Daudé wrote:

>> +++ b/scripts/coccinelle/as_rw_const.cocci
>> @@ -0,0 +1,30 @@
>> +// Avoid uses of address_space_rw() with a constant is_write argument.
>> +// Usage:
>> +//  spatch --sp-file as-rw-const.spatch --dir . --in-place
> 
> Nitpick, script is now scripts/coccinelle/as_rw_const.cocci.
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
>> +
>> +@@
>> +expression E1, E2, E3, E4, E5;
>> +symbol false;
>> +@@
>> +
>> +- address_space_rw(E1, E2, E3, E4, E5, false)
>> ++ address_space_read(E1, E2, E3, E4, E5)
>> +@@
>> +expression E1, E2, E3, E4, E5;
>> +@@
>> +
>> +- address_space_rw(E1, E2, E3, E4, E5, 0)
>> ++ address_space_read(E1, E2, E3, E4, E5)

This feels a bit redundant.  Doesn't coccinelle have enough smarts about 
isomorphisms (such as 0 == false, 1 == true) that it could get by with 
one @@ hunk instead of 2, if we come up with the right way to represent 
any isomorphism to a constant value?  But admittedly, I don't know what 
that representation would actually be, and your verbose patch works even 
if it is not the most concise possible.  So don't let my remarks hold 
this patch up.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2020-02-18 13:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 11:24 [PATCH v2] Avoid address_space_rw() with a constant is_write argument Peter Maydell
2020-02-16 17:24 ` Edgar E. Iglesias
2020-02-18 12:56 ` Philippe Mathieu-Daudé
2020-02-18 13:33   ` Eric Blake [this message]
2020-02-18 13:41     ` Peter Maydell
2020-02-20  9:27   ` Philippe Mathieu-Daudé
2020-02-18 13:13 ` Laurent Vivier
2020-02-18 13:20   ` Peter Maydell
2020-02-20 11:28   ` Paolo Bonzini
2020-02-18 13:30 ` Cédric Le Goater
2020-02-18 14:54 ` Christian Borntraeger
2020-02-18 17:34 ` Cornelia Huck
2020-02-18 22:30 ` Alistair Francis
2020-02-18 23:00 ` David Gibson

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=08b37e02-49b5-1485-aa71-83ead1adf407@redhat.com \
    --to=eblake@redhat.com \
    --cc=alistair@alistair23.me \
    --cc=borntraeger@de.ibm.com \
    --cc=clg@kaod.org \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).