All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Corey Minyard" <cminyard@mvista.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"KONRAD Frederic" <frederic.konrad@adacore.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Aleksandar Rikalo" <arikalo@wavecomp.com>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Fabien Chouteau" <chouteau@adacore.com>,
	qemu-arm@nongnu.org, "Richard Henderson" <rth@twiddle.net>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-ppc@nongnu.org,
	"Aleksandar Markovic" <amarkovic@wavecomp.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH v2 15/28] vmmouse: replace PROP_PTR with PROP_LINK
Date: Tue, 22 Oct 2019 18:21:24 +0200	[thread overview]
Message-ID: <20191022162137.27161-16-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20191022162137.27161-1-marcandre.lureau@redhat.com>

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>
---
 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 4b1904237e..ada1ea8802 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1861,9 +1861,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, "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 f0acfd86f7..9b641021c9 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -483,17 +483,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.23.0.606.g08da6496b6



  parent reply	other threads:[~2019-10-22 16:41 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 16:21 [PATCH v2 00/28] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 01/28] chardev: generate an internal id when none given Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 02/28] serial-pci-multi: factor out multi_serial_get_nr_ports Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 03/28] serial: initial qom-ification Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 04/28] serial: register vmsd with DeviceClass Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 05/28] serial: add and set "chardev" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 06/28] serial: make SerialMMState actually a different type Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 07/28] serial: add and set "regshift" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 08/28] serial: convert irq to qdev gpio properties Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 09/28] serial: add "baudbase" property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 10/28] serial: add "base" property Marc-André Lureau
2019-10-22 16:31   ` Peter Maydell
2019-10-22 16:42     ` Marc-André Lureau
2019-10-22 16:50       ` Peter Maydell
2019-10-22 16:21 ` [PATCH v2 11/28] serial: realize the serial device Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 12/28] serial: replace serial_exit_core() with unrealize Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 13/28] serial: factor out serial_mm_connect Marc-André Lureau
2019-10-22 16:34   ` Peter Maydell
2019-10-22 16:21 ` [PATCH v2 14/28] sm501: embed the serial device Marc-André Lureau
2019-10-22 16:21 ` Marc-André Lureau [this message]
2019-10-22 16:21 ` [PATCH v2 16/28] lance: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 17/28] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 18/28] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 19/28] leon3: use qemu_irq framework instead of callback as property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 20/28] sparc: move PIL irq handling to cpu.c Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 21/28] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 22/28] cris: improve passing PIC interrupt vector to the CPU Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 23/28] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-10-22 17:19   ` Peter Maydell
2019-10-22 17:56     ` Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 24/28] omap-intc: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 25/28] omap-i2c: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 26/28] omap-gpio: " Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 27/28] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-10-22 16:21 ` [PATCH v2 28/28] Remove QDEV_PROP_PTR Marc-André Lureau

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=20191022162137.27161-16-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=amarkovic@wavecomp.com \
    --cc=arikalo@wavecomp.com \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=chouteau@adacore.com \
    --cc=cminyard@mvista.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=frederic.konrad@adacore.com \
    --cc=hpoussin@reactos.org \
    --cc=jasowang@redhat.com \
    --cc=magnus.damm@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.