From nobody Tue Oct 28 20:56:45 2025 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513628177293595.4589842208512; Mon, 18 Dec 2017 12:16:17 -0800 (PST) Received: from localhost ([::1]:37899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR1pc-0007V1-5w for importer@patchew.org; Mon, 18 Dec 2017 15:16:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR1nX-000674-Dk for qemu-devel@nongnu.org; Mon, 18 Dec 2017 15:14:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eR1nU-0003La-FF for qemu-devel@nongnu.org; Mon, 18 Dec 2017 15:14:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37672) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eR1nU-0003LH-6z for qemu-devel@nongnu.org; Mon, 18 Dec 2017 15:14:00 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7493D61460; Mon, 18 Dec 2017 20:13:59 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-114.ams2.redhat.com [10.36.117.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23790600D4; Mon, 18 Dec 2017 20:13:56 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Date: Mon, 18 Dec 2017 20:13:40 +0000 Message-Id: <20171218201340.27583-8-dgilbert@redhat.com> In-Reply-To: <20171218201340.27583-1-dgilbert@redhat.com> References: <20171218201340.27583-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 18 Dec 2017 20:13:59 +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 v5 7/7] vhost: Merge and delete unused callbacks 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: maxime.coquelin@redhat.com, groug@kaod.org, mst@redhat.com 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" From: "Dr. David Alan Gilbert" Now that the olf vhost_set_memory code is gone, the _nop and _add callbacks are identical and can be merged. The _del callback is no longer needed. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Igor Mammedov --- hw/virtio/vhost.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 358ceb3033..4eaa4f889f 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -555,7 +555,8 @@ static void vhost_region_add_section(struct vhost_dev *= dev, } } =20 -static void vhost_region_add(MemoryListener *listener, +/* Used for both add and nop callbacks */ +static void vhost_region_addnop(MemoryListener *listener, MemoryRegionSection *section) { struct vhost_dev *dev =3D container_of(listener, struct vhost_dev, @@ -567,29 +568,6 @@ static void vhost_region_add(MemoryListener *listener, vhost_region_add_section(dev, section); } =20 -/* Called on regions that have not changed */ -static void vhost_region_nop(MemoryListener *listener, - MemoryRegionSection *section) -{ - struct vhost_dev *dev =3D container_of(listener, struct vhost_dev, - memory_listener); - - if (!vhost_section(section)) { - return; - } - - vhost_region_add_section(dev, section); -} - -static void vhost_region_del(MemoryListener *listener, - MemoryRegionSection *section) -{ - if (!vhost_section(section)) { - return; - } - -} - static void vhost_iommu_unmap_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotl= b) { struct vhost_iommu *iommu =3D container_of(n, struct vhost_iommu, n); @@ -1158,9 +1136,8 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaq= ue, hdev->memory_listener =3D (MemoryListener) { .begin =3D vhost_begin, .commit =3D vhost_commit, - .region_add =3D vhost_region_add, - .region_del =3D vhost_region_del, - .region_nop =3D vhost_region_nop, + .region_add =3D vhost_region_addnop, + .region_nop =3D vhost_region_addnop, .log_start =3D vhost_log_start, .log_stop =3D vhost_log_stop, .log_sync =3D vhost_log_sync, --=20 2.14.3