From: Li Qiang <liq3ea@gmail.com>
To: pbonzini@redhat.com, rth@twiddle.net, armbru@redhat.com,
ehabkost@redhat.com, mst@redhat.com, marcel.apfelbaum@gmail.com,
mark.cave-ayland@ilande.co.uk
Cc: qemu-devel@nongnu.org, Li Qiang <liq3ea@gmail.com>
Subject: [Qemu-devel] [PATCH v2 2/2] hw: vmmouse: drop DEFINE_PROP_PTR()
Date: Tue, 27 Nov 2018 02:02:03 -0800 [thread overview]
Message-ID: <1543312923-3074-3-git-send-email-liq3ea@gmail.com> (raw)
In-Reply-To: <1543312923-3074-1-git-send-email-liq3ea@gmail.com>
Use link property instead.
Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
Change since v1: use error_abort in object_property_set_link()
hw/i386/pc.c | 3 ++-
hw/i386/vmmouse.c | 17 +++++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 73c7b777a0..64f0f233b8 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1552,7 +1552,8 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
}
if (vmmouse) {
DeviceState *dev = DEVICE(vmmouse);
- qdev_prop_set_ptr(dev, "ps2_mouse", i8042);
+ object_property_set_link(OBJECT(dev), OBJECT(i8042),
+ "ps2_mouse", &error_abort);
qdev_init_nofail(dev);
}
port92 = isa_create_simple(isa_bus, TYPE_PORT92);
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 4412eaf604..f63aac6673 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -27,6 +27,7 @@
#include "hw/i386/pc.h"
#include "hw/input/i8042.h"
#include "hw/qdev.h"
+#include "qapi/error.h"
/* debug only vmmouse */
//#define DEBUG_VMMOUSE
@@ -271,10 +272,15 @@ static void vmmouse_realizefn(DeviceState *dev, Error **errp)
vmport_register(VMMOUSE_DATA, vmmouse_ioport_read, s);
}
-static Property vmmouse_properties[] = {
- DEFINE_PROP_PTR("ps2_mouse", VMMouseState, ps2_mouse),
- DEFINE_PROP_END_OF_LIST(),
-};
+static void vmmouse_instance_initfn(Object *obj)
+{
+ VMMouseState *s = VMMOUSE(obj);
+
+ object_property_add_link(obj, "ps2_mouse", TYPE_I8042,
+ (Object **)&s->ps2_mouse,
+ qdev_prop_allow_set_link_before_realize,
+ 0, &error_abort);
+}
static void vmmouse_class_initfn(ObjectClass *klass, void *data)
{
@@ -283,8 +289,6 @@ static void vmmouse_class_initfn(ObjectClass *klass, void *data)
dc->realize = vmmouse_realizefn;
dc->reset = vmmouse_reset;
dc->vmsd = &vmstate_vmmouse;
- dc->props = vmmouse_properties;
- /* Reason: pointer property "ps2_mouse" */
dc->user_creatable = false;
}
@@ -292,6 +296,7 @@ static const TypeInfo vmmouse_info = {
.name = TYPE_VMMOUSE,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(VMMouseState),
+ .instance_init = vmmouse_instance_initfn,
.class_init = vmmouse_class_initfn,
};
--
2.11.0
next prev parent reply other threads:[~2018-11-27 10:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 10:02 [Qemu-devel] [PATCH v2 0/2] hw: vmmouse: use link property instead of DEFINE_PROP_PTR Li Qiang
2018-11-27 10:02 ` [Qemu-devel] [PATCH v2 1/2] hw: pc: use TYPE_XXX instead of constant strings Li Qiang
2018-11-27 10:18 ` Darren Kenny
2018-11-27 10:37 ` Philippe Mathieu-Daudé
2018-11-27 12:37 ` Markus Armbruster
2018-11-27 10:02 ` Li Qiang [this message]
2018-11-27 10:27 ` [Qemu-devel] [PATCH v2 2/2] hw: vmmouse: drop DEFINE_PROP_PTR() Darren Kenny
2018-11-27 12:38 ` Markus Armbruster
2018-11-27 16:57 ` Darren Kenny
2018-11-29 4:54 ` Li Qiang
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=1543312923-3074-3-git-send-email-liq3ea@gmail.com \
--to=liq3ea@gmail.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).