diff mbox

[07/13] chardev: serial & parallel declaration to own headers

Message ID 20170509113332.4987-8-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau May 9, 2017, 11:33 a.m. UTC
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/chardev/char-parallel.h | 20 +++++++++++++++++++-
 include/chardev/char-serial.h   | 22 ++++++++++++++++++++++
 include/chardev/char.h          | 36 ------------------------------------
 hw/arm/strongarm.c              |  2 +-
 hw/bt/hci-csr.c                 |  2 +-
 hw/char/cadence_uart.c          |  2 +-
 hw/char/escc.c                  |  2 +-
 hw/char/exynos4210_uart.c       |  2 +-
 hw/char/parallel.c              |  2 +-
 hw/char/serial.c                |  2 +-
 hw/usb/dev-serial.c             |  2 +-
 11 files changed, 49 insertions(+), 45 deletions(-)

Comments

Paolo Bonzini May 9, 2017, 11:41 a.m. UTC | #1
On 09/05/2017 13:33, Marc-André Lureau wrote:
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/chardev/char-parallel.h | 20 +++++++++++++++++++-
>  include/chardev/char-serial.h   | 22 ++++++++++++++++++++++
>  include/chardev/char.h          | 36 ------------------------------------
>  hw/arm/strongarm.c              |  2 +-
>  hw/bt/hci-csr.c                 |  2 +-
>  hw/char/cadence_uart.c          |  2 +-
>  hw/char/escc.c                  |  2 +-
>  hw/char/exynos4210_uart.c       |  2 +-
>  hw/char/parallel.c              |  2 +-
>  hw/char/serial.c                |  2 +-
>  hw/usb/dev-serial.c             |  2 +-
>  11 files changed, 49 insertions(+), 45 deletions(-)
> 
> diff --git a/include/chardev/char-parallel.h b/include/chardev/char-parallel.h
> index 26742f9d5c..3284a1b96b 100644
> --- a/include/chardev/char-parallel.h
> +++ b/include/chardev/char-parallel.h
> @@ -24,9 +24,27 @@
>  #ifndef CHAR_PARALLEL_H
>  #define CHAR_PARALLEL_H
>  
> -#if defined(__linux__) || defined(__FreeBSD__) || \
> +#include "chardev/char.h"
> +
> +#if defined(__linux__) || defined(__FreeBSD__) ||               \
>      defined(__FreeBSD_kernel__) || defined(__DragonFly__)
>  #define HAVE_CHARDEV_PARPORT 1
>  #endif
>  
> +#define CHR_IOCTL_PP_READ_DATA        3
> +#define CHR_IOCTL_PP_WRITE_DATA       4
> +#define CHR_IOCTL_PP_READ_CONTROL     5
> +#define CHR_IOCTL_PP_WRITE_CONTROL    6
> +#define CHR_IOCTL_PP_READ_STATUS      7
> +#define CHR_IOCTL_PP_EPP_READ_ADDR    8
> +#define CHR_IOCTL_PP_EPP_READ         9
> +#define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
> +#define CHR_IOCTL_PP_EPP_WRITE       11
> +#define CHR_IOCTL_PP_DATA_DIR        12
> +
> +struct ParallelIOArg {
> +    void *buffer;
> +    int count;
> +};
> +
>  #endif /* CHAR_PARALLEL_H */
> diff --git a/include/chardev/char-serial.h b/include/chardev/char-serial.h
> index 64a27f63b1..cb2e59e82a 100644
> --- a/include/chardev/char-serial.h
> +++ b/include/chardev/char-serial.h
> @@ -24,6 +24,8 @@
>  #ifndef CHAR_SERIAL_H
>  #define CHAR_SERIAL_H
>  
> +#include "chardev/char.h"
> +
>  #ifdef _WIN32
>  #define HAVE_CHARDEV_SERIAL 1
>  #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
> @@ -32,4 +34,24 @@
>  #define HAVE_CHARDEV_SERIAL 1
>  #endif
>  
> +#define CHR_IOCTL_SERIAL_SET_PARAMS   1
> +typedef struct {
> +    int speed;
> +    int parity;
> +    int data_bits;
> +    int stop_bits;
> +} QEMUSerialSetParams;
> +
> +#define CHR_IOCTL_SERIAL_SET_BREAK    2
> +
> +#define CHR_IOCTL_SERIAL_SET_TIOCM   13
> +#define CHR_IOCTL_SERIAL_GET_TIOCM   14
> +
> +#define CHR_TIOCM_CTS   0x020
> +#define CHR_TIOCM_CAR   0x040
> +#define CHR_TIOCM_DSR   0x100
> +#define CHR_TIOCM_RI    0x080
> +#define CHR_TIOCM_DTR   0x002
> +#define CHR_TIOCM_RTS   0x004
> +
>  #endif
> diff --git a/include/chardev/char.h b/include/chardev/char.h
> index ea9f2cb7d6..0e1ef1ea4f 100644
> --- a/include/chardev/char.h
> +++ b/include/chardev/char.h
> @@ -27,42 +27,6 @@ typedef enum {
>  
>  #define CHR_READ_BUF_LEN 4096
>  
> -#define CHR_IOCTL_SERIAL_SET_PARAMS   1
> -typedef struct {
> -    int speed;
> -    int parity;
> -    int data_bits;
> -    int stop_bits;
> -} QEMUSerialSetParams;
> -
> -#define CHR_IOCTL_SERIAL_SET_BREAK    2
> -
> -#define CHR_IOCTL_PP_READ_DATA        3
> -#define CHR_IOCTL_PP_WRITE_DATA       4
> -#define CHR_IOCTL_PP_READ_CONTROL     5
> -#define CHR_IOCTL_PP_WRITE_CONTROL    6
> -#define CHR_IOCTL_PP_READ_STATUS      7
> -#define CHR_IOCTL_PP_EPP_READ_ADDR    8
> -#define CHR_IOCTL_PP_EPP_READ         9
> -#define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
> -#define CHR_IOCTL_PP_EPP_WRITE       11
> -#define CHR_IOCTL_PP_DATA_DIR        12
> -
> -struct ParallelIOArg {
> -    void *buffer;
> -    int count;
> -};
> -
> -#define CHR_IOCTL_SERIAL_SET_TIOCM   13
> -#define CHR_IOCTL_SERIAL_GET_TIOCM   14
> -
> -#define CHR_TIOCM_CTS	0x020
> -#define CHR_TIOCM_CAR	0x040
> -#define CHR_TIOCM_DSR	0x100
> -#define CHR_TIOCM_RI	0x080
> -#define CHR_TIOCM_DTR	0x002
> -#define CHR_TIOCM_RTS	0x004
> -
>  typedef void IOEventHandler(void *opaque, int event);
>  
>  typedef enum {

Hmm, this makes the previous patch more desirable.

> diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
> index 66cad198d4..967caea749 100644
> --- a/hw/arm/strongarm.c
> +++ b/hw/arm/strongarm.c
> @@ -34,7 +34,7 @@
>  #include "strongarm.h"
>  #include "qemu/error-report.h"
>  #include "hw/arm/arm.h"
> -#include "chardev/char.h"
> +#include "chardev/char-serial.h"

Should this include both?  Likewise for all those below.

Thanks,

Paolo

>  #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 cc2087392e..0f2021086d 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 "chardev/char.h"
> +#include "chardev/char-serial.h"
>  #include "qemu/timer.h"
>  #include "qemu/bswap.h"
>  #include "hw/irq.h"
> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> index cf4c1d56ff..4bfc185376 100644
> --- a/hw/char/cadence_uart.c
> +++ b/hw/char/cadence_uart.c
> @@ -23,7 +23,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "hw/sysbus.h"
> -#include "chardev/char.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/escc.c b/hw/char/escc.c
> index df89d58eed..81d792cb47 100644
> --- a/hw/char/escc.c
> +++ b/hw/char/escc.c
> @@ -26,7 +26,7 @@
>  #include "hw/hw.h"
>  #include "hw/sysbus.h"
>  #include "hw/char/escc.h"
> -#include "chardev/char.h"
> +#include "chardev/char-serial.h"
>  #include "ui/console.h"
>  #include "ui/input.h"
>  #include "trace.h"
> diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
> index 94952fb90f..d93125645a 100644
> --- a/hw/char/exynos4210_uart.c
> +++ b/hw/char/exynos4210_uart.c
> @@ -23,7 +23,7 @@
>  #include "hw/sysbus.h"
>  #include "qemu/error-report.h"
>  #include "sysemu/sysemu.h"
> -#include "chardev/char.h"
> +#include "chardev/char-serial.h"
>  
>  #include "hw/arm/exynos4210.h"
>  
> diff --git a/hw/char/parallel.c b/hw/char/parallel.c
> index c926df0bee..1d6c6e9f33 100644
> --- a/hw/char/parallel.c
> +++ b/hw/char/parallel.c
> @@ -25,7 +25,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "hw/hw.h"
> -#include "chardev/char.h"
> +#include "chardev/char-parallel.h"
>  #include "hw/isa/isa.h"
>  #include "hw/i386/pc.h"
>  #include "sysemu/sysemu.h"
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index aa336333be..23e5fe9d18 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 "chardev/char.h"
> +#include "chardev/char-serial.h"
>  #include "qapi/error.h"
>  #include "qemu/timer.h"
>  #include "exec/address-spaces.h"
> diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
> index c19cd310c2..4f592d0f82 100644
> --- a/hw/usb/dev-serial.c
> +++ b/hw/usb/dev-serial.c
> @@ -15,7 +15,7 @@
>  #include "qemu/error-report.h"
>  #include "hw/usb.h"
>  #include "hw/usb/desc.h"
> -#include "chardev/char.h"
> +#include "chardev/char-serial.h"
>  
>  //#define DEBUG_Serial
>  
>
Marc-André Lureau May 26, 2017, 11:41 a.m. UTC | #2
Hi

On Tue, May 9, 2017 at 3:49 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

>
>
> On 09/05/2017 13:33, Marc-André Lureau wrote:
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  include/chardev/char-parallel.h | 20 +++++++++++++++++++-
> >  include/chardev/char-serial.h   | 22 ++++++++++++++++++++++
> >  include/chardev/char.h          | 36
> ------------------------------------
> >  hw/arm/strongarm.c              |  2 +-
> >  hw/bt/hci-csr.c                 |  2 +-
> >  hw/char/cadence_uart.c          |  2 +-
> >  hw/char/escc.c                  |  2 +-
> >  hw/char/exynos4210_uart.c       |  2 +-
> >  hw/char/parallel.c              |  2 +-
> >  hw/char/serial.c                |  2 +-
> >  hw/usb/dev-serial.c             |  2 +-
> >  11 files changed, 49 insertions(+), 45 deletions(-)
> >
> > diff --git a/include/chardev/char-parallel.h
> b/include/chardev/char-parallel.h
> > index 26742f9d5c..3284a1b96b 100644
> > --- a/include/chardev/char-parallel.h
> > +++ b/include/chardev/char-parallel.h
> > @@ -24,9 +24,27 @@
> >  #ifndef CHAR_PARALLEL_H
> >  #define CHAR_PARALLEL_H
> >
> > -#if defined(__linux__) || defined(__FreeBSD__) || \
> > +#include "chardev/char.h"
> > +
> > +#if defined(__linux__) || defined(__FreeBSD__) ||               \
> >      defined(__FreeBSD_kernel__) || defined(__DragonFly__)
> >  #define HAVE_CHARDEV_PARPORT 1
> >  #endif
> >
> > +#define CHR_IOCTL_PP_READ_DATA        3
> > +#define CHR_IOCTL_PP_WRITE_DATA       4
> > +#define CHR_IOCTL_PP_READ_CONTROL     5
> > +#define CHR_IOCTL_PP_WRITE_CONTROL    6
> > +#define CHR_IOCTL_PP_READ_STATUS      7
> > +#define CHR_IOCTL_PP_EPP_READ_ADDR    8
> > +#define CHR_IOCTL_PP_EPP_READ         9
> > +#define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
> > +#define CHR_IOCTL_PP_EPP_WRITE       11
> > +#define CHR_IOCTL_PP_DATA_DIR        12
> > +
> > +struct ParallelIOArg {
> > +    void *buffer;
> > +    int count;
> > +};
> > +
> >  #endif /* CHAR_PARALLEL_H */
> > diff --git a/include/chardev/char-serial.h
> b/include/chardev/char-serial.h
> > index 64a27f63b1..cb2e59e82a 100644
> > --- a/include/chardev/char-serial.h
> > +++ b/include/chardev/char-serial.h
> > @@ -24,6 +24,8 @@
> >  #ifndef CHAR_SERIAL_H
> >  #define CHAR_SERIAL_H
> >
> > +#include "chardev/char.h"
> > +
> >  #ifdef _WIN32
> >  #define HAVE_CHARDEV_SERIAL 1
> >  #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)
> \
> > @@ -32,4 +34,24 @@
> >  #define HAVE_CHARDEV_SERIAL 1
> >  #endif
> >
> > +#define CHR_IOCTL_SERIAL_SET_PARAMS   1
> > +typedef struct {
> > +    int speed;
> > +    int parity;
> > +    int data_bits;
> > +    int stop_bits;
> > +} QEMUSerialSetParams;
> > +
> > +#define CHR_IOCTL_SERIAL_SET_BREAK    2
> > +
> > +#define CHR_IOCTL_SERIAL_SET_TIOCM   13
> > +#define CHR_IOCTL_SERIAL_GET_TIOCM   14
> > +
> > +#define CHR_TIOCM_CTS   0x020
> > +#define CHR_TIOCM_CAR   0x040
> > +#define CHR_TIOCM_DSR   0x100
> > +#define CHR_TIOCM_RI    0x080
> > +#define CHR_TIOCM_DTR   0x002
> > +#define CHR_TIOCM_RTS   0x004
> > +
> >  #endif
> > diff --git a/include/chardev/char.h b/include/chardev/char.h
> > index ea9f2cb7d6..0e1ef1ea4f 100644
> > --- a/include/chardev/char.h
> > +++ b/include/chardev/char.h
> > @@ -27,42 +27,6 @@ typedef enum {
> >
> >  #define CHR_READ_BUF_LEN 4096
> >
> > -#define CHR_IOCTL_SERIAL_SET_PARAMS   1
> > -typedef struct {
> > -    int speed;
> > -    int parity;
> > -    int data_bits;
> > -    int stop_bits;
> > -} QEMUSerialSetParams;
> > -
> > -#define CHR_IOCTL_SERIAL_SET_BREAK    2
> > -
> > -#define CHR_IOCTL_PP_READ_DATA        3
> > -#define CHR_IOCTL_PP_WRITE_DATA       4
> > -#define CHR_IOCTL_PP_READ_CONTROL     5
> > -#define CHR_IOCTL_PP_WRITE_CONTROL    6
> > -#define CHR_IOCTL_PP_READ_STATUS      7
> > -#define CHR_IOCTL_PP_EPP_READ_ADDR    8
> > -#define CHR_IOCTL_PP_EPP_READ         9
> > -#define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
> > -#define CHR_IOCTL_PP_EPP_WRITE       11
> > -#define CHR_IOCTL_PP_DATA_DIR        12
> > -
> > -struct ParallelIOArg {
> > -    void *buffer;
> > -    int count;
> > -};
> > -
> > -#define CHR_IOCTL_SERIAL_SET_TIOCM   13
> > -#define CHR_IOCTL_SERIAL_GET_TIOCM   14
> > -
> > -#define CHR_TIOCM_CTS        0x020
> > -#define CHR_TIOCM_CAR        0x040
> > -#define CHR_TIOCM_DSR        0x100
> > -#define CHR_TIOCM_RI 0x080
> > -#define CHR_TIOCM_DTR        0x002
> > -#define CHR_TIOCM_RTS        0x004
> > -
> >  typedef void IOEventHandler(void *opaque, int event);
> >
> >  typedef enum {
>
> Hmm, this makes the previous patch more desirable.
>

Yeah, I think it's a bit simpler if we put all chardev/ headers under
include/chardev, since files outside chardev/ include headers like
char-serial.h or char-parallel.h and it helps cleaning the headers.

We could limit it to headers accessed outside chardev/, that is probably
mainly -serial and -parellel (I haven't checked)


> > diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
> > index 66cad198d4..967caea749 100644
> > --- a/hw/arm/strongarm.c
> > +++ b/hw/arm/strongarm.c
> > @@ -34,7 +34,7 @@
> >  #include "strongarm.h"
> >  #include "qemu/error-report.h"
> >  #include "hw/arm/arm.h"
> > -#include "chardev/char.h"
> > +#include "chardev/char-serial.h"
>
> Should this include both?  Likewise for all those below.
>

Well the patch makes char-serial.h implicitely includes char.h. Anything
wrong with that?

thanks
diff mbox

Patch

diff --git a/include/chardev/char-parallel.h b/include/chardev/char-parallel.h
index 26742f9d5c..3284a1b96b 100644
--- a/include/chardev/char-parallel.h
+++ b/include/chardev/char-parallel.h
@@ -24,9 +24,27 @@ 
 #ifndef CHAR_PARALLEL_H
 #define CHAR_PARALLEL_H
 
-#if defined(__linux__) || defined(__FreeBSD__) || \
+#include "chardev/char.h"
+
+#if defined(__linux__) || defined(__FreeBSD__) ||               \
     defined(__FreeBSD_kernel__) || defined(__DragonFly__)
 #define HAVE_CHARDEV_PARPORT 1
 #endif
 
+#define CHR_IOCTL_PP_READ_DATA        3
+#define CHR_IOCTL_PP_WRITE_DATA       4
+#define CHR_IOCTL_PP_READ_CONTROL     5
+#define CHR_IOCTL_PP_WRITE_CONTROL    6
+#define CHR_IOCTL_PP_READ_STATUS      7
+#define CHR_IOCTL_PP_EPP_READ_ADDR    8
+#define CHR_IOCTL_PP_EPP_READ         9
+#define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
+#define CHR_IOCTL_PP_EPP_WRITE       11
+#define CHR_IOCTL_PP_DATA_DIR        12
+
+struct ParallelIOArg {
+    void *buffer;
+    int count;
+};
+
 #endif /* CHAR_PARALLEL_H */
diff --git a/include/chardev/char-serial.h b/include/chardev/char-serial.h
index 64a27f63b1..cb2e59e82a 100644
--- a/include/chardev/char-serial.h
+++ b/include/chardev/char-serial.h
@@ -24,6 +24,8 @@ 
 #ifndef CHAR_SERIAL_H
 #define CHAR_SERIAL_H
 
+#include "chardev/char.h"
+
 #ifdef _WIN32
 #define HAVE_CHARDEV_SERIAL 1
 #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
@@ -32,4 +34,24 @@ 
 #define HAVE_CHARDEV_SERIAL 1
 #endif
 
+#define CHR_IOCTL_SERIAL_SET_PARAMS   1
+typedef struct {
+    int speed;
+    int parity;
+    int data_bits;
+    int stop_bits;
+} QEMUSerialSetParams;
+
+#define CHR_IOCTL_SERIAL_SET_BREAK    2
+
+#define CHR_IOCTL_SERIAL_SET_TIOCM   13
+#define CHR_IOCTL_SERIAL_GET_TIOCM   14
+
+#define CHR_TIOCM_CTS   0x020
+#define CHR_TIOCM_CAR   0x040
+#define CHR_TIOCM_DSR   0x100
+#define CHR_TIOCM_RI    0x080
+#define CHR_TIOCM_DTR   0x002
+#define CHR_TIOCM_RTS   0x004
+
 #endif
diff --git a/include/chardev/char.h b/include/chardev/char.h
index ea9f2cb7d6..0e1ef1ea4f 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -27,42 +27,6 @@  typedef enum {
 
 #define CHR_READ_BUF_LEN 4096
 
-#define CHR_IOCTL_SERIAL_SET_PARAMS   1
-typedef struct {
-    int speed;
-    int parity;
-    int data_bits;
-    int stop_bits;
-} QEMUSerialSetParams;
-
-#define CHR_IOCTL_SERIAL_SET_BREAK    2
-
-#define CHR_IOCTL_PP_READ_DATA        3
-#define CHR_IOCTL_PP_WRITE_DATA       4
-#define CHR_IOCTL_PP_READ_CONTROL     5
-#define CHR_IOCTL_PP_WRITE_CONTROL    6
-#define CHR_IOCTL_PP_READ_STATUS      7
-#define CHR_IOCTL_PP_EPP_READ_ADDR    8
-#define CHR_IOCTL_PP_EPP_READ         9
-#define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
-#define CHR_IOCTL_PP_EPP_WRITE       11
-#define CHR_IOCTL_PP_DATA_DIR        12
-
-struct ParallelIOArg {
-    void *buffer;
-    int count;
-};
-
-#define CHR_IOCTL_SERIAL_SET_TIOCM   13
-#define CHR_IOCTL_SERIAL_GET_TIOCM   14
-
-#define CHR_TIOCM_CTS	0x020
-#define CHR_TIOCM_CAR	0x040
-#define CHR_TIOCM_DSR	0x100
-#define CHR_TIOCM_RI	0x080
-#define CHR_TIOCM_DTR	0x002
-#define CHR_TIOCM_RTS	0x004
-
 typedef void IOEventHandler(void *opaque, int event);
 
 typedef enum {
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 66cad198d4..967caea749 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -34,7 +34,7 @@ 
 #include "strongarm.h"
 #include "qemu/error-report.h"
 #include "hw/arm/arm.h"
-#include "chardev/char.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 cc2087392e..0f2021086d 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 "chardev/char.h"
+#include "chardev/char-serial.h"
 #include "qemu/timer.h"
 #include "qemu/bswap.h"
 #include "hw/irq.h"
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index cf4c1d56ff..4bfc185376 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -23,7 +23,7 @@ 
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "chardev/char.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/escc.c b/hw/char/escc.c
index df89d58eed..81d792cb47 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -26,7 +26,7 @@ 
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/char/escc.h"
-#include "chardev/char.h"
+#include "chardev/char-serial.h"
 #include "ui/console.h"
 #include "ui/input.h"
 #include "trace.h"
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index 94952fb90f..d93125645a 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -23,7 +23,7 @@ 
 #include "hw/sysbus.h"
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
-#include "chardev/char.h"
+#include "chardev/char-serial.h"
 
 #include "hw/arm/exynos4210.h"
 
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index c926df0bee..1d6c6e9f33 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -25,7 +25,7 @@ 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/hw.h"
-#include "chardev/char.h"
+#include "chardev/char-parallel.h"
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/char/serial.c b/hw/char/serial.c
index aa336333be..23e5fe9d18 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 "chardev/char.h"
+#include "chardev/char-serial.h"
 #include "qapi/error.h"
 #include "qemu/timer.h"
 #include "exec/address-spaces.h"
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index c19cd310c2..4f592d0f82 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -15,7 +15,7 @@ 
 #include "qemu/error-report.h"
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
-#include "chardev/char.h"
+#include "chardev/char-serial.h"
 
 //#define DEBUG_Serial