From: Zihan Yang <whois.zihan.yang@gmail.com>
To: qemu-devel@nongnu.org
Cc: Zihan Yang <whois.zihan.yang@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] vmmouse: change qdev pointer property to qom link
Date: Sun, 4 Feb 2018 15:28:23 +0800 [thread overview]
Message-ID: <1517729303-32043-3-git-send-email-whois.zihan.yang@gmail.com> (raw)
In-Reply-To: <1517729303-32043-1-git-send-email-whois.zihan.yang@gmail.com>
The ps2_mouse property of vmmouse is still pointer type which
is defined by DEFINE_PROP_PTR. But qdev pointer property should
be avoided. Convert it into QOM link relationship
Signed-off-by: Zihan Yang <whois.zihan.yang@gmail.com>
---
hw/i386/pc.c | 2 +-
hw/i386/vmmouse.c | 19 ++++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index ccc50ba..63f49b2 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1598,7 +1598,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
}
if (vmmouse) {
DeviceState *dev = DEVICE(vmmouse);
- qdev_prop_set_ptr(dev, "ps2_mouse", i8042);
+ object_property_set_link(OBJECT(dev), OBJECT(i8042), "ps2_mouse", NULL);
qdev_init_nofail(dev);
}
port92 = isa_create_simple(isa_bus, "port92");
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 65ef553..49d4170 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -26,6 +26,8 @@
#include "ui/console.h"
#include "hw/i386/pc.h"
#include "hw/qdev.h"
+#include "hw/input/pckbd.h"
+#include "qapi/error.h"
/* debug only vmmouse */
//#define DEBUG_VMMOUSE
@@ -271,10 +273,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_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,15 +290,13 @@ 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;
}
static const TypeInfo vmmouse_info = {
.name = TYPE_VMMOUSE,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(VMMouseState),
+ .instance_init = vmmouse_initfn,
.class_init = vmmouse_class_initfn,
};
--
2.7.4
next prev parent reply other threads:[~2018-02-04 7:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-04 7:28 [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship Zihan Yang
2018-02-04 7:28 ` [Qemu-devel] [PATCH 1/2] hw/input/pckdb: put TYPE_I8042 into a single header file Zihan Yang
2018-02-04 7:28 ` Zihan Yang [this message]
2018-03-07 16:55 ` [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship Zihan Yang
2018-03-07 20:27 ` Philippe Mathieu-Daudé
2018-03-08 0:31 ` Zihan Yang
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=1517729303-32043-3-git-send-email-whois.zihan.yang@gmail.com \
--to=whois.zihan.yang@gmail.com \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--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).