From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH memory v1 1/1] memory: Simplify mr_add_subregion() if-else
Date: Tue, 13 May 2014 12:24:36 +0200 [thread overview]
Message-ID: <5371F2E4.9010509@redhat.com> (raw)
In-Reply-To: <3d7c5a7e41ccdaba646a79ca651fde44b270a652.1399882085.git.peter.crosthwaite@xilinx.com>
Il 12/05/2014 10:13, Peter Crosthwaite ha scritto:
> This if else is not needed. The previous call to memory_region_add
> (whether _overlap or not) will always set priority and may_overlap
> to desired values. And its not possible to get here without having
> called memory_region_add_subregion due to the null guard on parent.
> So we can just directly call memory_region_add_subregion_common.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>
> memory.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/memory.c b/memory.c
> index 3f1df23..1352881 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1501,8 +1501,6 @@ void memory_region_set_enabled(MemoryRegion *mr, bool enabled)
> void memory_region_set_address(MemoryRegion *mr, hwaddr addr)
> {
> MemoryRegion *parent = mr->parent;
> - int priority = mr->priority;
> - bool may_overlap = mr->may_overlap;
>
> if (addr == mr->addr || !parent) {
> mr->addr = addr;
> @@ -1512,11 +1510,7 @@ void memory_region_set_address(MemoryRegion *mr, hwaddr addr)
> memory_region_transaction_begin();
> memory_region_ref(mr);
> memory_region_del_subregion(parent, mr);
> - if (may_overlap) {
> - memory_region_add_subregion_overlap(parent, addr, mr, priority);
> - } else {
> - memory_region_add_subregion(parent, addr, mr);
> - }
> + memory_region_add_subregion_common(parent, addr, mr);
> memory_region_unref(mr);
> memory_region_transaction_commit();
> }
>
Thanks, I'll include this in the next memory pull request.
Paolo
prev parent reply other threads:[~2014-05-13 10:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 8:13 [Qemu-devel] [PATCH memory v1 1/1] memory: Simplify mr_add_subregion() if-else Peter Crosthwaite
2014-05-13 10:24 ` Paolo Bonzini [this message]
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=5371F2E4.9010509@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.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 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).