[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 22/37] vmmouse: replace PROP_PTR with PROP_LINK
From: |
Marc-André Lureau |
Subject: |
[PATCH v5 22/37] vmmouse: replace PROP_PTR with PROP_LINK |
Date: |
Fri, 20 Dec 2019 17:45:46 +0400 |
While at it, use the expected type.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/i386/pc.c | 6 +++---
hw/i386/vmmouse.c | 8 +++-----
hw/input/pckbd.c | 8 +++-----
include/hw/input/i8042.h | 4 +++-
4 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index a4fda69b49..8054bc4147 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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);
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 41ad91ad53..c0c329f817 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -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 = {
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 2f09f780ba..60a4130320 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -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);
diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
index 246e6f3335..8eaebf50ce 100644
--- a/include/hw/input/i8042.h
+++ b/include/hw/input/i8042.h
@@ -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 */
--
2.24.0.308.g228f53135a
- [PATCH v5 12/37] serial: start making SerialMM a sysbus device, (continued)
- [PATCH v5 12/37] serial: start making SerialMM a sysbus device, Marc-André Lureau, 2019/12/20
- [PATCH v5 14/37] serial-mm: add endianness property, Marc-André Lureau, 2019/12/20
- [PATCH v5 15/37] serial-mm: use sysbus facilities, Marc-André Lureau, 2019/12/20
- [PATCH v5 16/37] serial: make SerialIO a sysbus device, Marc-André Lureau, 2019/12/20
- [PATCH v5 17/37] mips: inline serial_init(), Marc-André Lureau, 2019/12/20
- [PATCH v5 13/37] serial-mm: add "regshift" property, Marc-André Lureau, 2019/12/20
- [PATCH v5 18/37] mips: baudbase is 115200 by default, Marc-André Lureau, 2019/12/20
- [PATCH v5 19/37] mips: use sysbus_add_io(), Marc-André Lureau, 2019/12/20
- [PATCH v5 20/37] mips: use sysbus_mmio_get_region() instead of internal fields, Marc-André Lureau, 2019/12/20
- [PATCH v5 21/37] sm501: make SerialMM a child, export chardev property, Marc-André Lureau, 2019/12/20
- [PATCH v5 22/37] vmmouse: replace PROP_PTR with PROP_LINK,
Marc-André Lureau <=
- [PATCH v5 23/37] lance: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/12/20
- [PATCH v5 24/37] etraxfs: remove PROP_PTR usage, Marc-André Lureau, 2019/12/20
- [PATCH v5 25/37] dp8393x: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/12/20
- [PATCH v5 26/37] leon3: use qemu_irq framework instead of callback as property, Marc-André Lureau, 2019/12/20
- [PATCH v5 27/37] leon3: use qdev gpio facilities for the PIL, Marc-André Lureau, 2019/12/20
- [PATCH v5 28/37] qdev: use g_strcmp0() instead of open-coding it, Marc-André Lureau, 2019/12/20
- [PATCH v5 29/37] mips/cps: fix setting saar property, Marc-André Lureau, 2019/12/20
- [PATCH v5 30/37] cris: improve passing PIC interrupt vector to the CPU, Marc-André Lureau, 2019/12/20
- [PATCH v5 31/37] smbus-eeprom: remove PROP_PTR, Marc-André Lureau, 2019/12/20
- [PATCH v5 32/37] omap-intc: remove PROP_PTR, Marc-André Lureau, 2019/12/20