From: Cornelia Huck <cohuck@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Alexander Graf <agraf@suse.de>,
Richard Henderson <rth@twiddle.net>,
David Hildenbrand <david@redhat.com>,
Thomas Huth <thuth@redhat.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
Cornelia Huck <cohuck@redhat.com>
Subject: [Qemu-devel] [PULL 07/19] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
Date: Wed, 29 Aug 2018 11:41:31 +0200 [thread overview]
Message-ID: <20180829094143.2102-8-cohuck@redhat.com> (raw)
In-Reply-To: <20180829094143.2102-1-cohuck@redhat.com>
From: Thomas Huth <thuth@redhat.com>
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 a common unrealize function, just like
it is already done for the realize functions.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1532521224-27235-2-git-send-email-thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
hw/s390x/virtio-ccw.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 2713b7feaa..8de797743f 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -747,11 +747,16 @@ out_err:
g_free(sch);
}
-static void virtio_ccw_unrealize(VirtioCcwDevice *dev, Error **errp)
+static void virtio_ccw_device_unrealize(VirtioCcwDevice *dev, Error **errp)
{
+ VirtIOCCWDeviceClass *dc = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
CcwDevice *ccw_dev = CCW_DEVICE(dev);
SubchDev *sch = ccw_dev->sch;
+ if (dc->unrealize) {
+ dc->unrealize(dev, errp);
+ }
+
if (sch) {
css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL);
g_free(sch);
@@ -1346,7 +1351,6 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_net_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_net_properties;
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
}
@@ -1373,7 +1377,6 @@ static void virtio_ccw_blk_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_blk_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_blk_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1400,7 +1403,6 @@ static void virtio_ccw_serial_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_serial_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_serial_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
@@ -1427,7 +1429,6 @@ static void virtio_ccw_balloon_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_balloon_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_balloon_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1454,7 +1455,6 @@ static void virtio_ccw_scsi_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_scsi_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_scsi_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1480,7 +1480,6 @@ static void vhost_ccw_scsi_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = vhost_ccw_scsi_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = vhost_ccw_scsi_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@@ -1516,7 +1515,6 @@ static void virtio_ccw_rng_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_rng_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_rng_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1553,7 +1551,6 @@ static void virtio_ccw_crypto_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_crypto_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_crypto_properties;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
@@ -1590,7 +1587,6 @@ static void virtio_ccw_gpu_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_gpu_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_gpu_properties;
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
@@ -1618,7 +1614,6 @@ static void virtio_ccw_input_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = virtio_ccw_input_realize;
- k->unrealize = virtio_ccw_unrealize;
dc->props = virtio_ccw_input_properties;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
@@ -1700,9 +1695,8 @@ static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)
static void virtio_ccw_busdev_unrealize(DeviceState *dev, Error **errp)
{
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
- VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
- _info->unrealize(_dev, errp);
+ virtio_ccw_device_unrealize(_dev, errp);
}
static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,
@@ -1798,7 +1792,6 @@ static void virtio_ccw_9p_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
- k->unrealize = virtio_ccw_unrealize;
k->realize = virtio_ccw_9p_realize;
dc->props = virtio_ccw_9p_properties;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
@@ -1844,7 +1837,6 @@ static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
k->realize = vhost_vsock_ccw_realize;
- k->unrealize = virtio_ccw_unrealize;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
dc->props = vhost_vsock_ccw_properties;
}
--
2.14.4
next prev parent reply other threads:[~2018-08-29 9:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 9:41 [Qemu-devel] [PULL 00/19] next batch of s390x changes Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 01/19] tests/tcg: add a simple s390x test Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 02/19] target/s390x: add BAL and BALR instructions Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 03/19] target/s390x: fix CSST decoding and runtime alignment check Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 04/19] target/s390x: fix IPM polluting irrelevant bits Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 05/19] target/s390x: add EX support for TRT and TRTR Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 06/19] target/s390x: fix PACK reading 1 byte less and writing 1 byte more Cornelia Huck
2018-08-29 9:41 ` Cornelia Huck [this message]
2018-08-29 9:41 ` [Qemu-devel] [PULL 08/19] hw/s390x: Move virtio-ccw-serial code to a separate file Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 09/19] hw/s390x: Move virtio-ccw-balloon " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 10/19] hw/s390x: Move virtio-ccw-scsi " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 11/19] hw/s390x: Move virtio-ccw-rng " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 12/19] hw/s390x: Move virtio-ccw-9p " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 13/19] hw/s390x: Move virtio-ccw-crypto " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 14/19] hw/s390x: Move vhost-vsock-ccw " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 15/19] hw/s390x: Move virtio-ccw-gpu " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 16/19] hw/s390x: Move virtio-ccw-input " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 17/19] hw/s390x: Move virtio-ccw-net " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 18/19] hw/s390x: Move virtio-ccw-blk " Cornelia Huck
2018-08-29 9:41 ` [Qemu-devel] [PULL 19/19] target/s390x: use regular spaces in translate.c Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180829094143.2102-8-cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).