lance: replace PROP_PTR with PROP_LINK

The device remains non-user creatable since it is a sysbus device.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
Marc-André Lureau 2019-10-17 17:31:48 +02:00
parent 0fe4bb3241
commit 4cc76287d8
4 changed files with 5 additions and 6 deletions

View File

@ -346,7 +346,7 @@ static void sparc32_ledma_device_realize(DeviceState *dev, Error **errp)
d = qdev_create(NULL, TYPE_LANCE);
object_property_add_child(OBJECT(dev), "lance", OBJECT(d), errp);
qdev_set_nic_properties(d, nd);
qdev_prop_set_ptr(d, "dma", dev);
object_property_set_link(OBJECT(d), OBJECT(dev), "dma", errp);
qdev_init_nofail(d);
}

View File

@ -138,7 +138,8 @@ static void lance_instance_init(Object *obj)
}
static Property lance_properties[] = {
DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
DEFINE_PROP_LINK("dma", SysBusPCNetState, state.dma_opaque,
TYPE_DEVICE, DeviceState *),
DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf),
DEFINE_PROP_END_OF_LIST(),
};
@ -153,8 +154,6 @@ static void lance_class_init(ObjectClass *klass, void *data)
dc->reset = lance_reset;
dc->vmsd = &vmstate_lance;
dc->props = lance_properties;
/* Reason: pointer property "dma" */
dc->user_creatable = false;
}
static const TypeInfo lance_info = {

View File

@ -231,7 +231,7 @@ static void pci_pcnet_realize(PCIDevice *pci_dev, Error **errp)
s->irq = pci_allocate_irq(pci_dev);
s->phys_mem_read = pci_physical_memory_read;
s->phys_mem_write = pci_physical_memory_write;
s->dma_opaque = pci_dev;
s->dma_opaque = DEVICE(pci_dev);
pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info);
}

View File

@ -50,7 +50,7 @@ struct PCNetState_st {
uint8_t *buf, int len, int do_bswap);
void (*phys_mem_write)(void *dma_opaque, hwaddr addr,
uint8_t *buf, int len, int do_bswap);
void *dma_opaque;
DeviceState *dma_opaque;
int tx_busy;
int looptest;
};