aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi/esp.c
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2013-07-01 18:18:35 +0800
committerAndreas Färber <afaerber@suse.de>2013-07-23 00:37:35 +0200
commitb09318cac65df015b9b0990791f02b894cc57d33 (patch)
tree1847d02799a7fd670a61630fb2e3f597c0d627a9 /hw/scsi/esp.c
parent563839557c05f6f946bedebc381406b146af61f6 (diff)
scsi/esp: Use QOM realize for scsi esp
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> [AF: Drop sysbus_esp_init()] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/scsi/esp.c')
-rw-r--r--hw/scsi/esp.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 1a2d72ca19..c24b6326ce 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -671,23 +671,27 @@ static void sysbus_esp_gpio_demux(void *opaque, int irq, int level)
}
}
-static int sysbus_esp_init(SysBusDevice *dev)
+static void sysbus_esp_realize(DeviceState *dev, Error **errp)
{
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
SysBusESPState *sysbus = ESP(dev);
ESPState *s = &sysbus->esp;
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(sbd, &s->irq);
assert(sysbus->it_shift != -1);
s->chip_id = TCHI_FAS100A;
memory_region_init_io(&sysbus->iomem, OBJECT(sysbus), &sysbus_esp_mem_ops,
sysbus, "esp", ESP_REGS << sysbus->it_shift);
- sysbus_init_mmio(dev, &sysbus->iomem);
+ sysbus_init_mmio(sbd, &sysbus->iomem);
- qdev_init_gpio_in(&dev->qdev, sysbus_esp_gpio_demux, 2);
+ qdev_init_gpio_in(dev, sysbus_esp_gpio_demux, 2);
- scsi_bus_new(&s->bus, &dev->qdev, &esp_scsi_info, NULL);
- return scsi_bus_legacy_handle_cmdline(&s->bus);
+ scsi_bus_new(&s->bus, dev, &esp_scsi_info, NULL);
+ if (scsi_bus_legacy_handle_cmdline(&s->bus) < 0) {
+ error_setg(errp, "Handling legacy SCSI command line failed");
+ return;
+ }
}
static void sysbus_esp_hard_reset(DeviceState *dev)
@@ -710,9 +714,8 @@ static const VMStateDescription vmstate_sysbus_esp_scsi = {
static void sysbus_esp_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = sysbus_esp_init;
+ dc->realize = sysbus_esp_realize;
dc->reset = sysbus_esp_hard_reset;
dc->vmsd = &vmstate_sysbus_esp_scsi;
}