All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suramya Shah <shah.suramya@gmail.com>
To: qemu-devel@nongnu.org
Cc: Suramya Shah <shah.suramya@gmail.com>
Subject: [Qemu-devel] [PATCH] hw/net: convert "dma" property type from ptr to link
Date: Mon,  3 Apr 2017 13:05:50 +0530	[thread overview]
Message-ID: <20170403073550.29162-1-shah.suramya@gmail.com> (raw)

The lance device needs pointer to ISA DMA device to operate. But according to
qdev-properties.h, properties of pointer type should be avoided.
A link type property is a good substitution.

Signed-off-by: Suramya Shah <shah.suramya@gmail.com>
---
 hw/net/lance.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/net/lance.c b/hw/net/lance.c
index 573d724..3996b9c 100644
--- a/hw/net/lance.c
+++ b/hw/net/lance.c
@@ -44,6 +44,7 @@
 #include "pcnet.h"
 #include "trace.h"
 #include "sysemu/sysemu.h"
+#include "qapi/error.h"
 
 #define TYPE_LANCE "lance"
 #define SYSBUS_PCNET(obj) \
@@ -145,10 +146,14 @@ static void lance_instance_init(Object *obj)
     device_add_bootindex_property(obj, &s->conf.bootindex,
                                   "bootindex", "/ethernet-phy@0",
                                   DEVICE(obj), NULL);
+
+    object_property_add_link(obj, "dma", TYPE_LANCE,
+                             (Object **)&d->state.dma_opaque,
+                             qdev_prop_allow_set_link_before_realize,
+                             0, &error_abort);
 }
 
 static Property lance_properties[] = {
-    DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
     DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf),
     DEFINE_PROP_END_OF_LIST(),
 };
@@ -164,7 +169,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->cannot_instantiate_with_device_add_yet = true;
 }
 
-- 
2.9.3

             reply	other threads:[~2017-04-03  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  7:35 Suramya Shah [this message]
2017-04-03 14:14 ` [Qemu-devel] [PATCH] hw/net: convert "dma" property type from ptr to link Suramya Shah
2017-04-03 14:41 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170403073550.29162-1-shah.suramya@gmail.com \
    --to=shah.suramya@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.