* [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship @ 2018-02-04 7:28 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 ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Zihan Yang @ 2018-02-04 7:28 UTC (permalink / raw) To: qemu-devel; +Cc: Zihan Yang The ps2_mouse property of vmmouse is still pointer type which is defined by DEFINE_PROP_PTR. But qdev pointer property should be avoided according to qdev-properties.h. Convert it to QOM link relationship. It involves two patches because it requires the TYPE_I8042 macro which is defined in another file. The first patch put this macro into a single header file so that the macro can be used elsewhere. The second patch does the actual work. Zihan Yang (2): hw/input/pckdb: put TYPE_I8042 into a single header file vmmouse: change qdev pointer property to qom link hw/i386/pc.c | 2 +- hw/i386/vmmouse.c | 19 ++++++++++++------- hw/input/pckbd.c | 2 +- hw/input/pckbd.h | 6 ++++++ 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 hw/input/pckbd.h -- 2.7.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/2] hw/input/pckdb: put TYPE_I8042 into a single header file 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 ` Zihan Yang 2018-02-04 7:28 ` [Qemu-devel] [PATCH 2/2] vmmouse: change qdev pointer property to qom link Zihan Yang 2018-03-07 16:55 ` [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship Zihan Yang 2 siblings, 0 replies; 6+ messages in thread From: Zihan Yang @ 2018-02-04 7:28 UTC (permalink / raw) To: qemu-devel; +Cc: Zihan Yang, Michael S. Tsirkin, Paolo Bonzini This allows the macro to be used elsewhere, for example, when adding link property to vmmouse object. Signed-off-by: Zihan Yang <whois.zihan.yang@gmail.com> --- hw/input/pckbd.c | 2 +- hw/input/pckbd.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 hw/input/pckbd.h diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c479f82..d517938 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -27,6 +27,7 @@ #include "hw/i386/pc.h" #include "hw/input/ps2.h" #include "sysemu/sysemu.h" +#include "pckbd.h" /* debug PC keyboard */ //#define DEBUG_KBD @@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, qemu_register_reset(kbd_reset, s); } -#define TYPE_I8042 "i8042" #define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) typedef struct ISAKBDState { diff --git a/hw/input/pckbd.h b/hw/input/pckbd.h new file mode 100644 index 0000000..9cacd0a --- /dev/null +++ b/hw/input/pckbd.h @@ -0,0 +1,6 @@ +#ifndef QEMU_PCKCD_H +#define QEMU_PCKCD_H + +#define TYPE_I8042 "i8042" + +#endif -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/2] vmmouse: change qdev pointer property to qom link 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 2018-03-07 16:55 ` [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship Zihan Yang 2 siblings, 0 replies; 6+ messages in thread From: Zihan Yang @ 2018-02-04 7:28 UTC (permalink / raw) To: qemu-devel Cc: Zihan Yang, Paolo Bonzini, Richard Henderson, Eduardo Habkost, Michael S. Tsirkin, Marcel Apfelbaum 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship 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 ` [Qemu-devel] [PATCH 2/2] vmmouse: change qdev pointer property to qom link Zihan Yang @ 2018-03-07 16:55 ` Zihan Yang 2018-03-07 20:27 ` Philippe Mathieu-Daudé 2 siblings, 1 reply; 6+ messages in thread From: Zihan Yang @ 2018-03-07 16:55 UTC (permalink / raw) To: qemu-devel Hi all, this is a bitesized patch from me a while ago, it seems a little old but I wonder if there is any opinion about it? Is it still valid? Thanks. 2018-02-04 15:28 GMT+08:00 Zihan Yang <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 according to qdev-properties.h. Convert it to > QOM link relationship. > > It involves two patches because it requires the TYPE_I8042 > macro which is defined in another file. The first patch put > this macro into a single header file so that the macro can > be used elsewhere. The second patch does the actual work. > > Zihan Yang (2): > hw/input/pckdb: put TYPE_I8042 into a single header file > vmmouse: change qdev pointer property to qom link > > hw/i386/pc.c | 2 +- > hw/i386/vmmouse.c | 19 ++++++++++++------- > hw/input/pckbd.c | 2 +- > hw/input/pckbd.h | 6 ++++++ > 4 files changed, 20 insertions(+), 9 deletions(-) > create mode 100644 hw/input/pckbd.h > > -- > 2.7.4 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship 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 0 siblings, 1 reply; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2018-03-07 20:27 UTC (permalink / raw) To: Zihan Yang, qemu-devel Hi Zihan Yang, On 03/07/2018 01:55 PM, Zihan Yang wrote: > Hi all, this is a bitesized patch from me a while ago, it seems a little > old but I wonder if there is any opinion about it? Is it still valid? For a single TYPE use, I'm not sure use a specific header is useful (patch #1). The 2nd patch looks valid to me but I'm not a QOM link expert. > > Thanks. > > 2018-02-04 15:28 GMT+08:00 Zihan Yang <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 according to qdev-properties.h. Convert it to >> QOM link relationship. >> >> It involves two patches because it requires the TYPE_I8042 >> macro which is defined in another file. The first patch put >> this macro into a single header file so that the macro can >> be used elsewhere. The second patch does the actual work. >> >> Zihan Yang (2): >> hw/input/pckdb: put TYPE_I8042 into a single header file >> vmmouse: change qdev pointer property to qom link >> >> hw/i386/pc.c | 2 +- >> hw/i386/vmmouse.c | 19 ++++++++++++------- >> hw/input/pckbd.c | 2 +- >> hw/input/pckbd.h | 6 ++++++ >> 4 files changed, 20 insertions(+), 9 deletions(-) >> create mode 100644 hw/input/pckbd.h >> >> -- >> 2.7.4 >> >> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] vmmouse: convert qdev pointer property to QOM link relationship 2018-03-07 20:27 ` Philippe Mathieu-Daudé @ 2018-03-08 0:31 ` Zihan Yang 0 siblings, 0 replies; 6+ messages in thread From: Zihan Yang @ 2018-03-08 0:31 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: qemu-devel Hi Philippe, Thanks for reviewing my patch. Yes I though about it, a specific header file with only several lines seems not worth it, but otherwise I would have to define redundant macro in vmmouse.c. Currently rebundant macro is ok but if we need some more macros, we would end on creating a specific header at last, although I'm not sure whether we will really need more macros in the future. P.S. I forgot to cc to qemu-devel, so I resend one. I apologize if two identical emails look confusing to you. 2018-03-08 4:27 GMT+08:00 Philippe Mathieu-Daudé <f4bug@amsat.org>: > Hi Zihan Yang, > > On 03/07/2018 01:55 PM, Zihan Yang wrote: > > Hi all, this is a bitesized patch from me a while ago, it seems a little > > old but I wonder if there is any opinion about it? Is it still valid? > > For a single TYPE use, I'm not sure use a specific header is useful > (patch #1). > The 2nd patch looks valid to me but I'm not a QOM link expert. > > > > > Thanks. > > > > 2018-02-04 15:28 GMT+08:00 Zihan Yang <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 according to qdev-properties.h. Convert it to > >> QOM link relationship. > >> > >> It involves two patches because it requires the TYPE_I8042 > >> macro which is defined in another file. The first patch put > >> this macro into a single header file so that the macro can > >> be used elsewhere. The second patch does the actual work. > >> > >> Zihan Yang (2): > >> hw/input/pckdb: put TYPE_I8042 into a single header file > >> vmmouse: change qdev pointer property to qom link > >> > >> hw/i386/pc.c | 2 +- > >> hw/i386/vmmouse.c | 19 ++++++++++++------- > >> hw/input/pckbd.c | 2 +- > >> hw/input/pckbd.h | 6 ++++++ > >> 4 files changed, 20 insertions(+), 9 deletions(-) > >> create mode 100644 hw/input/pckbd.h > >> > >> -- > >> 2.7.4 > >> > >> > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-03-08 0:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [Qemu-devel] [PATCH 2/2] vmmouse: change qdev pointer property to qom link Zihan Yang 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
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).