qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v1 1/1] etraxfs: convert dma_out and dma_in pointer


From: Sukrit Bhatnagar
Subject: [Qemu-devel] [PATCH v1 1/1] etraxfs: convert dma_out and dma_in pointer properties from qdev to qom links
Date: Tue, 19 Mar 2019 06:30:54 +0530

The ETRAXFS Ethernet device needs pointers to the dma controllers to
operate. According to qdev-properties.h, properties of pointer types
should be avoided. A QOM link type property is a good substitution.

Cc: Edgar E. Iglesias <address@hidden>

Signed-off-by: Sukrit Bhatnagar <address@hidden>
---
 hw/net/etraxfs_eth.c      | 13 ++++++++++---
 include/hw/cris/etraxfs.h |  4 ++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c
index 36855804db..6df109069f 100644
--- a/hw/net/etraxfs_eth.c
+++ b/hw/net/etraxfs_eth.c
@@ -622,6 +622,16 @@ static void etraxfs_eth_realize(DeviceState *dev, Error 
**errp)
                           "etraxfs-eth", 0x5c);
     sysbus_init_mmio(sbd, &s->mmio);
 
+    object_property_add_link(OBJECT(dev), "dma_out", TYPE_ETRAX_FS_ETH,
+                             (Object **) &s->dma_out,
+                             qdev_prop_allow_set_link_before_realize,
+                             0, &error_abort);
+
+    object_property_add_link(OBJECT(dev), "dma_in", TYPE_ETRAX_FS_ETH,
+                             (Object **) &s->dma_in,
+                             qdev_prop_allow_set_link_before_realize,
+                             0, &error_abort);
+
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_etraxfs_info, &s->conf,
                           object_get_typename(OBJECT(s)), dev->id, s);
@@ -634,8 +644,6 @@ static void etraxfs_eth_realize(DeviceState *dev, Error 
**errp)
 
 static Property etraxfs_eth_properties[] = {
     DEFINE_PROP_UINT32("phyaddr", ETRAXFSEthState, phyaddr, 1),
-    DEFINE_PROP_PTR("dma_out", ETRAXFSEthState, vdma_out),
-    DEFINE_PROP_PTR("dma_in", ETRAXFSEthState, vdma_in),
     DEFINE_NIC_PROPERTIES(ETRAXFSEthState, conf),
     DEFINE_PROP_END_OF_LIST(),
 };
@@ -647,7 +655,6 @@ static void etraxfs_eth_class_init(ObjectClass *klass, void 
*data)
     dc->realize = etraxfs_eth_realize;
     dc->reset = etraxfs_eth_reset;
     dc->props = etraxfs_eth_properties;
-    /* Reason: pointer properties "dma_out", "dma_in" */
     dc->user_creatable = false;
 }
 
diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h
index 8da965addb..f686cee180 100644
--- a/include/hw/cris/etraxfs.h
+++ b/include/hw/cris/etraxfs.h
@@ -39,8 +39,8 @@ etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr,
     dev = qdev_create(NULL, "etraxfs-eth");
     qdev_set_nic_properties(dev, nd);
     qdev_prop_set_uint32(dev, "phyaddr", phyaddr);
-    qdev_prop_set_ptr(dev, "dma_out", dma_out);
-    qdev_prop_set_ptr(dev, "dma_in", dma_in);
+    object_property_set_link(OBJECT(dev), OBJECT(dma_out), "dma_out", NULL);
+    object_property_set_link(OBJECT(dev), OBJECT(dma_in), "dma_in", NULL);
     qdev_init_nofail(dev);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
     return dev;
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]