[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/50] malta: replace chr init by CHR_EVENT_OPENED ha
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 24/50] malta: replace chr init by CHR_EVENT_OPENED handler |
Date: |
Mon, 24 Oct 2016 15:47:09 +0200 |
From: Marc-André Lureau <address@hidden>
The CharDriverState.init() callback was introduced in commit
ceecf1d158. It is only called from text_console_do_init(), but it is no
longer set since commit a61ae7f88 (init assignment has been removed by
accident).
It seems correct to use an event callback instead and print the console
text on CHR_EVENT_OPENED. That way we can remove the single user of
CharDriverState init().
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/mips/mips_malta.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index bae60be..3aec6d8 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -88,6 +88,7 @@ typedef struct {
CharDriverState *display;
char display_text[9];
SerialState *uart;
+ bool display_inited;
} MaltaFPGAState;
#define TYPE_MIPS_MALTA "mips-malta"
@@ -530,17 +531,22 @@ static void malta_fpga_reset(void *opaque)
snprintf(s->display_text, 9, " ");
}
-static void malta_fpga_led_init(CharDriverState *chr)
+static void malta_fgpa_display_event(void *opaque, int event)
{
- qemu_chr_fe_printf(chr, "\e[HMalta LEDBAR\r\n");
- qemu_chr_fe_printf(chr, "+--------+\r\n");
- qemu_chr_fe_printf(chr, "+ +\r\n");
- qemu_chr_fe_printf(chr, "+--------+\r\n");
- qemu_chr_fe_printf(chr, "\n");
- qemu_chr_fe_printf(chr, "Malta ASCII\r\n");
- qemu_chr_fe_printf(chr, "+--------+\r\n");
- qemu_chr_fe_printf(chr, "+ +\r\n");
- qemu_chr_fe_printf(chr, "+--------+\r\n");
+ MaltaFPGAState *s = opaque;
+
+ if (event == CHR_EVENT_OPENED && !s->display_inited) {
+ qemu_chr_fe_printf(s->display, "\e[HMalta LEDBAR\r\n");
+ qemu_chr_fe_printf(s->display, "+--------+\r\n");
+ qemu_chr_fe_printf(s->display, "+ +\r\n");
+ qemu_chr_fe_printf(s->display, "+--------+\r\n");
+ qemu_chr_fe_printf(s->display, "\n");
+ qemu_chr_fe_printf(s->display, "Malta ASCII\r\n");
+ qemu_chr_fe_printf(s->display, "+--------+\r\n");
+ qemu_chr_fe_printf(s->display, "+ +\r\n");
+ qemu_chr_fe_printf(s->display, "+--------+\r\n");
+ s->display_inited = true;
+ }
}
static MaltaFPGAState *malta_fpga_init(MemoryRegion *address_space,
@@ -560,7 +566,9 @@ static MaltaFPGAState *malta_fpga_init(MemoryRegion
*address_space,
memory_region_add_subregion(address_space, base, &s->iomem_lo);
memory_region_add_subregion(address_space, base + 0xa00, &s->iomem_hi);
- s->display = qemu_chr_new("fpga", "vc:320x200", malta_fpga_led_init);
+ s->display = qemu_chr_new("fpga", "vc:320x200", NULL);
+ qemu_chr_add_handlers(s->display, NULL, NULL,
+ malta_fgpa_display_event, s);
s->uart = serial_mm_init(address_space, base + 0x900, 3, uart_irq,
230400, uart_chr, DEVICE_NATIVE_ENDIAN);
--
1.8.3.1
- [Qemu-devel] [PULL 17/50] memory: optimize memory_region_sync_dirty_bitmap, (continued)
- [Qemu-devel] [PULL 17/50] memory: optimize memory_region_sync_dirty_bitmap, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 15/50] memory: add a per-AddressSpace list of listeners, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 20/50] rng: remove unused included header, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 16/50] memory: optimize memory_global_dirty_log_sync, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 19/50] char.h: misc doc fix, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 21/50] char: remove use-after-free on win-stdio, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 18/50] char: serial: check divider value against baud base, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 22/50] ringbuf: fix chr_write return value, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 23/50] sun4uv: fix serial initialization regression, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 28/50] char: introduce CharBackend, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 24/50] malta: replace chr init by CHR_EVENT_OPENED handler,
Paolo Bonzini <=
- [Qemu-devel] [PULL 25/50] char: remove init callback, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 26/50] xilinx: fix buffer overflow on realize, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 27/50] mux: split mux_chr_update_read_handler(), Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 29/50] char: start converting mux driver to use CharBackend, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 33/50] colo: claim in find_and_check_chardev, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 32/50] char: rename some frontend functions, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 35/50] char: fold qemu_chr_set_handlers in qemu_chr_fe_set_handlers, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 36/50] vhost-user: only initialize queue 0 CharBackend, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 30/50] char: replace PROP_CHR with CharBackend, Paolo Bonzini, 2016/10/24
- [Qemu-devel] [PULL 31/50] char: remaining switch to CharBackend in frontend, Paolo Bonzini, 2016/10/24