diff mbox series

[01/13] hw/char/serial: Allow disconnected chardevs

Message ID 20180420145249.32435-2-peter.maydell@linaro.org
State Accepted
Commit 47c4f85a0c27888e12af827471cfef87deb49821
Headers show
Series Drop compile time limit on number of serial ports | expand

Commit Message

Peter Maydell April 20, 2018, 2:52 p.m. UTC
Currently the serial.c realize code has an explicit check that it is not
connected to a disconnected backend (ie one with a NULL chardev).
This isn't what we want -- you should be able to create a serial device
even if it isn't attached to anything. Remove the check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 hw/char/serial.c | 5 -----
 1 file changed, 5 deletions(-)

-- 
2.17.0

Comments

Philippe Mathieu-Daudé April 20, 2018, 4:28 p.m. UTC | #1
On 04/20/2018 11:52 AM, Peter Maydell wrote:
> Currently the serial.c realize code has an explicit check that it is not

> connected to a disconnected backend (ie one with a NULL chardev).

> This isn't what we want -- you should be able to create a serial device

> even if it isn't attached to anything. Remove the check.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>  hw/char/serial.c | 5 -----

>  1 file changed, 5 deletions(-)

> 

> diff --git a/hw/char/serial.c b/hw/char/serial.c

> index eb72191ee7..2c080c9862 100644

> --- a/hw/char/serial.c

> +++ b/hw/char/serial.c

> @@ -923,11 +923,6 @@ static int serial_be_change(void *opaque)

>  

>  void serial_realize_core(SerialState *s, Error **errp)

>  {

> -    if (!qemu_chr_fe_backend_connected(&s->chr)) {

> -        error_setg(errp, "Can't create serial device, empty char device");

> -        return;

> -    }

> -

>      s->modem_status_poll = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) serial_update_msl, s);

>  

>      s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) fifo_timeout_int, s);

>
Thomas Huth April 25, 2018, 2:37 p.m. UTC | #2
On 20.04.2018 16:52, Peter Maydell wrote:
> Currently the serial.c realize code has an explicit check that it is not

> connected to a disconnected backend (ie one with a NULL chardev).

> This isn't what we want -- you should be able to create a serial device

> even if it isn't attached to anything. Remove the check.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

>  hw/char/serial.c | 5 -----

>  1 file changed, 5 deletions(-)

> 

> diff --git a/hw/char/serial.c b/hw/char/serial.c

> index eb72191ee7..2c080c9862 100644

> --- a/hw/char/serial.c

> +++ b/hw/char/serial.c

> @@ -923,11 +923,6 @@ static int serial_be_change(void *opaque)

>  

>  void serial_realize_core(SerialState *s, Error **errp)

>  {

> -    if (!qemu_chr_fe_backend_connected(&s->chr)) {

> -        error_setg(errp, "Can't create serial device, empty char device");

> -        return;

> -    }

> -

>      s->modem_status_poll = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) serial_update_msl, s);

>  

>      s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) fifo_timeout_int, s);

> 


Acked-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/hw/char/serial.c b/hw/char/serial.c
index eb72191ee7..2c080c9862 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -923,11 +923,6 @@  static int serial_be_change(void *opaque)
 
 void serial_realize_core(SerialState *s, Error **errp)
 {
-    if (!qemu_chr_fe_backend_connected(&s->chr)) {
-        error_setg(errp, "Can't create serial device, empty char device");
-        return;
-    }
-
     s->modem_status_poll = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) serial_update_msl, s);
 
     s->fifo_timeout_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, (QEMUTimerCB *) fifo_timeout_int, s);