TYPE_VMMOUSE is defined in vmmouse.c currently, move it
to pc.h in order to use it in pc.c.
Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
Change since v1: remove the unnecessary change
hw/i386/pc.c | 6 +++---
hw/i386/vmmouse.c | 1 -
include/hw/i386/pc.h | 3 +++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f095725dba..73c7b777a0 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1543,10 +1543,10 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
fdctrl_init_isa(isa_bus, fd);
}
- i8042 = isa_create_simple(isa_bus, "i8042");
+ i8042 = isa_create_simple(isa_bus, TYPE_I8042);
if (!no_vmport) {
vmport_init(isa_bus);
- vmmouse = isa_try_create(isa_bus, "vmmouse");
+ vmmouse = isa_try_create(isa_bus, TYPE_VMMOUSE);
} else {
vmmouse = NULL;
}
@@ -1555,7 +1555,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
qdev_prop_set_ptr(dev, "ps2_mouse", i8042);
qdev_init_nofail(dev);
}
- port92 = isa_create_simple(isa_bus, "port92");
+ port92 = isa_create_simple(isa_bus, TYPE_PORT92);
a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
i8042_setup_a20_line(i8042, a20_line[0]);
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 5d2d278be4..4412eaf604 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -52,7 +52,6 @@
#define DPRINTF(fmt, ...) do { } while (0)
#endif
-#define TYPE_VMMOUSE "vmmouse"
#define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE)
typedef struct VMMouseState
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 136fe497b6..c708ac9265 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -169,6 +169,9 @@ void gsi_handler(void *opaque, int n, int level);
#define TYPE_VMPORT "vmport"
typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
+/* vmmouse.c */
+#define TYPE_VMMOUSE "vmmouse"
+
static inline void vmport_init(ISABus *bus)
{
isa_create_simple(bus, TYPE_VMPORT);
--
2.11.0
On Tue, Nov 27, 2018 at 02:02:02AM -0800, Li Qiang wrote:
>TYPE_VMMOUSE is defined in vmmouse.c currently, move it
>to pc.h in order to use it in pc.c.
>
>Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
>---
>
>Change since v1: remove the unnecessary change
>
> hw/i386/pc.c | 6 +++---
> hw/i386/vmmouse.c | 1 -
> include/hw/i386/pc.h | 3 +++
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
>diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>index f095725dba..73c7b777a0 100644
>--- a/hw/i386/pc.c
>+++ b/hw/i386/pc.c
>@@ -1543,10 +1543,10 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
> fdctrl_init_isa(isa_bus, fd);
> }
>
>- i8042 = isa_create_simple(isa_bus, "i8042");
>+ i8042 = isa_create_simple(isa_bus, TYPE_I8042);
> if (!no_vmport) {
> vmport_init(isa_bus);
>- vmmouse = isa_try_create(isa_bus, "vmmouse");
>+ vmmouse = isa_try_create(isa_bus, TYPE_VMMOUSE);
> } else {
> vmmouse = NULL;
> }
>@@ -1555,7 +1555,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
> qdev_prop_set_ptr(dev, "ps2_mouse", i8042);
> qdev_init_nofail(dev);
> }
>- port92 = isa_create_simple(isa_bus, "port92");
>+ port92 = isa_create_simple(isa_bus, TYPE_PORT92);
>
> a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
> i8042_setup_a20_line(i8042, a20_line[0]);
>diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
>index 5d2d278be4..4412eaf604 100644
>--- a/hw/i386/vmmouse.c
>+++ b/hw/i386/vmmouse.c
>@@ -52,7 +52,6 @@
> #define DPRINTF(fmt, ...) do { } while (0)
> #endif
>
>-#define TYPE_VMMOUSE "vmmouse"
> #define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE)
>
> typedef struct VMMouseState
>diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
>index 136fe497b6..c708ac9265 100644
>--- a/include/hw/i386/pc.h
>+++ b/include/hw/i386/pc.h
>@@ -169,6 +169,9 @@ void gsi_handler(void *opaque, int n, int level);
> #define TYPE_VMPORT "vmport"
> typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
>
>+/* vmmouse.c */
>+#define TYPE_VMMOUSE "vmmouse"
>+
> static inline void vmport_init(ISABus *bus)
> {
> isa_create_simple(bus, TYPE_VMPORT);
>--
>2.11.0
>
>
On 27/11/18 11:02, Li Qiang wrote:
> TYPE_VMMOUSE is defined in vmmouse.c currently, move it
> to pc.h in order to use it in pc.c.
>
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>
> Change since v1: remove the unnecessary change
>
> hw/i386/pc.c | 6 +++---
> hw/i386/vmmouse.c | 1 -
> include/hw/i386/pc.h | 3 +++
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f095725dba..73c7b777a0 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1543,10 +1543,10 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
> fdctrl_init_isa(isa_bus, fd);
> }
>
> - i8042 = isa_create_simple(isa_bus, "i8042");
> + i8042 = isa_create_simple(isa_bus, TYPE_I8042);
> if (!no_vmport) {
> vmport_init(isa_bus);
> - vmmouse = isa_try_create(isa_bus, "vmmouse");
> + vmmouse = isa_try_create(isa_bus, TYPE_VMMOUSE);
> } else {
> vmmouse = NULL;
> }
> @@ -1555,7 +1555,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
> qdev_prop_set_ptr(dev, "ps2_mouse", i8042);
> qdev_init_nofail(dev);
> }
> - port92 = isa_create_simple(isa_bus, "port92");
> + port92 = isa_create_simple(isa_bus, TYPE_PORT92);
Reminds me of
https://lists.gnu.org/archive/html/qemu-devel/2017-09/msg06710.html ;)
>
> a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
> i8042_setup_a20_line(i8042, a20_line[0]);
> diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
> index 5d2d278be4..4412eaf604 100644
> --- a/hw/i386/vmmouse.c
> +++ b/hw/i386/vmmouse.c
> @@ -52,7 +52,6 @@
> #define DPRINTF(fmt, ...) do { } while (0)
> #endif
>
> -#define TYPE_VMMOUSE "vmmouse"
> #define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE)
>
> typedef struct VMMouseState
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 136fe497b6..c708ac9265 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -169,6 +169,9 @@ void gsi_handler(void *opaque, int n, int level);
> #define TYPE_VMPORT "vmport"
> typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
>
> +/* vmmouse.c */
> +#define TYPE_VMMOUSE "vmmouse"
> +
> static inline void vmport_init(ISABus *bus)
> {
> isa_create_simple(bus, TYPE_VMPORT);
>
Li Qiang <liq3ea@gmail.com> writes: > TYPE_VMMOUSE is defined in vmmouse.c currently, move it > to pc.h in order to use it in pc.c. > > Signed-off-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
© 2016 - 2025 Red Hat, Inc.