From nobody Tue Feb 10 06:05:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508165280744404.90673901417404; Mon, 16 Oct 2017 07:48:00 -0700 (PDT) Received: from localhost ([::1]:33320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e46gQ-0000Gr-Jq for importer@patchew.org; Mon, 16 Oct 2017 10:47:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e46c8-00059G-2N for qemu-devel@nongnu.org; Mon, 16 Oct 2017 10:43:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e46c6-0005uE-Rv for qemu-devel@nongnu.org; Mon, 16 Oct 2017 10:43:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55528) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e46c6-0005tr-LD for qemu-devel@nongnu.org; Mon, 16 Oct 2017 10:43:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A26712579B; Mon, 16 Oct 2017 14:43:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-221.ams2.redhat.com [10.36.116.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 631625E1A1; Mon, 16 Oct 2017 14:43:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A26712579B Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 16:43:02 +0200 Message-Id: <20171016144302.24284-8-david@redhat.com> In-Reply-To: <20171016144302.24284-1-david@redhat.com> References: <20171016144302.24284-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 16 Oct 2017 14:43:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 7/7] memory: reuse section_from_flat_range() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Thomas Huth , David Hildenbrand , Joe Clifford Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We can use section_from_flat_range() instead of manually initializing. Signed-off-by: David Hildenbrand --- memory.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/memory.c b/memory.c index f39b8592bf..7c8e5878d6 100644 --- a/memory.c +++ b/memory.c @@ -2599,14 +2599,8 @@ static void listener_add_address_space(MemoryListene= r *listener, =20 view =3D address_space_get_flatview(as); FOR_EACH_FLAT_RANGE(fr, view) { - MemoryRegionSection section =3D { - .mr =3D fr->mr, - .fv =3D view, - .offset_within_region =3D fr->offset_in_region, - .size =3D fr->addr.size, - .offset_within_address_space =3D int128_get64(fr->addr.start), - .readonly =3D fr->readonly, - }; + MemoryRegionSection section =3D section_from_flat_range(fr, view); + if (listener->region_add) { listener->region_add(listener, §ion); } --=20 2.13.5