From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wk9t8-0000q0-8S for qemu-devel@nongnu.org; Tue, 13 May 2014 06:24:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wk9t3-0005aF-5m for qemu-devel@nongnu.org; Tue, 13 May 2014 06:24:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wk9t2-0005a9-UR for qemu-devel@nongnu.org; Tue, 13 May 2014 06:24:41 -0400 Message-ID: <5371F2E4.9010509@redhat.com> Date: Tue, 13 May 2014 12:24:36 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <3d7c5a7e41ccdaba646a79ca651fde44b270a652.1399882085.git.peter.crosthwaite@xilinx.com> In-Reply-To: <3d7c5a7e41ccdaba646a79ca651fde44b270a652.1399882085.git.peter.crosthwaite@xilinx.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH memory v1 1/1] memory: Simplify mr_add_subregion() if-else List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , qemu-devel@nongnu.org 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 > --- > > 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