[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/11] memory: Simplify mr_add_subregion() if-else
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/11] memory: Simplify mr_add_subregion() if-else |
Date: |
Wed, 18 Jun 2014 15:42:02 +0200 |
From: Peter Crosthwaite <address@hidden>
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 <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
memory.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/memory.c b/memory.c
index 829d56d..3811bd1 100644
--- a/memory.c
+++ b/memory.c
@@ -1514,8 +1514,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;
@@ -1525,11 +1523,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();
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/11] Memory API changes for 2014-06-18, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 01/11] MAINTAINERS: Add myself as Memory API maintainer, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 02/11] exec: introduce qemu_ram_unset_idstr() to unset RAMBlock idstr, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 05/11] memory: Simplify mr_add_subregion() if-else,
Paolo Bonzini <=
- [Qemu-devel] [PULL 06/11] exec: dummy_section: Pass address space through., Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 09/11] memory: MemoryRegion: factor out memory region re-adder, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 08/11] memory: MemoryRegion: factor out subregion add functionality, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 07/11] qtest: fix qtest_clock_warp() for no deadline case, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 10/11] memory: MemoryRegion: rename parent to container, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 11/11] memory: Don't call memory_region_update_coalesced_range if nothing changed, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 03/11] unset RAMBlock idstr when unregister MemoryRegion, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 04/11] memory: Don't update all memory region when ioeventfd changed, Paolo Bonzini, 2014/06/18
- Re: [Qemu-devel] [PULL 00/11] Memory API changes for 2014-06-18, Peter Maydell, 2014/06/18