Skip to content

Commit

Permalink
scsi/esp-pci: QOM Upcast Sweep
Browse files Browse the repository at this point in the history
Define and use standard QOM cast macro. Remove usages of DO_UPCAST()
and direct -> style upcasting.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
pete128 authored and afaerber committed Jul 22, 2013
1 parent 52190c1 commit 3a15eff
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions hw/scsi/esp-pci.c
Expand Up @@ -31,6 +31,9 @@

#define TYPE_AM53C974_DEVICE "am53c974"

#define PCI_ESP(obj) \
OBJECT_CHECK(PCIESPState, (obj), TYPE_AM53C974_DEVICE)

#define DMA_CMD 0x0
#define DMA_STC 0x1
#define DMA_SPA 0x2
Expand Down Expand Up @@ -288,7 +291,7 @@ static const MemoryRegionOps esp_pci_io_ops = {

static void esp_pci_hard_reset(DeviceState *dev)
{
PCIESPState *pci = DO_UPCAST(PCIESPState, dev.qdev, dev);
PCIESPState *pci = PCI_ESP(dev);
esp_hard_reset(&pci->esp);
pci->dma_regs[DMA_CMD] &= ~(DMA_CMD_DIR | DMA_CMD_INTE_D | DMA_CMD_INTE_P
| DMA_CMD_MDL | DMA_CMD_DIAG | DMA_CMD_MASK);
Expand Down Expand Up @@ -336,7 +339,8 @@ static const struct SCSIBusInfo esp_pci_scsi_info = {

static int esp_pci_scsi_init(PCIDevice *dev)
{
PCIESPState *pci = DO_UPCAST(PCIESPState, dev, dev);
PCIESPState *pci = PCI_ESP(dev);
DeviceState *d = DEVICE(dev);
ESPState *s = &pci->esp;
uint8_t *pci_conf;

Expand All @@ -355,16 +359,16 @@ static int esp_pci_scsi_init(PCIDevice *dev)
pci_register_bar(&pci->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &pci->io);
s->irq = pci->dev.irq[0];

scsi_bus_new(&s->bus, &dev->qdev, &esp_pci_scsi_info, NULL);
if (!dev->qdev.hotplugged) {
scsi_bus_new(&s->bus, d, &esp_pci_scsi_info, NULL);
if (!d->hotplugged) {
return scsi_bus_legacy_handle_cmdline(&s->bus);
}
return 0;
}

static void esp_pci_scsi_uninit(PCIDevice *d)
{
PCIESPState *pci = DO_UPCAST(PCIESPState, dev, d);
PCIESPState *pci = PCI_ESP(d);

memory_region_destroy(&pci->io);
}
Expand Down

0 comments on commit 3a15eff

Please sign in to comment.