virtio-scsi: cleanup: init and exit functions.

This remove old init and exit function as they are no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1363875320-7985-10-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
KONRAD Frederic 2013-03-21 15:15:19 +01:00 committed by Anthony Liguori
parent 0ac8e13927
commit 763684befd

View File

@ -692,35 +692,19 @@ static struct SCSIBusInfo virtio_scsi_scsi_info = {
.load_request = virtio_scsi_load_request, .load_request = virtio_scsi_load_request,
}; };
static VirtIODevice *virtio_scsi_common_init(DeviceState *dev, static int virtio_scsi_device_init(VirtIODevice *vdev)
VirtIOSCSIConf *proxyconf,
VirtIOSCSI **ps)
{ {
VirtIOSCSI *s = *ps; DeviceState *qdev = DEVICE(vdev);
VirtIODevice *vdev = VIRTIO_DEVICE(s); VirtIOSCSI *s = VIRTIO_SCSI(vdev);
static int virtio_scsi_id; static int virtio_scsi_id;
int i; int i;
/* virtio_init(VIRTIO_DEVICE(s), "virtio-scsi", VIRTIO_ID_SCSI,
* We have two cases here: the old virtio-scsi-pci device, and the sizeof(VirtIOSCSIConfig));
* refactored virtio-scsi.
*/
if (s == NULL) { s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));
/* virtio-scsi-pci */
s = (VirtIOSCSI *)virtio_common_init("virtio-scsi", VIRTIO_ID_SCSI,
sizeof(VirtIOSCSIConfig),
sizeof(VirtIOSCSI));
} else {
/* virtio-scsi */
virtio_init(VIRTIO_DEVICE(s), "virtio-scsi", VIRTIO_ID_SCSI,
sizeof(VirtIOSCSIConfig));
}
s->cmd_vqs = g_malloc0(proxyconf->num_queues * sizeof(VirtQueue *)); s->qdev = qdev;
s->qdev = dev;
s->conf = *proxyconf;
/* TODO set up vdev function pointers */ /* TODO set up vdev function pointers */
vdev->get_config = virtio_scsi_get_config; vdev->get_config = virtio_scsi_get_config;
@ -737,38 +721,14 @@ static VirtIODevice *virtio_scsi_common_init(DeviceState *dev,
virtio_scsi_handle_cmd); virtio_scsi_handle_cmd);
} }
scsi_bus_new(&s->bus, dev, &virtio_scsi_scsi_info); scsi_bus_new(&s->bus, qdev, &virtio_scsi_scsi_info);
if (!dev->hotplugged) { if (!qdev->hotplugged) {
scsi_bus_legacy_handle_cmdline(&s->bus); scsi_bus_legacy_handle_cmdline(&s->bus);
} }
register_savevm(dev, "virtio-scsi", virtio_scsi_id++, 1, register_savevm(qdev, "virtio-scsi", virtio_scsi_id++, 1,
virtio_scsi_save, virtio_scsi_load, s); virtio_scsi_save, virtio_scsi_load, s);
return vdev;
}
VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf)
{
VirtIOSCSI *s = NULL;
return virtio_scsi_common_init(dev, proxyconf, &s);
}
void virtio_scsi_exit(VirtIODevice *vdev)
{
VirtIOSCSI *s = (VirtIOSCSI *)vdev;
unregister_savevm(s->qdev, "virtio-scsi", s);
g_free(s->cmd_vqs);
virtio_cleanup(vdev);
}
static int virtio_scsi_device_init(VirtIODevice *vdev)
{
DeviceState *qdev = DEVICE(vdev);
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
if (virtio_scsi_common_init(qdev, &(s->conf), &s) == NULL) {
return -1;
}
return 0; return 0;
} }