[PATCH 4/5] hw/i386/pc: Inline i8042_setup_a20_line() and remove it

Bernhard Beschow posted 5 patches 8 months, 4 weeks ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, "Hervé Poussineau" <hpoussin@reactos.org>, BALATON Zoltan <balaton@eik.bme.hu>, Jiaxun Yang <jiaxun.yang@flygoat.com>
[PATCH 4/5] hw/i386/pc: Inline i8042_setup_a20_line() and remove it
Posted by Bernhard Beschow 8 months, 4 weeks ago
This function is used once in the pc machines. Remove it since it contains one
line only.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/input/i8042.h | 1 -
 hw/i386/pc.c             | 2 +-
 hw/input/pckbd.c         | 5 -----
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
index 9fb3f8d787..e90f008b66 100644
--- a/include/hw/input/i8042.h
+++ b/include/hw/input/i8042.h
@@ -89,7 +89,6 @@ struct MMIOKBDState {
 
 
 void i8042_isa_mouse_fake_event(ISAKBDState *isa);
-void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
 
 static inline bool i8042_present(void)
 {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 8b601ea6cf..1b2077dc32 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1195,7 +1195,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl,
     }
 
     a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 1);
-    i8042_setup_a20_line(i8042, a20_line[0]);
+    qdev_connect_gpio_out_named(DEVICE(i8042), I8042_A20_LINE, 0, a20_line[0]);
     g_free(a20_line);
 }
 
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 90a4d9eb40..74f10b640f 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -777,11 +777,6 @@ void i8042_isa_mouse_fake_event(ISAKBDState *isa)
     ps2_mouse_fake_event(&s->ps2mouse);
 }
 
-void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out)
-{
-    qdev_connect_gpio_out_named(DEVICE(dev), I8042_A20_LINE, 0, a20_out);
-}
-
 static const VMStateDescription vmstate_kbd_isa = {
     .name = "pckbd",
     .version_id = 3,
-- 
2.43.2
Re: [PATCH 4/5] hw/i386/pc: Inline i8042_setup_a20_line() and remove it
Posted by Philippe Mathieu-Daudé 8 months, 3 weeks ago
On 18/2/24 14:17, Bernhard Beschow wrote:
> This function is used once in the pc machines. Remove it since it contains one
> line only.

Now reminds me of 
https://lore.kernel.org/qemu-devel/20211218130437.1516929-6-f4bug@amsat.org/

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/input/i8042.h | 1 -
>   hw/i386/pc.c             | 2 +-
>   hw/input/pckbd.c         | 5 -----
>   3 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
> index 9fb3f8d787..e90f008b66 100644
> --- a/include/hw/input/i8042.h
> +++ b/include/hw/input/i8042.h
> @@ -89,7 +89,6 @@ struct MMIOKBDState {
>   
>   
>   void i8042_isa_mouse_fake_event(ISAKBDState *isa);
> -void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
>   
>   static inline bool i8042_present(void)
>   {
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 8b601ea6cf..1b2077dc32 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1195,7 +1195,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl,
>       }
>   
>       a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 1);
> -    i8042_setup_a20_line(i8042, a20_line[0]);
> +    qdev_connect_gpio_out_named(DEVICE(i8042), I8042_A20_LINE, 0, a20_line[0]);
>       g_free(a20_line);
>   }
>   
> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
> index 90a4d9eb40..74f10b640f 100644
> --- a/hw/input/pckbd.c
> +++ b/hw/input/pckbd.c
> @@ -777,11 +777,6 @@ void i8042_isa_mouse_fake_event(ISAKBDState *isa)
>       ps2_mouse_fake_event(&s->ps2mouse);
>   }
>   
> -void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out)
> -{
> -    qdev_connect_gpio_out_named(DEVICE(dev), I8042_A20_LINE, 0, a20_out);
> -}
> -
>   static const VMStateDescription vmstate_kbd_isa = {
>       .name = "pckbd",
>       .version_id = 3,
Re: [PATCH 4/5] hw/i386/pc: Inline i8042_setup_a20_line() and remove it
Posted by Philippe Mathieu-Daudé 8 months, 3 weeks ago
On 18/2/24 14:17, Bernhard Beschow wrote:
> This function is used once in the pc machines. Remove it since it contains one
> line only.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   include/hw/input/i8042.h | 1 -
>   hw/i386/pc.c             | 2 +-
>   hw/input/pckbd.c         | 5 -----
>   3 files changed, 1 insertion(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>