From: David Gibson <david@gibson.dropbear.id.au>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/9] address_space_write_continue: Distill common code
Date: Fri, 8 Jul 2016 13:38:06 +1000 [thread overview]
Message-ID: <20160708033806.GA14675@voom.fritz.box> (raw)
In-Reply-To: <1467934423-5997-5-git-send-email-andrew.smirnov@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2975 bytes --]
On Thu, Jul 07, 2016 at 04:33:38PM -0700, Andrey Smirnov wrote:
> Move call to memory_region_dispatch_write() outside of swtich statement
> since the only thing that is different about all of those call is
> "length" argument and that matches value in "l". Also collapse switch
> statement to occupy less vertical space.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
I'm not a big fan of putting multiple statements on a single line,
especially flow control like break. But apart from that,
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> exec.c | 31 +++++++------------------------
> 1 file changed, 7 insertions(+), 24 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index c26bcea..eea3018 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2566,33 +2566,16 @@ static MemTxResult address_space_write_continue(AddressSpace *as, hwaddr addr,
> /* XXX: could force current_cpu to NULL to avoid
> potential bugs */
> switch (l) {
> - case 8:
> - /* 64 bit write access */
> - val = ldq_p(buf);
> - result |= memory_region_dispatch_write(mr, addr1, val, 8,
> - attrs);
> - break;
> - case 4:
> - /* 32 bit write access */
> - val = ldl_p(buf);
> - result |= memory_region_dispatch_write(mr, addr1, val, 4,
> - attrs);
> - break;
> - case 2:
> - /* 16 bit write access */
> - val = lduw_p(buf);
> - result |= memory_region_dispatch_write(mr, addr1, val, 2,
> - attrs);
> - break;
> - case 1:
> - /* 8 bit write access */
> - val = ldub_p(buf);
> - result |= memory_region_dispatch_write(mr, addr1, val, 1,
> - attrs);
> - break;
> + case 8: val = ldq_p(buf); break; /* 64 bit write access */
> + case 4: val = ldl_p(buf); break; /* 32 bit write access */
> + case 2: val = lduw_p(buf); break; /* 16 bit write access */
> + case 1: val = ldub_p(buf); break; /* 8 bit write access */
> default:
> abort();
> }
> +
> + result |= memory_region_dispatch_write(mr, addr1, val, l,
> + attrs);
> } else {
> /* RAM case */
> ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-07-08 3:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1467934423-5997-1-git-send-email-andrew.smirnov@gmail.com>
[not found] ` <1467934423-5997-2-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:27 ` [Qemu-devel] [PATCH 1/9] Avoid needless calls to address_space_rw() David Gibson
[not found] ` <1467934423-5997-3-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:33 ` [Qemu-devel] [PATCH 2/9] Change signature of address_space_read() to avoid casting David Gibson
[not found] ` <1467934423-5997-4-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:34 ` [Qemu-devel] [PATCH 3/9] Change signature of address_space_write() " David Gibson
[not found] ` <1467934423-5997-5-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:38 ` David Gibson [this message]
2016-07-12 15:28 ` [Qemu-devel] [PATCH 4/9] address_space_write_continue: Distill common code Andrey Smirnov
2016-07-12 15:41 ` Peter Maydell
2016-07-12 16:09 ` Andrey Smirnov
[not found] ` <1467934423-5997-6-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:39 ` [Qemu-devel] [PATCH 5/9] Change signature of cpu_memory_rw_debug() to avoid casting David Gibson
[not found] ` <1467934423-5997-7-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:42 ` [Qemu-devel] [PATCH 6/9] Convert cpu_memory_rw_debug to use MMUAccessType David Gibson
2016-07-10 19:32 ` Peter Maydell
2016-07-11 2:24 ` David Gibson
2016-07-11 16:27 ` Peter Maydell
2016-07-12 5:27 ` David Gibson
2016-07-12 16:05 ` Andrey Smirnov
2016-07-13 0:54 ` David Gibson
2016-07-13 9:52 ` Peter Maydell
2016-07-13 17:09 ` Andrey Smirnov
[not found] ` <1467934423-5997-8-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:45 ` [Qemu-devel] [PATCH 7/9] Convert address_space_rw " David Gibson
2016-07-12 15:41 ` Andrey Smirnov
[not found] ` <1467934423-5997-9-git-send-email-andrew.smirnov@gmail.com>
2016-07-08 3:46 ` [Qemu-devel] [PATCH 8/9] gdbstub: Convert target_memory_rw_debug " 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=20160708033806.GA14675@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=andrew.smirnov@gmail.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.