From nobody Sun Oct 26 01:38:40 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151612753038964.99879388265526; Tue, 16 Jan 2018 10:32:10 -0800 (PST) Received: from localhost ([::1]:53825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebW1n-0001A5-E5 for importer@patchew.org; Tue, 16 Jan 2018 13:32:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebVeH-0006OL-Pc for qemu-devel@nongnu.org; Tue, 16 Jan 2018 13:07:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebVeG-0005Hv-Qe for qemu-devel@nongnu.org; Tue, 16 Jan 2018 13:07:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47888) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ebVeG-0005HR-KW for qemu-devel@nongnu.org; Tue, 16 Jan 2018 13:07:48 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8F7960153 for ; Tue, 16 Jan 2018 18:07:47 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-47.ams2.redhat.com [10.36.117.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9780B60FB4; Tue, 16 Jan 2018 18:06:43 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, mst@redhat.com, imammedo@redhat.com Date: Tue, 16 Jan 2018 18:04:07 +0000 Message-Id: <20180116180408.11279-7-dgilbert@redhat.com> In-Reply-To: <20180116180408.11279-1-dgilbert@redhat.com> References: <20180116180408.11279-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 16 Jan 2018 18:07:47 +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 v6 6/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 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 | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 37509c489b..0c7ae94e6d 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -554,8 +554,9 @@ static void vhost_region_add_section(struct vhost_dev *= dev, } } =20 -static void vhost_region_add(MemoryListener *listener, - MemoryRegionSection *section) +/* 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, memory_listener); @@ -566,29 +567,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); @@ -1157,9 +1135,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