Signed-off-by: Markus Armbruster <arm...@redhat.com> --- hw/ide/core.c | 2 +- hw/ide/internal.h | 3 +-- hw/ide/qdev.c | 12 +++--------- 3 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c index 2c0c978..1e94dc4 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -79,7 +79,7 @@ static void ide_identify(IDEState *s) { uint16_t *p; unsigned int oldsize; - IDEDevice *dev = s->unit ? s->bus->slave : s->bus->master; + IDEDevice *dev = s->dev; if (s->identify_set) { memcpy(s->io_buffer, s->identify_data, sizeof(s->identify_data)); diff --git a/hw/ide/internal.h b/hw/ide/internal.h index bf7d313..52d1642 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -342,6 +342,7 @@ enum ide_dma_cmd { /* NOTE: IDEState represents in fact one drive */ struct IDEState { IDEBus *bus; + IDEDevice *dev; uint8_t unit; /* ide config */ IDEDriveKind drive_kind; @@ -447,8 +448,6 @@ struct IDEDMA { struct IDEBus { BusState qbus; - IDEDevice *master; - IDEDevice *slave; IDEState ifs[2]; int bus_id; IDEDMA *dma; diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index f2e4ea4..e322aea 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -74,22 +74,16 @@ static int ide_qdev_init(DeviceState *qdev) goto err; } if (dev->unit == -1) { - dev->unit = bus->master ? 1 : 0; + dev->unit = bus->ifs[0].dev ? 1 : 0; } switch (dev->unit) { case 0: - if (bus->master) { - error_report("IDE unit %d is in use", dev->unit); - goto err; - } - bus->master = dev; - break; case 1: - if (bus->slave) { + if (bus->ifs[dev->unit].dev) { error_report("IDE unit %d is in use", dev->unit); goto err; } - bus->slave = dev; + bus->ifs[dev->unit].dev = dev; break; default: error_report("Invalid IDE unit %d", dev->unit); -- 1.7.11.7