aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2017-10-16 16:43:02 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2017-10-18 10:15:00 +0200
commit279836f8190fd9d6428324414ee802c38c09fbc5 (patch)
tree68669589504e0c68ed2f9279bcb1f19357a4281f
parenta6ffc4232ab649ea91bd951f8c4f9cc598a66fd6 (diff)
memory: reuse section_from_flat_range()
We can use section_from_flat_range() instead of manually initializing. Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20171016144302.24284-8-david@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--memory.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/memory.c b/memory.c
index 3e1558a031..e26e5a3b1d 100644
--- a/memory.c
+++ b/memory.c
@@ -2599,14 +2599,8 @@ static void listener_add_address_space(MemoryListener *listener,
view = address_space_get_flatview(as);
FOR_EACH_FLAT_RANGE(fr, view) {
- MemoryRegionSection section = {
- .mr = fr->mr,
- .fv = view,
- .offset_within_region = fr->offset_in_region,
- .size = fr->addr.size,
- .offset_within_address_space = int128_get64(fr->addr.start),
- .readonly = fr->readonly,
- };
+ MemoryRegionSection section = section_from_flat_range(fr, view);
+
if (listener->region_add) {
listener->region_add(listener, &section);
}