Patchwork [15/22] lsi53c895a: LSIState is a PCIDevice is a DeviceHost

login
register
mail settings
Submitter Juan Quintela
Date Aug. 24, 2009, 11:03 a.m.
Message ID <fa76988bd7dcb5235eb823929ff351af66191f6d.1251111439.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/31916/
State Superseded
Headers show

Comments

Juan Quintela - Aug. 24, 2009, 11:03 a.m.
Go figure.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/lsi53c895a.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Gerd Hoffmann - Aug. 24, 2009, 12:44 p.m.
>   void lsi_scsi_attach(DeviceState *host, BlockDriverState *bd, int id)
>   {
> -    LSIState *s = (LSIState *)host;
> +    PCIDevice *d = DO_UPCAST(PCIDevice, qdev, host);
> +    LSIState *s = DO_UPCAST(LSIState, dev, d);

LSIState *s = DO_UPCAST(LSIState, dev.qdev, host);

cheers,
   Gerd

Patch

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index d154b23..2db3245 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -1960,7 +1960,8 @@  static void lsi_mmio_mapfunc(PCIDevice *pci_dev, int region_num,

 void lsi_scsi_attach(DeviceState *host, BlockDriverState *bd, int id)
 {
-    LSIState *s = (LSIState *)host;
+    PCIDevice *d = DO_UPCAST(PCIDevice, qdev, host);
+    LSIState *s = DO_UPCAST(LSIState, dev, d);

     if (id < 0) {
         for (id = 0; id < LSI_MAX_DEVS; id++) {