From nobody Wed Nov 5 00:12:27 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532357069924308.1435460498394; Mon, 23 Jul 2018 07:44:29 -0700 (PDT) Received: from localhost ([::1]:34981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhc4a-0000Pu-QE for importer@patchew.org; Mon, 23 Jul 2018 10:44:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhc2q-0007xz-3w for qemu-devel@nongnu.org; Mon, 23 Jul 2018 10:42:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhc2n-0008TD-1g for qemu-devel@nongnu.org; Mon, 23 Jul 2018 10:42:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35376 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fhc2m-0008Sv-Rz; Mon, 23 Jul 2018 10:42:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56AFE818F021; Mon, 23 Jul 2018 14:42:36 +0000 (UTC) Received: from thh440s.str.redhat.com (dhcp-200-180.str.redhat.com [10.33.200.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADC59111CD37; Mon, 23 Jul 2018 14:42:31 +0000 (UTC) From: Thomas Huth To: Cornelia Huck , David Hildenbrand , qemu-s390x@nongnu.org Date: Mon, 23 Jul 2018 16:42:31 +0200 Message-Id: <1532356951-18210-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 23 Jul 2018 14:42:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 23 Jul 2018 14:42:36 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [RFC PATCH] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize() 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: qemu-devel@nongnu.org, Christian Borntraeger , Richard Henderson , Alexander Graf , "Michael S. Tsirkin" 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" Currently, every virtio-ccw device explicitely sets its unrealize function to virtio_ccw_unrealize() in its class_init function. We can simplify this by using this unrealize function in the common virtio_ccw_busdev_unrealize() function if no other device unrealize function has been set. Signed-off-by: Thomas Huth --- hw/s390x/virtio-ccw.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 7ddb378..3cf45ff 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1349,7 +1349,6 @@ static void virtio_ccw_net_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_net_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_net_properties; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); } @@ -1376,7 +1375,6 @@ static void virtio_ccw_blk_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_blk_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_blk_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -1403,7 +1401,6 @@ static void virtio_ccw_serial_class_init(ObjectClass = *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_serial_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_serial_properties; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -1430,7 +1427,6 @@ static void virtio_ccw_balloon_class_init(ObjectClass= *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_balloon_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_balloon_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } @@ -1457,7 +1453,6 @@ static void virtio_ccw_scsi_class_init(ObjectClass *k= lass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_scsi_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -1483,7 +1478,6 @@ static void vhost_ccw_scsi_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D vhost_ccw_scsi_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D vhost_ccw_scsi_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } @@ -1519,7 +1513,6 @@ static void virtio_ccw_rng_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_rng_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_rng_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } @@ -1556,7 +1549,6 @@ static void virtio_ccw_crypto_class_init(ObjectClass = *klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_crypto_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_crypto_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); } @@ -1593,7 +1585,6 @@ static void virtio_ccw_gpu_class_init(ObjectClass *kl= ass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_gpu_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_gpu_properties; dc->hotpluggable =3D false; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); @@ -1621,7 +1612,6 @@ static void virtio_ccw_input_class_init(ObjectClass *= klass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D virtio_ccw_input_realize; - k->unrealize =3D virtio_ccw_unrealize; dc->props =3D virtio_ccw_input_properties; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -1705,7 +1695,11 @@ static void virtio_ccw_busdev_unrealize(DeviceState = *dev, Error **errp) VirtioCcwDevice *_dev =3D (VirtioCcwDevice *)dev; VirtIOCCWDeviceClass *_info =3D VIRTIO_CCW_DEVICE_GET_CLASS(dev); =20 - _info->unrealize(_dev, errp); + if (_info->unrealize) { + _info->unrealize(_dev, errp); + } else { + virtio_ccw_unrealize(_dev, errp); + } } =20 static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev, @@ -1801,7 +1795,6 @@ static void virtio_ccw_9p_class_init(ObjectClass *kla= ss, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 - k->unrealize =3D virtio_ccw_unrealize; k->realize =3D virtio_ccw_9p_realize; dc->props =3D virtio_ccw_9p_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); @@ -1847,7 +1840,6 @@ static void vhost_vsock_ccw_class_init(ObjectClass *k= lass, void *data) VirtIOCCWDeviceClass *k =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->realize =3D vhost_vsock_ccw_realize; - k->unrealize =3D virtio_ccw_unrealize; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->props =3D vhost_vsock_ccw_properties; } --=20 1.8.3.1