vmmouse: replace PROP_PTR with PROP_LINK

While at it, use the expected type.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
Marc-André Lureau 2019-10-17 17:06:05 +02:00
parent 0ed40f16a1
commit 0fe4bb3241
4 changed files with 12 additions and 14 deletions

View File

@ -1156,9 +1156,9 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
vmmouse = NULL;
}
if (vmmouse) {
DeviceState *dev = DEVICE(vmmouse);
qdev_prop_set_ptr(dev, "ps2_mouse", i8042);
qdev_init_nofail(dev);
object_property_set_link(OBJECT(vmmouse), OBJECT(i8042),
"i8042", &error_abort);
qdev_init_nofail(DEVICE(vmmouse));
}
port92 = isa_create_simple(isa_bus, TYPE_PORT92);

View File

@ -66,7 +66,7 @@ typedef struct VMMouseState
uint16_t status;
uint8_t absolute;
QEMUPutMouseEntry *entry;
void *ps2_mouse;
ISAKBDState *i8042;
} VMMouseState;
static uint32_t vmmouse_get_status(VMMouseState *s)
@ -105,7 +105,7 @@ static void vmmouse_mouse_event(void *opaque, int x, int y, int dz, int buttons_
/* need to still generate PS2 events to notify driver to
read from queue */
i8042_isa_mouse_fake_event(s->ps2_mouse);
i8042_isa_mouse_fake_event(s->i8042);
}
static void vmmouse_remove_handler(VMMouseState *s)
@ -275,7 +275,7 @@ static void vmmouse_realizefn(DeviceState *dev, Error **errp)
}
static Property vmmouse_properties[] = {
DEFINE_PROP_PTR("ps2_mouse", VMMouseState, ps2_mouse),
DEFINE_PROP_LINK("i8042", VMMouseState, i8042, TYPE_I8042, ISAKBDState *),
DEFINE_PROP_END_OF_LIST(),
};
@ -287,8 +287,6 @@ static void vmmouse_class_initfn(ObjectClass *klass, void *data)
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 = {

View File

@ -482,17 +482,15 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
#define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)
typedef struct ISAKBDState {
struct ISAKBDState {
ISADevice parent_obj;
KBDState kbd;
MemoryRegion io[2];
} ISAKBDState;
};
void i8042_isa_mouse_fake_event(void *opaque)
void i8042_isa_mouse_fake_event(ISAKBDState *isa)
{
ISADevice *dev = opaque;
ISAKBDState *isa = I8042(dev);
KBDState *s = &isa->kbd;
ps2_mouse_fake_event(s->mouse);

View File

@ -14,10 +14,12 @@
#define I8042_A20_LINE "a20"
typedef struct ISAKBDState ISAKBDState;
void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
MemoryRegion *region, ram_addr_t size,
hwaddr mask);
void i8042_isa_mouse_fake_event(void *opaque);
void i8042_isa_mouse_fake_event(ISAKBDState *isa);
void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
#endif /* HW_INPUT_I8042_H */