aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-06-05 10:09:14 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-06-05 10:09:14 +0100
commitcb8b8ef4578dc17c350fd4b27700a9f178e2dad0 (patch)
tree6bd382062ac77cc25bece492b78e15fec2a313e5 /hw
parentc6e84fbd447a51e1161d74d71566a5f67b47eac5 (diff)
parent6b10e573d15ef82dbc5c5b3726028e6642e134f6 (diff)
Merge remote-tracking branch 'remotes/elmarco/tags/chrfe-pull-request' into staging
# gpg: Signature made Fri 02 Jun 2017 20:12:48 BST # gpg: using RSA key 0xDAE8E10975969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/chrfe-pull-request: char: move char devices to chardev/ char: make chr_fe_deinit() optionaly delete backend char: rename functions that are not part of fe char: move CharBackend handling in char-fe unit char: generalize qemu_chr_write_all() be-hci: use backend functions chardev: serial & parallel declaration to own headers chardev: move headers to include/chardev Remove/replace sysemu/char.h inclusion char-win: close file handle except with console char-win: rename hcom->file char-win: rename win_chr_init/poll win_chr_serial_init/poll char-win: remove WinChardev.len char-win: simplify win_chr_read() char: cast ARRAY_SIZE() as signed to silent warning on empty array Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/arm/bcm2835_peripherals.c1
-rw-r--r--hw/arm/fsl-imx25.c2
-rw-r--r--hw/arm/fsl-imx31.c2
-rw-r--r--hw/arm/fsl-imx6.c2
-rw-r--r--hw/arm/omap2.c2
-rw-r--r--hw/arm/pxa2xx.c2
-rw-r--r--hw/arm/strongarm.c3
-rw-r--r--hw/bt/hci-csr.c11
-rw-r--r--hw/char/cadence_uart.c3
-rw-r--r--hw/char/debugcon.c2
-rw-r--r--hw/char/digic-uart.c2
-rw-r--r--hw/char/escc.c3
-rw-r--r--hw/char/etraxfs_ser.c2
-rw-r--r--hw/char/exynos4210_uart.c3
-rw-r--r--hw/char/grlib_apbuart.c2
-rw-r--r--hw/char/imx_serial.c1
-rw-r--r--hw/char/ipoctal232.c2
-rw-r--r--hw/char/lm32_juart.c2
-rw-r--r--hw/char/lm32_uart.c2
-rw-r--r--hw/char/mcf_uart.c2
-rw-r--r--hw/char/milkymist-uart.c2
-rw-r--r--hw/char/omap_uart.c2
-rw-r--r--hw/char/parallel.c3
-rw-r--r--hw/char/pl011.c2
-rw-r--r--hw/char/sclpconsole-lm.c2
-rw-r--r--hw/char/sclpconsole.c2
-rw-r--r--hw/char/serial.c4
-rw-r--r--hw/char/sh_serial.c2
-rw-r--r--hw/char/spapr_vty.c2
-rw-r--r--hw/char/terminal3270.c2
-rw-r--r--hw/char/virtio-console.c2
-rw-r--r--hw/char/xen_console.c4
-rw-r--r--hw/char/xilinx_uartlite.c2
-rw-r--r--hw/core/qdev-properties-system.c4
-rw-r--r--hw/core/qdev-properties.c2
-rw-r--r--hw/display/xenfb.c1
-rw-r--r--hw/i386/xen/xen-hvm.c1
-rw-r--r--hw/ipmi/ipmi_bmc_extern.c2
-rw-r--r--hw/isa/pc87312.c2
-rw-r--r--hw/mips/boston.c2
-rw-r--r--hw/mips/mips_fulong2e.c1
-rw-r--r--hw/mips/mips_malta.c1
-rw-r--r--hw/misc/ivshmem.c2
-rw-r--r--hw/net/xgmac.c1
-rw-r--r--hw/ppc/spapr_events.c1
-rw-r--r--hw/ppc/spapr_rtas.c1
-rw-r--r--hw/sparc/leon3.c1
-rw-r--r--hw/usb/ccid-card-emulated.c2
-rw-r--r--hw/usb/ccid-card-passthru.c7
-rw-r--r--hw/usb/dev-serial.c3
-rw-r--r--hw/usb/redirect.c6
-rw-r--r--hw/virtio/vhost-user.c2
-rw-r--r--hw/xen/xen-common.c2
-rw-r--r--hw/xen/xen_backend.c1
-rw-r--r--hw/xtensa/xtfpga.c2
55 files changed, 58 insertions, 71 deletions
diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
index 369ef1e3bd..502f04c02a 100644
--- a/hw/arm/bcm2835_peripherals.c
+++ b/hw/arm/bcm2835_peripherals.c
@@ -13,7 +13,6 @@
#include "hw/arm/bcm2835_peripherals.h"
#include "hw/misc/bcm2835_mbox_defs.h"
#include "hw/arm/raspi_platform.h"
-#include "sysemu/char.h"
#include "sysemu/sysemu.h"
/* Peripheral base address on the VC (GPU) system bus */
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
index 9056f27bf8..40666b68a3 100644
--- a/hw/arm/fsl-imx25.c
+++ b/hw/arm/fsl-imx25.c
@@ -30,7 +30,7 @@
#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
#include "hw/boards.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
static void fsl_imx25_init(Object *obj)
{
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
index d7e2d832b2..c30130667e 100644
--- a/hw/arm/fsl-imx31.c
+++ b/hw/arm/fsl-imx31.c
@@ -27,7 +27,7 @@
#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
#include "hw/boards.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
static void fsl_imx31_init(Object *obj)
{
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
index 6969e734ad..27773c9c47 100644
--- a/hw/arm/fsl-imx6.c
+++ b/hw/arm/fsl-imx6.c
@@ -24,7 +24,7 @@
#include "qemu-common.h"
#include "hw/arm/fsl-imx6.h"
#include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#include "qemu/error-report.h"
#define NAME_SIZE 20
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index 8afb854c74..91f573338c 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -30,7 +30,7 @@
#include "hw/arm/omap.h"
#include "sysemu/sysemu.h"
#include "qemu/timer.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "hw/block/flash.h"
#include "hw/arm/soc_dma.h"
#include "hw/sysbus.h"
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index eea551dc16..629e6c64e6 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -17,7 +17,7 @@
#include "hw/char/serial.h"
#include "hw/i2c/i2c.h"
#include "hw/ssi/ssi.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "qemu/cutils.h"
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 3311cc38a4..7683edc9e5 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -34,7 +34,8 @@
#include "strongarm.h"
#include "qemu/error-report.h"
#include "hw/arm/arm.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
+#include "chardev/char-serial.h"
#include "sysemu/sysemu.h"
#include "hw/ssi/ssi.h"
#include "qemu/cutils.h"
diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c
index 3c193848fc..d13192b9b5 100644
--- a/hw/bt/hci-csr.c
+++ b/hw/bt/hci-csr.c
@@ -20,7 +20,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char-serial.h"
#include "qemu/timer.h"
#include "qemu/bswap.h"
#include "hw/irq.h"
@@ -82,17 +82,14 @@ enum {
static inline void csrhci_fifo_wake(struct csrhci_s *s)
{
- Chardev *chr = (Chardev *)s;
- CharBackend *be = chr->be;
+ Chardev *chr = CHARDEV(s);
if (!s->enable || !s->out_len)
return;
/* XXX: Should wait for s->modem_state & CHR_TIOCM_RTS? */
- if (be && be->chr_can_read && be->chr_can_read(be->opaque) &&
- be->chr_read) {
- be->chr_read(be->opaque,
- s->outfifo + s->out_start++, 1);
+ if (qemu_chr_be_can_write(chr)) {
+ qemu_chr_be_write(chr, s->outfifo + s->out_start++, 1);
s->out_len--;
if (s->out_start >= s->out_size) {
s->out_start = 0;
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 4dcee571c0..4a2c124104 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -23,7 +23,8 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
+#include "chardev/char-serial.h"
#include "qemu/timer.h"
#include "qemu/log.h"
#include "hw/char/cadence_uart.h"
diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
index 80dce07e7f..762e3d8ada 100644
--- a/hw/char/debugcon.c
+++ b/hw/char/debugcon.c
@@ -27,7 +27,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "hw/isa/isa.h"
#include "hw/i386/pc.h"
diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
index 029f5bbf5e..34306e11ff 100644
--- a/hw/char/digic-uart.c
+++ b/hw/char/digic-uart.c
@@ -29,7 +29,7 @@
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "qemu/log.h"
#include "hw/char/digic-uart.h"
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 9228091cec..3f787632c7 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -26,7 +26,8 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "hw/char/escc.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
+#include "chardev/char-serial.h"
#include "ui/console.h"
#include "ui/input.h"
#include "trace.h"
diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c
index 54383878e0..c1fba9f50f 100644
--- a/hw/char/etraxfs_ser.c
+++ b/hw/char/etraxfs_ser.c
@@ -24,7 +24,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "qemu/log.h"
#define D(x)
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index bff706ab3a..b51d44a321 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -23,7 +23,8 @@
#include "hw/sysbus.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
+#include "chardev/char-serial.h"
#include "hw/arm/exynos4210.h"
diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
index db686e6a6f..32d98edf49 100644
--- a/hw/char/grlib_apbuart.c
+++ b/hw/char/grlib_apbuart.c
@@ -24,7 +24,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "trace.h"
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index 52e67f8dc9..af250305be 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -21,7 +21,6 @@
#include "qemu/osdep.h"
#include "hw/char/imx_serial.h"
#include "sysemu/sysemu.h"
-#include "sysemu/char.h"
#include "qemu/log.h"
#ifndef DEBUG_IMX_UART
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 93929c2880..337a3e566a 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -11,7 +11,7 @@
#include "qemu/osdep.h"
#include "hw/ipack/ipack.h"
#include "qemu/bitops.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
/* #define DEBUG_IPOCTAL */
diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c
index f8c1e0d076..3948dcd332 100644
--- a/hw/char/lm32_juart.c
+++ b/hw/char/lm32_juart.c
@@ -21,7 +21,7 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "trace.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "hw/char/lm32_juart.h"
diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c
index 7f3597c4b0..cff8c38f90 100644
--- a/hw/char/lm32_uart.c
+++ b/hw/char/lm32_uart.c
@@ -26,7 +26,7 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "trace.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "qemu/error-report.h"
enum {
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index e69672f4e9..fe12ad5ccb 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -9,7 +9,7 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "hw/m68k/mcf.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "exec/address-spaces.h"
#include "qapi/error.h"
diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index ae8e2f3554..e19d0f6520 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -25,7 +25,7 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "trace.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "qemu/error-report.h"
enum {
diff --git a/hw/char/omap_uart.c b/hw/char/omap_uart.c
index 31ebb1592c..6fd1b9cf6b 100644
--- a/hw/char/omap_uart.c
+++ b/hw/char/omap_uart.c
@@ -18,7 +18,7 @@
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#include "hw/hw.h"
#include "hw/arm/omap.h"
#include "hw/char/serial.h"
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index c71a4a0f4f..75a1a2f55e 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -25,7 +25,8 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
-#include "sysemu/char.h"
+#include "chardev/char-parallel.h"
+#include "chardev/char-fe.h"
#include "hw/isa/isa.h"
#include "hw/i386/pc.h"
#include "sysemu/sysemu.h"
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 24ea9738b6..33802f00c8 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -9,7 +9,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "qemu/log.h"
#include "trace.h"
diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index 07d6ebd112..1b15046690 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -17,7 +17,7 @@
#include "hw/qdev.h"
#include "qemu/thread.h"
#include "qemu/error-report.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "hw/s390x/sclp.h"
#include "hw/s390x/event-facility.h"
diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index b78f240a73..4a107a268d 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -19,7 +19,7 @@
#include "hw/s390x/sclp.h"
#include "hw/s390x/event-facility.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
typedef struct ASCIIConsoleData {
EventBufferHeader ebh;
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 03d890ca24..e1f12507bf 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -25,7 +25,7 @@
#include "qemu/osdep.h"
#include "hw/char/serial.h"
-#include "sysemu/char.h"
+#include "chardev/char-serial.h"
#include "qapi/error.h"
#include "qemu/timer.h"
#include "exec/address-spaces.h"
@@ -905,7 +905,7 @@ void serial_realize_core(SerialState *s, Error **errp)
void serial_exit_core(SerialState *s)
{
- qemu_chr_fe_deinit(&s->chr);
+ qemu_chr_fe_deinit(&s->chr, false);
timer_del(s->modem_status_poll);
timer_free(s->modem_status_poll);
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 303eb0a678..ca9816d045 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -27,7 +27,7 @@
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "hw/sh4/sh.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "exec/address-spaces.h"
#include "qapi/error.h"
diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c
index e30c8da57c..8f02f3a612 100644
--- a/hw/char/spapr_vty.c
+++ b/hw/char/spapr_vty.c
@@ -4,7 +4,7 @@
#include "qemu-common.h"
#include "cpu.h"
#include "hw/qdev.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "hw/ppc/spapr.h"
#include "hw/ppc/spapr_vio.h"
diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
index b2dda01baa..7b10a04f18 100644
--- a/hw/char/terminal3270.c
+++ b/hw/char/terminal3270.c
@@ -13,7 +13,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "hw/s390x/3270-ccw.h"
/* Enough spaces for different window sizes. */
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index 798d9b69fd..0cb1668c8a 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -11,7 +11,7 @@
*/
#include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "qemu/error-report.h"
#include "trace.h"
#include "hw/virtio/virtio-serial.h"
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c
index c01f41090e..f9af8cadf4 100644
--- a/hw/char/xen_console.c
+++ b/hw/char/xen_console.c
@@ -25,7 +25,7 @@
#include "qapi/error.h"
#include "hw/hw.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "hw/xen/xen_backend.h"
#include "qapi/error.h"
@@ -261,7 +261,7 @@ static void con_disconnect(struct XenDevice *xendev)
{
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
- qemu_chr_fe_deinit(&con->chr);
+ qemu_chr_fe_deinit(&con->chr, false);
xen_pv_unbind_evtchn(&con->xendev);
if (con->sring) {
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
index 37d313b429..71ed2fc1be 100644
--- a/hw/char/xilinx_uartlite.c
+++ b/hw/char/xilinx_uartlite.c
@@ -24,7 +24,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#define DUART(x)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 79c2014135..3bef41914d 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -20,7 +20,7 @@
#include "hw/block/block.h"
#include "net/hub.h"
#include "qapi/visitor.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "sysemu/iothread.h"
static void get_pointer(Object *obj, Visitor *v, Property *prop,
@@ -225,7 +225,7 @@ static void release_chr(Object *obj, const char *name, void *opaque)
Property *prop = opaque;
CharBackend *be = qdev_get_prop_ptr(dev, prop);
- qemu_chr_fe_deinit(be);
+ qemu_chr_fe_deinit(be, false);
}
PropertyInfo qdev_prop_chr = {
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index fa3617db2d..9f1a497322 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -9,7 +9,7 @@
#include "hw/block/block.h"
#include "net/hub.h"
#include "qapi/visitor.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
void qdev_prop_set_after_realize(DeviceState *dev, const char *name,
Error **errp)
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 7a8727aa21..e76c0d805c 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -28,7 +28,6 @@
#include "hw/hw.h"
#include "ui/console.h"
-#include "sysemu/char.h"
#include "hw/xen/xen_backend.h"
#include <xen/event_channel.h>
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 919f09b694..1acd4de405 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -18,7 +18,6 @@
#include "hw/xen/xen_backend.h"
#include "qmp-commands.h"
-#include "sysemu/char.h"
#include "qemu/error-report.h"
#include "qemu/range.h"
#include "sysemu/xen-mapcache.h"
diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index e8e3d250b6..329b03e17f 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -30,7 +30,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/timer.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "sysemu/sysemu.h"
#include "hw/ipmi/ipmi.h"
diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
index c707d24db4..5ce9f0a062 100644
--- a/hw/isa/pc87312.c
+++ b/hw/isa/pc87312.c
@@ -30,7 +30,7 @@
#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "sysemu/sysemu.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#include "trace.h"
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index 53d1e0ce45..a4677f7da4 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -35,7 +35,7 @@
#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include "qemu/log.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#include "sysemu/device_tree.h"
#include "sysemu/sysemu.h"
#include "sysemu/qtest.h"
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index e636c3abaa..dbe2805acb 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -32,7 +32,6 @@
#include "hw/mips/mips.h"
#include "hw/mips/cpudevs.h"
#include "hw/pci/pci.h"
-#include "sysemu/char.h"
#include "sysemu/sysemu.h"
#include "audio/audio.h"
#include "qemu/log.h"
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 7814c39654..95cdabb2dd 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -37,7 +37,6 @@
#include "hw/mips/mips.h"
#include "hw/mips/cpudevs.h"
#include "hw/pci/pci.h"
-#include "sysemu/char.h"
#include "sysemu/sysemu.h"
#include "sysemu/arch_init.h"
#include "qemu/log.h"
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 475e36a4c7..6367d041f0 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -29,7 +29,7 @@
#include "qemu/error-report.h"
#include "qemu/event_notifier.h"
#include "qom/object_interfaces.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "sysemu/hostmem.h"
#include "sysemu/qtest.h"
#include "qapi/visitor.h"
diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c
index 46b1aa17fa..0843bf185c 100644
--- a/hw/net/xgmac.c
+++ b/hw/net/xgmac.c
@@ -26,7 +26,6 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
-#include "sysemu/char.h"
#include "qemu/log.h"
#include "net/net.h"
#include "net/checksum.h"
diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 73e2a1884f..57acd85a87 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -28,7 +28,6 @@
#include "qapi/error.h"
#include "cpu.h"
#include "sysemu/sysemu.h"
-#include "sysemu/char.h"
#include "hw/qdev.h"
#include "sysemu/device_tree.h"
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 128d993d04..b666a4c15c 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -29,7 +29,6 @@
#include "qemu/log.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
-#include "sysemu/char.h"
#include "hw/qdev.h"
#include "sysemu/device_tree.h"
#include "sysemu/cpus.h"
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 6e16478413..f415997649 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -28,7 +28,6 @@
#include "hw/hw.h"
#include "qemu/timer.h"
#include "hw/ptimer.h"
-#include "sysemu/char.h"
#include "sysemu/sysemu.h"
#include "sysemu/qtest.h"
#include "hw/boards.h"
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index 99627860a3..e646eb243b 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -33,7 +33,7 @@
#include <vcard_emul.h>
#include "qemu/thread.h"
-#include "sysemu/char.h"
+#include "qemu/main-loop.h"
#include "ccid.h"
#define DPRINTF(card, lvl, fmt, ...) \
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index a41b0d6ec5..ac1725eeae 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -9,7 +9,7 @@
*/
#include "qemu/osdep.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "ccid.h"
@@ -264,10 +264,7 @@ static void ccid_card_vscard_handle_message(PassthruState *card,
static void ccid_card_vscard_drop_connection(PassthruState *card)
{
- Chardev *chr = qemu_chr_fe_get_driver(&card->cs);
-
- qemu_chr_fe_deinit(&card->cs);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&card->cs, true);
card->vscard_in_pos = card->vscard_in_hdr = 0;
}
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 76ceca1f5c..bfbf7cdce7 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -15,7 +15,8 @@
#include "qemu/error-report.h"
#include "hw/usb.h"
#include "hw/usb/desc.h"
-#include "sysemu/char.h"
+#include "chardev/char-serial.h"
+#include "chardev/char-fe.h"
//#define DEBUG_Serial
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index ad5ef783a6..aa22d69216 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -33,7 +33,7 @@
#include "qapi/qmp/qerror.h"
#include "qemu/error-report.h"
#include "qemu/iov.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include <usbredirparser.h>
#include <usbredirfilter.h>
@@ -1419,10 +1419,8 @@ static void usbredir_cleanup_device_queues(USBRedirDevice *dev)
static void usbredir_unrealize(USBDevice *udev, Error **errp)
{
USBRedirDevice *dev = USB_REDIRECT(udev);
- Chardev *chr = qemu_chr_fe_get_driver(&dev->cs);
- qemu_chr_fe_deinit(&dev->cs);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&dev->cs, true);
/* Note must be done after qemu_chr_close, as that causes a close event */
qemu_bh_delete(dev->chardev_close_bh);
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 7a9bb1d406..958ee09bcb 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -13,7 +13,7 @@
#include "hw/virtio/vhost.h"
#include "hw/virtio/vhost-backend.h"
#include "hw/virtio/virtio-net.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "sysemu/kvm.h"
#include "qemu/error-report.h"
#include "qemu/sockets.h"
diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index a9055e9eba..0bed5770c9 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/xen-common.c
@@ -11,7 +11,7 @@
#include "qemu/osdep.h"
#include "hw/xen/xen_backend.h"
#include "qmp-commands.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#include "sysemu/accel.h"
#include "migration/migration.h"
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index 3570f37e56..c46cbb0759 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -28,7 +28,6 @@
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "hw/boards.h"
-#include "sysemu/char.h"
#include "qemu/log.h"
#include "qapi/error.h"
#include "hw/xen/xen_backend.h"
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index 4636f8e934..d5ac080d4a 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -40,7 +40,7 @@
#include "hw/sysbus.h"
#include "hw/block/flash.h"
#include "sysemu/block-backend.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#include "sysemu/device_tree.h"
#include "qemu/error-report.h"
#include "bootparam.h"