[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 051/197] drop info link in SCSIDeviceInfo
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH v3 051/197] drop info link in SCSIDeviceInfo |
Date: |
Mon, 12 Dec 2011 14:18:47 -0600 |
---
hw/scsi-bus.c | 26 ++++++++++++++++----------
hw/scsi.h | 1 -
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index a054324..8f0d7e6 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -25,24 +25,30 @@ static int next_scsi_bus;
static int scsi_device_init(SCSIDevice *dev)
{
- if (dev->info->init) {
- return dev->info->init(dev);
+ SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev,
+ qdev_get_info(DEVICE(dev)));
+ if (info->init) {
+ return info->init(dev);
}
return 0;
}
static void scsi_device_destroy(SCSIDevice *s)
{
- if (s->info->destroy) {
- s->info->destroy(s);
+ SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev,
+ qdev_get_info(DEVICE(s)));
+ if (info->destroy) {
+ info->destroy(s);
}
}
static SCSIRequest *scsi_device_alloc_req(SCSIDevice *s, uint32_t tag,
uint32_t lun,
uint8_t *buf, void *hba_private)
{
- if (s->info->alloc_req) {
- return s->info->alloc_req(s, tag, lun, buf, hba_private);
+ SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev,
+ qdev_get_info(DEVICE(s)));
+ if (info->alloc_req) {
+ return info->alloc_req(s, tag, lun, buf, hba_private);
}
return NULL;
@@ -50,8 +56,10 @@ static SCSIRequest *scsi_device_alloc_req(SCSIDevice *s,
uint32_t tag, uint32_t
static void scsi_device_unit_attention_reported(SCSIDevice *s)
{
- if (s->info->unit_attention_reported) {
- s->info->unit_attention_reported(s);
+ SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev,
+ qdev_get_info(DEVICE(s)));
+ if (info->unit_attention_reported) {
+ info->unit_attention_reported(s);
}
}
@@ -114,7 +122,6 @@ static void scsi_dma_restart_cb(void *opaque, int running,
RunState state)
static int scsi_qdev_init(DeviceState *qdev, DeviceInfo *base)
{
SCSIDevice *dev = SCSI_DEVICE(qdev);
- SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev, base);
SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus);
SCSIDevice *d;
int rc = -1;
@@ -158,7 +165,6 @@ static int scsi_qdev_init(DeviceState *qdev, DeviceInfo
*base)
}
}
- dev->info = info;
QTAILQ_INIT(&dev->requests);
rc = scsi_device_init(dev);
if (rc == 0) {
diff --git a/hw/scsi.h b/hw/scsi.h
index 282cebd..0d24d41 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -77,7 +77,6 @@ struct SCSIDevice
QEMUBH *bh;
uint32_t id;
BlockConf conf;
- SCSIDeviceInfo *info;
SCSISense unit_attention;
bool sense_is_ua;
uint8_t sense[SCSI_SENSE_BUF_SIZE];
--
1.7.4.1
- [Qemu-devel] [PATCH v3 034/197] qdev: add isa-device as a subclass of device, (continued)
- [Qemu-devel] [PATCH v3 034/197] qdev: add isa-device as a subclass of device, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 035/197] isa: more isa stuff, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 036/197] qom: make pcidevice part of the hierarchy, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 039/197] virtio-serial-port, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 040/197] get rid of more DO_UPCAST, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 042/197] isa: move methods from isadeviceinfo to isadeviceclass, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 045/197] usb: get rid of info pointer, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 047/197] usb: use a factory instead of doing silly things for legacy, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 046/197] usb: promote all of the methods for USBDevice to class methods, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 049/197] usb-hid: simply class initialization a bit, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 051/197] drop info link in SCSIDeviceInfo,
Anthony Liguori <=
- [Qemu-devel] [PATCH v3 048/197] usb: kill USBDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 052/197] move methods out of SCSIDeviceInfo into SCSIDeviceClass, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 054/197] get rid of CCIDCardInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 056/197] add I2CSlave to the type hierarchy, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 055/197] rename i2c_slave -> I2CSlave, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 058/197] fixup type registration, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 059/197] kill off SMBusDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 060/197] add guards, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 061/197] killall I2CSlaveInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 064/197] killall VIOsPAPRDeviceInfo, Anthony Liguori, 2011/12/12