All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef
@ 2019-12-17 16:37 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

Hi,

After this chat on #qemu IRC:
13:20 <stsquad> so what is the difference between a IOReadHandler and IOEventHandler?
13:25 <f4bug> stsquad: one is in-band and the other out-of-band?
13:26 <stsquad> f4bug: ahh yes it seems so - connect/disconnect etc...
13:27 <f4bug> see QEMUChrEvent for IOEventHandler

I thought it might be a good opportunity to make the IOEventHandler
typedef meaning more obvious, by using the QEMUChrEvent enum.

To be able to build I had to explicit a 'default' case when frontends
use a switch(event) case and do not handle all events.

Then I used a coccinelle spatch to change the various IOEventHandler.
I don't think the last patch can be split, but suggestions are welcome!

Regards,

Phil.

PD: I use git-publish. To avoid spamming too much, I'm using per-patch
Cc tag, after the '---' separator. This way each recipient should get
the cover and the specific patches of interests, + the last one.

Sent with: 'git publish --suppress-cc=cccmd'

Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>
Cc: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
Cc: Fabien Chouteau <chouteau@adacore.com>
Cc: KONRAD Frederic <frederic.konrad@adacore.com>
Cc: Peter Chubb <peter.chubb@nicta.com.au>
Cc: Alberto Garcia <berto@igalia.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Thomas Huth <huth@tuxfamily.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: Corey Minyard <minyard@acm.org>
Cc: Paul Burton <pburton@wavecomp.com>
Cc: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Zhang Chen <chen.zhang@intel.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-arm@nongnu.org
Cc: qemu-block@nongnu.org
Cc: qemu-s390x@nongnu.org
Cc: qemu-riscv@nongnu.org

Philippe Mathieu-Daudé (14):
  hw/ipmi: Remove unnecessary declarations
  chardev/char: Explicit we ignore some QEMUChrEvent in IOEventHandler
  vhost-user: Explicit we ignore some QEMUChrEvent in IOEventHandler
  virtio-console: Explicit we ignore some QEMUChrEvent in IOEventHandler
  hw/ipmi: Explicit we ignore some QEMUChrEvent in IOEventHandler
  hw/usb/dev-serial: Explicit we ignore few QEMUChrEvent in IOEventHandler
  ccid-card-passthru: Explicit we ignore QEMUChrEvent in IOEventHandler
  hw/usb/redirect: Explicit we ignore few QEMUChrEvent in IOEventHandler
  monitor/qmp: Explicit we ignore few QEMUChrEvent in IOEventHandler
  monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandler
  net/vhost-user: Explicit we ignore few QEMUChrEvent in IOEventHandler
  vhost-user-blk: Explicit we ignore few QEMUChrEvent in IOEventHandler
  hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
  chardev: Use QEMUChrEvent enum in IOEventHandler typedef

 include/chardev/char-fe.h       |  2 +-
 include/chardev/char-mux.h      |  2 +-
 include/chardev/char.h          |  4 ++--
 backends/cryptodev-vhost-user.c |  5 ++++-
 chardev/char-mux.c              |  8 ++++----
 chardev/char.c                  |  7 +++++--
 gdbstub.c                       |  2 +-
 hw/arm/pxa2xx.c                 |  2 +-
 hw/arm/strongarm.c              |  2 +-
 hw/block/vhost-user-blk.c       |  5 ++++-
 hw/char/cadence_uart.c          |  2 +-
 hw/char/digic-uart.c            |  2 +-
 hw/char/escc.c                  |  2 +-
 hw/char/etraxfs_ser.c           |  2 +-
 hw/char/exynos4210_uart.c       |  2 +-
 hw/char/grlib_apbuart.c         |  2 +-
 hw/char/imx_serial.c            |  2 +-
 hw/char/ipoctal232.c            |  2 +-
 hw/char/lm32_juart.c            |  2 +-
 hw/char/lm32_uart.c             |  2 +-
 hw/char/mcf_uart.c              |  2 +-
 hw/char/milkymist-uart.c        |  2 +-
 hw/char/nrf51_uart.c            |  2 +-
 hw/char/pl011.c                 |  2 +-
 hw/char/serial.c                |  2 +-
 hw/char/sh_serial.c             |  2 +-
 hw/char/terminal3270.c          |  5 ++++-
 hw/char/virtio-console.c        |  5 ++++-
 hw/char/xilinx_uartlite.c       |  2 +-
 hw/ipmi/ipmi_bmc_extern.c       | 10 +++++-----
 hw/mips/boston.c                |  2 +-
 hw/mips/mips_malta.c            |  2 +-
 hw/riscv/riscv_htif.c           |  2 +-
 hw/riscv/sifive_uart.c          |  2 +-
 hw/usb/ccid-card-passthru.c     |  5 ++++-
 hw/usb/dev-serial.c             |  5 ++++-
 hw/usb/redirect.c               |  5 ++++-
 monitor/hmp.c                   |  6 +++++-
 monitor/qmp.c                   |  5 ++++-
 net/filter-mirror.c             |  2 +-
 net/vhost-user.c                |  7 +++++--
 qtest.c                         |  2 +-
 tests/test-char.c               |  6 +++---
 tests/vhost-user-test.c         |  2 +-
 44 files changed, 90 insertions(+), 56 deletions(-)

-- 
2.21.0



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 00/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef
@ 2019-12-17 16:37 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

Hi,

After this chat on #qemu IRC:
13:20 <stsquad> so what is the difference between a IOReadHandler and IOEventHandler?
13:25 <f4bug> stsquad: one is in-band and the other out-of-band?
13:26 <stsquad> f4bug: ahh yes it seems so - connect/disconnect etc...
13:27 <f4bug> see QEMUChrEvent for IOEventHandler

I thought it might be a good opportunity to make the IOEventHandler
typedef meaning more obvious, by using the QEMUChrEvent enum.

To be able to build I had to explicit a 'default' case when frontends
use a switch(event) case and do not handle all events.

Then I used a coccinelle spatch to change the various IOEventHandler.
I don't think the last patch can be split, but suggestions are welcome!

Regards,

Phil.

PD: I use git-publish. To avoid spamming too much, I'm using per-patch
Cc tag, after the '---' separator. This way each recipient should get
the cover and the specific patches of interests, + the last one.

Sent with: 'git publish --suppress-cc=cccmd'

Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>
Cc: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
Cc: Fabien Chouteau <chouteau@adacore.com>
Cc: KONRAD Frederic <frederic.konrad@adacore.com>
Cc: Peter Chubb <peter.chubb@nicta.com.au>
Cc: Alberto Garcia <berto@igalia.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Thomas Huth <huth@tuxfamily.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: Corey Minyard <minyard@acm.org>
Cc: Paul Burton <pburton@wavecomp.com>
Cc: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Zhang Chen <chen.zhang@intel.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-arm@nongnu.org
Cc: qemu-block@nongnu.org
Cc: qemu-s390x@nongnu.org
Cc: qemu-riscv@nongnu.org

Philippe Mathieu-Daudé (14):
  hw/ipmi: Remove unnecessary declarations
  chardev/char: Explicit we ignore some QEMUChrEvent in IOEventHandler
  vhost-user: Explicit we ignore some QEMUChrEvent in IOEventHandler
  virtio-console: Explicit we ignore some QEMUChrEvent in IOEventHandler
  hw/ipmi: Explicit we ignore some QEMUChrEvent in IOEventHandler
  hw/usb/dev-serial: Explicit we ignore few QEMUChrEvent in IOEventHandler
  ccid-card-passthru: Explicit we ignore QEMUChrEvent in IOEventHandler
  hw/usb/redirect: Explicit we ignore few QEMUChrEvent in IOEventHandler
  monitor/qmp: Explicit we ignore few QEMUChrEvent in IOEventHandler
  monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandler
  net/vhost-user: Explicit we ignore few QEMUChrEvent in IOEventHandler
  vhost-user-blk: Explicit we ignore few QEMUChrEvent in IOEventHandler
  hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
  chardev: Use QEMUChrEvent enum in IOEventHandler typedef

 include/chardev/char-fe.h       |  2 +-
 include/chardev/char-mux.h      |  2 +-
 include/chardev/char.h          |  4 ++--
 backends/cryptodev-vhost-user.c |  5 ++++-
 chardev/char-mux.c              |  8 ++++----
 chardev/char.c                  |  7 +++++--
 gdbstub.c                       |  2 +-
 hw/arm/pxa2xx.c                 |  2 +-
 hw/arm/strongarm.c              |  2 +-
 hw/block/vhost-user-blk.c       |  5 ++++-
 hw/char/cadence_uart.c          |  2 +-
 hw/char/digic-uart.c            |  2 +-
 hw/char/escc.c                  |  2 +-
 hw/char/etraxfs_ser.c           |  2 +-
 hw/char/exynos4210_uart.c       |  2 +-
 hw/char/grlib_apbuart.c         |  2 +-
 hw/char/imx_serial.c            |  2 +-
 hw/char/ipoctal232.c            |  2 +-
 hw/char/lm32_juart.c            |  2 +-
 hw/char/lm32_uart.c             |  2 +-
 hw/char/mcf_uart.c              |  2 +-
 hw/char/milkymist-uart.c        |  2 +-
 hw/char/nrf51_uart.c            |  2 +-
 hw/char/pl011.c                 |  2 +-
 hw/char/serial.c                |  2 +-
 hw/char/sh_serial.c             |  2 +-
 hw/char/terminal3270.c          |  5 ++++-
 hw/char/virtio-console.c        |  5 ++++-
 hw/char/xilinx_uartlite.c       |  2 +-
 hw/ipmi/ipmi_bmc_extern.c       | 10 +++++-----
 hw/mips/boston.c                |  2 +-
 hw/mips/mips_malta.c            |  2 +-
 hw/riscv/riscv_htif.c           |  2 +-
 hw/riscv/sifive_uart.c          |  2 +-
 hw/usb/ccid-card-passthru.c     |  5 ++++-
 hw/usb/dev-serial.c             |  5 ++++-
 hw/usb/redirect.c               |  5 ++++-
 monitor/hmp.c                   |  6 +++++-
 monitor/qmp.c                   |  5 ++++-
 net/filter-mirror.c             |  2 +-
 net/vhost-user.c                |  7 +++++--
 qtest.c                         |  2 +-
 tests/test-char.c               |  6 +++---
 tests/vhost-user-test.c         |  2 +-
 44 files changed, 90 insertions(+), 56 deletions(-)

-- 
2.21.0



^ permalink raw reply	[flat|nested] 39+ messages in thread

* [PATCH 01/14] hw/ipmi: Remove unnecessary declarations
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, qemu-trivial,
	Michael S. Tsirkin, Markus Armbruster, Halil Pasic,
	Christian Borntraeger, Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	Corey Minyard, qemu-riscv, Igor Mitsyanko, Bastian Koppelmann,
	Cornelia Huck, Max Reitz, Zhang Chen, Michael Walle,
	Palmer Dabbelt, Thomas Huth, Aleksandar Markovic, Aurelien Jarno

Since we don't use these methods before defining them,
no need to forward-declare them.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
---
Cc: Corey Minyard <minyard@acm.org>
In case the other patches are rejected:
Cc: qemu-trivial@nongnu.org
---
 hw/ipmi/ipmi_bmc_extern.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 87da9ff99c..450926e5fb 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -87,10 +87,6 @@ typedef struct IPMIBmcExtern {
     bool send_reset;
 } IPMIBmcExtern;
 
-static int can_receive(void *opaque);
-static void receive(void *opaque, const uint8_t *buf, int size);
-static void chr_event(void *opaque, int event);
-
 static unsigned char
 ipmb_checksum(const unsigned char *data, int size, unsigned char start)
 {
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 01/14] hw/ipmi: Remove unnecessary declarations
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth, Corey Minyard, qemu-trivial

Since we don't use these methods before defining them,
no need to forward-declare them.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
---
Cc: Corey Minyard <minyard@acm.org>
In case the other patches are rejected:
Cc: qemu-trivial@nongnu.org
---
 hw/ipmi/ipmi_bmc_extern.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 87da9ff99c..450926e5fb 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -87,10 +87,6 @@ typedef struct IPMIBmcExtern {
     bool send_reset;
 } IPMIBmcExtern;
 
-static int can_receive(void *opaque);
-static void receive(void *opaque, const uint8_t *buf, int size);
-static void chr_event(void *opaque, int event);
-
 static unsigned char
 ipmb_checksum(const unsigned char *data, int size, unsigned char start)
 {
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 02/14] chardev/char: Explicit we ignore some QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  chardev/char.c: In function ‘qemu_chr_be_event’:
  chardev/char.c:65:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
     65 |     switch (event) {
        |     ^~~~~~
  chardev/char.c:65:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  chardev/char.c:65:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 chardev/char.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/chardev/char.c b/chardev/char.c
index 7b6b2cb123..c4b6bbc55a 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -69,6 +69,9 @@ void qemu_chr_be_event(Chardev *s, int event)
         case CHR_EVENT_CLOSED:
             s->be_open = 0;
             break;
+    default:
+        /* Ignore */
+        break;
     }
 
     CHARDEV_GET_CLASS(s)->chr_be_event(s, event);
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 02/14] chardev/char: Explicit we ignore some QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  chardev/char.c: In function ‘qemu_chr_be_event’:
  chardev/char.c:65:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
     65 |     switch (event) {
        |     ^~~~~~
  chardev/char.c:65:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  chardev/char.c:65:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 chardev/char.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/chardev/char.c b/chardev/char.c
index 7b6b2cb123..c4b6bbc55a 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -69,6 +69,9 @@ void qemu_chr_be_event(Chardev *s, int event)
         case CHR_EVENT_CLOSED:
             s->be_open = 0;
             break;
+    default:
+        /* Ignore */
+        break;
     }
 
     CHARDEV_GET_CLASS(s)->chr_be_event(s, event);
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 03/14] vhost-user: Explicit we ignore some QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      backends/cryptodev-vhost-user.o
  backends/cryptodev-vhost-user.c: In function ‘cryptodev_vhost_user_event’:
  backends/cryptodev-vhost-user.c:163:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    163 |     switch (event) {
        |     ^~~~~~
  backends/cryptodev-vhost-user.c:163:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  backends/cryptodev-vhost-user.c:163:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
---
 backends/cryptodev-vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index b344283940..d700934a0e 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -171,6 +171,9 @@ static void cryptodev_vhost_user_event(void *opaque, int event)
         b->ready = false;
         cryptodev_vhost_user_stop(queues, s);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 03/14] vhost-user: Explicit we ignore some QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      backends/cryptodev-vhost-user.o
  backends/cryptodev-vhost-user.c: In function ‘cryptodev_vhost_user_event’:
  backends/cryptodev-vhost-user.c:163:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    163 |     switch (event) {
        |     ^~~~~~
  backends/cryptodev-vhost-user.c:163:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  backends/cryptodev-vhost-user.c:163:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
---
 backends/cryptodev-vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index b344283940..d700934a0e 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -171,6 +171,9 @@ static void cryptodev_vhost_user_event(void *opaque, int event)
         b->ready = false;
         cryptodev_vhost_user_stop(queues, s);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 04/14] virtio-console: Explicit we ignore some QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      hw/char/virtio-console.o
  hw/char/virtio-console.c: In function ‘chr_event’:
  hw/char/virtio-console.c:154:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    154 |     switch (event) {
        |     ^~~~~~
  hw/char/virtio-console.c:154:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/char/virtio-console.c:154:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/virtio-console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index c13649f1ef..d3f7ba36fe 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -162,6 +162,9 @@ static void chr_event(void *opaque, int event)
         }
         virtio_serial_close(port);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 04/14] virtio-console: Explicit we ignore some QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      hw/char/virtio-console.o
  hw/char/virtio-console.c: In function ‘chr_event’:
  hw/char/virtio-console.c:154:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    154 |     switch (event) {
        |     ^~~~~~
  hw/char/virtio-console.c:154:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/char/virtio-console.c:154:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/virtio-console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index c13649f1ef..d3f7ba36fe 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -162,6 +162,9 @@ static void chr_event(void *opaque, int event)
         }
         virtio_serial_close(port);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 05/14] hw/ipmi: Explicit we ignore some QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  hw/ipmi/ipmi_bmc_extern.c: In function ‘chr_event’:
  hw/ipmi/ipmi_bmc_extern.c:389:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    389 |     switch (event) {
        |     ^~~~~~
  hw/ipmi/ipmi_bmc_extern.c:389:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/ipmi/ipmi_bmc_extern.c:389:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Corey Minyard <minyard@acm.org>
---
 hw/ipmi/ipmi_bmc_extern.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 450926e5fb..9d67e6a4a5 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -435,6 +435,10 @@ static void chr_event(void *opaque, int event)
             k->handle_rsp(s, ibe->outbuf[0], ibe->inbuf + 1, 3);
         }
         break;
+
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 05/14] hw/ipmi: Explicit we ignore some QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:37   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:37 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  hw/ipmi/ipmi_bmc_extern.c: In function ‘chr_event’:
  hw/ipmi/ipmi_bmc_extern.c:389:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    389 |     switch (event) {
        |     ^~~~~~
  hw/ipmi/ipmi_bmc_extern.c:389:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/ipmi/ipmi_bmc_extern.c:389:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Corey Minyard <minyard@acm.org>
---
 hw/ipmi/ipmi_bmc_extern.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 450926e5fb..9d67e6a4a5 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -435,6 +435,10 @@ static void chr_event(void *opaque, int event)
             k->handle_rsp(s, ibe->outbuf[0], ibe->inbuf + 1, 3);
         }
         break;
+
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 06/14] hw/usb/dev-serial: Explicit we ignore few QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  hw/usb/dev-serial.c: In function ‘usb_serial_event’:
  hw/usb/dev-serial.c:468:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
    468 |     switch (event) {
        |     ^~~~~~
  hw/usb/dev-serial.c:468:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 hw/usb/dev-serial.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 45cc74128a..497f932a5a 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -479,6 +479,9 @@ static void usb_serial_event(void *opaque, int event)
                 usb_device_detach(&s->dev);
             }
             break;
+        default:
+            /* Ignore */
+            break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 06/14] hw/usb/dev-serial: Explicit we ignore few QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  hw/usb/dev-serial.c: In function ‘usb_serial_event’:
  hw/usb/dev-serial.c:468:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
    468 |     switch (event) {
        |     ^~~~~~
  hw/usb/dev-serial.c:468:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 hw/usb/dev-serial.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 45cc74128a..497f932a5a 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -479,6 +479,9 @@ static void usb_serial_event(void *opaque, int event)
                 usb_device_detach(&s->dev);
             }
             break;
+        default:
+            /* Ignore */
+            break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 07/14] ccid-card-passthru: Explicit we ignore QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  hw/usb/ccid-card-passthru.c: In function ‘ccid_card_vscard_event’:
  hw/usb/ccid-card-passthru.c:314:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
    314 |     switch (event) {
        |     ^~~~~~
  hw/usb/ccid-card-passthru.c:314:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  hw/usb/ccid-card-passthru.c:314:5: error: enumeration value ‘CHR_EVENT_CLOSED’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/ccid-card-passthru.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 267ed9a8a0..190f268da2 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -318,6 +318,9 @@ static void ccid_card_vscard_event(void *opaque, int event)
     case CHR_EVENT_OPENED:
         DPRINTF(card, D_INFO, "%s: CHR_EVENT_OPENED\n", __func__);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 07/14] ccid-card-passthru: Explicit we ignore QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

  hw/usb/ccid-card-passthru.c: In function ‘ccid_card_vscard_event’:
  hw/usb/ccid-card-passthru.c:314:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
    314 |     switch (event) {
        |     ^~~~~~
  hw/usb/ccid-card-passthru.c:314:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  hw/usb/ccid-card-passthru.c:314:5: error: enumeration value ‘CHR_EVENT_CLOSED’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/ccid-card-passthru.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 267ed9a8a0..190f268da2 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -318,6 +318,9 @@ static void ccid_card_vscard_event(void *opaque, int event)
     case CHR_EVENT_OPENED:
         DPRINTF(card, D_INFO, "%s: CHR_EVENT_OPENED\n", __func__);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 08/14] hw/usb/redirect: Explicit we ignore few QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      hw/usb/redirect.o
  hw/usb/redirect.c: In function ‘usbredir_chardev_event’:
  hw/usb/redirect.c:1361:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
   1361 |     switch (event) {
        |     ^~~~~~
  hw/usb/redirect.c:1361:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/usb/redirect.c:1361:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/redirect.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index e0f5ca6f81..acc376cc95 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1370,6 +1370,9 @@ static void usbredir_chardev_event(void *opaque, int event)
         DPRINTF("chardev close\n");
         qemu_bh_schedule(dev->chardev_close_bh);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 08/14] hw/usb/redirect: Explicit we ignore few QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      hw/usb/redirect.o
  hw/usb/redirect.c: In function ‘usbredir_chardev_event’:
  hw/usb/redirect.c:1361:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
   1361 |     switch (event) {
        |     ^~~~~~
  hw/usb/redirect.c:1361:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/usb/redirect.c:1361:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/redirect.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index e0f5ca6f81..acc376cc95 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1370,6 +1370,9 @@ static void usbredir_chardev_event(void *opaque, int event)
         DPRINTF("chardev close\n");
         qemu_bh_schedule(dev->chardev_close_bh);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 09/14] monitor/qmp: Explicit we ignore few QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      monitor/qmp.o
  monitor/qmp.c: In function ‘monitor_qmp_event’:
  monitor/qmp.c:345:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    345 |     switch (event) {
        |     ^~~~~~
  monitor/qmp.c:345:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  monitor/qmp.c:345:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Markus Armbruster <armbru@redhat.com>
---
 monitor/qmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/monitor/qmp.c b/monitor/qmp.c
index b67a8e7d1f..d666b07e68 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -365,6 +365,9 @@ static void monitor_qmp_event(void *opaque, int event)
         mon_refcount--;
         monitor_fdsets_cleanup();
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 09/14] monitor/qmp: Explicit we ignore few QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      monitor/qmp.o
  monitor/qmp.c: In function ‘monitor_qmp_event’:
  monitor/qmp.c:345:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    345 |     switch (event) {
        |     ^~~~~~
  monitor/qmp.c:345:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  monitor/qmp.c:345:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Markus Armbruster <armbru@redhat.com>
---
 monitor/qmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/monitor/qmp.c b/monitor/qmp.c
index b67a8e7d1f..d666b07e68 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -365,6 +365,9 @@ static void monitor_qmp_event(void *opaque, int event)
         mon_refcount--;
         monitor_fdsets_cleanup();
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 10/14] monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      monitor/hmp.o
  monitor/hmp.c: In function ‘monitor_event’:
  monitor/hmp.c:1330:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
   1330 |     switch (event) {
        |     ^~~~~~
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
---
 monitor/hmp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/monitor/hmp.c b/monitor/hmp.c
index 8942e28933..d84238c120 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1371,6 +1371,10 @@ static void monitor_event(void *opaque, int event)
         mon_refcount--;
         monitor_fdsets_cleanup();
         break;
+
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 10/14] monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      monitor/hmp.o
  monitor/hmp.c: In function ‘monitor_event’:
  monitor/hmp.c:1330:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
   1330 |     switch (event) {
        |     ^~~~~~
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
---
 monitor/hmp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/monitor/hmp.c b/monitor/hmp.c
index 8942e28933..d84238c120 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1371,6 +1371,10 @@ static void monitor_event(void *opaque, int event)
         mon_refcount--;
         monitor_fdsets_cleanup();
         break;
+
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 11/14] net/vhost-user: Explicit we ignore few QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      net/vhost-user.o
  net/vhost-user.c: In function ‘net_vhost_user_event’:
  net/vhost-user.c:269:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    269 |     switch (event) {
        |     ^~~~~~
  net/vhost-user.c:269:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  net/vhost-user.c:269:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
---
 net/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 014199d600..383d68024e 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -294,6 +294,9 @@ static void net_vhost_user_event(void *opaque, int event)
             aio_bh_schedule_oneshot(ctx, chr_closed_bh, opaque);
         }
         break;
+    default:
+        /* Ignore */
+        break;
     }
 
     if (err) {
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 11/14] net/vhost-user: Explicit we ignore few QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      net/vhost-user.o
  net/vhost-user.c: In function ‘net_vhost_user_event’:
  net/vhost-user.c:269:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    269 |     switch (event) {
        |     ^~~~~~
  net/vhost-user.c:269:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  net/vhost-user.c:269:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
---
 net/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 014199d600..383d68024e 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -294,6 +294,9 @@ static void net_vhost_user_event(void *opaque, int event)
             aio_bh_schedule_oneshot(ctx, chr_closed_bh, opaque);
         }
         break;
+    default:
+        /* Ignore */
+        break;
     }
 
     if (err) {
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 12/14] vhost-user-blk: Explicit we ignore few QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      s390x-softmmu/hw/block/vhost-user-blk.o
  hw/block/vhost-user-blk.c: In function ‘vhost_user_blk_event’:
  hw/block/vhost-user-blk.c:370:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    370 |     switch (event) {
        |     ^~~~~~
  hw/block/vhost-user-blk.c:370:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/block/vhost-user-blk.c:370:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org
---
 hw/block/vhost-user-blk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 63da9bb619..4e2b2efdd3 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -383,6 +383,9 @@ static void vhost_user_blk_event(void *opaque, int event)
             s->watch = 0;
         }
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 12/14] vhost-user-blk: Explicit we ignore few QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      s390x-softmmu/hw/block/vhost-user-blk.o
  hw/block/vhost-user-blk.c: In function ‘vhost_user_blk_event’:
  hw/block/vhost-user-blk.c:370:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    370 |     switch (event) {
        |     ^~~~~~
  hw/block/vhost-user-blk.c:370:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/block/vhost-user-blk.c:370:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org
---
 hw/block/vhost-user-blk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 63da9bb619..4e2b2efdd3 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -383,6 +383,9 @@ static void vhost_user_blk_event(void *opaque, int event)
             s->watch = 0;
         }
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 13/14] hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      s390x-softmmu/hw/char/terminal3270.o
  hw/char/terminal3270.c: In function ‘chr_event’:
  hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    156 |     switch (event) {
        |     ^~~~~~
  hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-s390x@nongnu.org
---
 hw/char/terminal3270.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
index 6859c1bcb2..9e59a2d92b 100644
--- a/hw/char/terminal3270.c
+++ b/hw/char/terminal3270.c
@@ -166,6 +166,9 @@ static void chr_event(void *opaque, int event)
         sch->curr_status.scsw.dstat = SCSW_DSTAT_DEVICE_END;
         css_conditional_io_interrupt(sch);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC PATCH 13/14] hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum. To be
able to use this enum in the IOEventHandler typedef, we need to
explicit when frontends ignore some events, to silent GCC the
following warnings:

    CC      s390x-softmmu/hw/char/terminal3270.o
  hw/char/terminal3270.c: In function ‘chr_event’:
  hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
    156 |     switch (event) {
        |     ^~~~~~
  hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
  hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-s390x@nongnu.org
---
 hw/char/terminal3270.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
index 6859c1bcb2..9e59a2d92b 100644
--- a/hw/char/terminal3270.c
+++ b/hw/char/terminal3270.c
@@ -166,6 +166,9 @@ static void chr_event(void *opaque, int event)
         sch->curr_status.scsw.dstat = SCSW_DSTAT_DEVICE_END;
         css_conditional_io_interrupt(sch);
         break;
+    default:
+        /* Ignore */
+        break;
     }
 }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 14/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo,
	Philippe Mathieu-Daudé,
	Antony Pavlov, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Alex Bennée, Kevin Wolf,
	qemu-riscv, Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck,
	Max Reitz, Zhang Chen, Michael Walle, Palmer Dabbelt,
	Thomas Huth, Aleksandar Markovic, Aurelien Jarno

The Chardev events are listed in the QEMUChrEvent enum.

By using the enum in the IOEventHandler typedef we:

- make the IOEventHandler type more explicit (this handler
  process out-of-band information, while the IOReadHandler
  is in-band),
- help static code analyzers.

This patch was produced with the following spatch script:

  @match@
  expression backend, opaque, context, set_open;
  identifier fd_can_read, fd_read, fd_event, be_change;
  @@
  qemu_chr_fe_set_handlers(backend, fd_can_read, fd_read, fd_event,
                           be_change, opaque, context, set_open);

  @depends on match@
  identifier opaque, event;
  identifier match.fd_event;
  @@
   static
  -void fd_event(void *opaque, int event)
  +void fd_event(void *opaque, QEMUChrEvent event)
   {
   ...
   }

Then the following files were manually modified:

  - include/chardev/char-fe.h
  - include/chardev/char.h
  - include/chardev/char-mux.h
  - chardev/char.c
  - chardev/char-mux.c

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>
Cc: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
Cc: Fabien Chouteau <chouteau@adacore.com>
Cc: KONRAD Frederic <frederic.konrad@adacore.com>
Cc: Peter Chubb <peter.chubb@nicta.com.au>
Cc: Alberto Garcia <berto@igalia.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Thomas Huth <huth@tuxfamily.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: Corey Minyard <minyard@acm.org>
Cc: Paul Burton <pburton@wavecomp.com>
Cc: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Zhang Chen <chen.zhang@intel.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-arm@nongnu.org
Cc: qemu-block@nongnu.org
Cc: qemu-s390x@nongnu.org
Cc: qemu-riscv@nongnu.org
---
 include/chardev/char-fe.h       | 2 +-
 include/chardev/char-mux.h      | 2 +-
 include/chardev/char.h          | 4 ++--
 backends/cryptodev-vhost-user.c | 2 +-
 chardev/char-mux.c              | 8 ++++----
 chardev/char.c                  | 4 ++--
 gdbstub.c                       | 2 +-
 hw/arm/pxa2xx.c                 | 2 +-
 hw/arm/strongarm.c              | 2 +-
 hw/block/vhost-user-blk.c       | 2 +-
 hw/char/cadence_uart.c          | 2 +-
 hw/char/digic-uart.c            | 2 +-
 hw/char/escc.c                  | 2 +-
 hw/char/etraxfs_ser.c           | 2 +-
 hw/char/exynos4210_uart.c       | 2 +-
 hw/char/grlib_apbuart.c         | 2 +-
 hw/char/imx_serial.c            | 2 +-
 hw/char/ipoctal232.c            | 2 +-
 hw/char/lm32_juart.c            | 2 +-
 hw/char/lm32_uart.c             | 2 +-
 hw/char/mcf_uart.c              | 2 +-
 hw/char/milkymist-uart.c        | 2 +-
 hw/char/nrf51_uart.c            | 2 +-
 hw/char/pl011.c                 | 2 +-
 hw/char/serial.c                | 2 +-
 hw/char/sh_serial.c             | 2 +-
 hw/char/terminal3270.c          | 2 +-
 hw/char/virtio-console.c        | 2 +-
 hw/char/xilinx_uartlite.c       | 2 +-
 hw/ipmi/ipmi_bmc_extern.c       | 2 +-
 hw/mips/boston.c                | 2 +-
 hw/mips/mips_malta.c            | 2 +-
 hw/riscv/riscv_htif.c           | 2 +-
 hw/riscv/sifive_uart.c          | 2 +-
 hw/usb/ccid-card-passthru.c     | 2 +-
 hw/usb/dev-serial.c             | 2 +-
 hw/usb/redirect.c               | 2 +-
 monitor/hmp.c                   | 2 +-
 monitor/qmp.c                   | 2 +-
 net/filter-mirror.c             | 2 +-
 net/vhost-user.c                | 4 ++--
 qtest.c                         | 2 +-
 tests/test-char.c               | 6 +++---
 tests/vhost-user-test.c         | 2 +-
 44 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
index 67601dc9a4..a553843364 100644
--- a/include/chardev/char-fe.h
+++ b/include/chardev/char-fe.h
@@ -4,7 +4,7 @@
 #include "chardev/char.h"
 #include "qemu/main-loop.h"
 
-typedef void IOEventHandler(void *opaque, int event);
+typedef void IOEventHandler(void *opaque, QEMUChrEvent event);
 typedef int BackendChangeHandler(void *opaque);
 
 /* This is the backend as seen by frontend, the actual backend is
diff --git a/include/chardev/char-mux.h b/include/chardev/char-mux.h
index 572cefd517..417fe32eed 100644
--- a/include/chardev/char-mux.h
+++ b/include/chardev/char-mux.h
@@ -56,6 +56,6 @@ typedef struct MuxChardev {
     object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
 
 void mux_set_focus(Chardev *chr, int focus);
-void mux_chr_send_all_event(Chardev *chr, int event);
+void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event);
 
 #endif /* CHAR_MUX_H */
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 087b202b62..00589a6025 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -210,7 +210,7 @@ void qemu_chr_be_update_read_handlers(Chardev *s,
  *
  * Send an event from the back end to the front end.
  */
-void qemu_chr_be_event(Chardev *s, int event);
+void qemu_chr_be_event(Chardev *s, QEMUChrEvent event);
 
 int qemu_chr_add_client(Chardev *s, int fd);
 Chardev *qemu_chr_find(const char *name);
@@ -273,7 +273,7 @@ typedef struct ChardevClass {
     void (*chr_accept_input)(Chardev *chr);
     void (*chr_set_echo)(Chardev *chr, bool echo);
     void (*chr_set_fe_open)(Chardev *chr, int fe_open);
-    void (*chr_be_event)(Chardev *s, int event);
+    void (*chr_be_event)(Chardev *s, QEMUChrEvent event);
     /* Return 0 if succeeded, 1 if failed */
     int (*chr_machine_done)(Chardev *chr);
 } ChardevClass;
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index d700934a0e..10e74c0b96 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -152,7 +152,7 @@ cryptodev_vhost_claim_chardev(CryptoDevBackendVhostUser *s,
     return chr;
 }
 
-static void cryptodev_vhost_user_event(void *opaque, int event)
+static void cryptodev_vhost_user_event(void *opaque, QEMUChrEvent event)
 {
     CryptoDevBackendVhostUser *s = opaque;
     CryptoDevBackend *b = CRYPTODEV_BACKEND(s);
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index 200c62a0d0..46c44af67c 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -117,7 +117,7 @@ static void mux_print_help(Chardev *chr)
     }
 }
 
-static void mux_chr_send_event(MuxChardev *d, int mux_nr, int event)
+static void mux_chr_send_event(MuxChardev *d, int mux_nr, QEMUChrEvent event)
 {
     CharBackend *be = d->backends[mux_nr];
 
@@ -126,7 +126,7 @@ static void mux_chr_send_event(MuxChardev *d, int mux_nr, int event)
     }
 }
 
-static void mux_chr_be_event(Chardev *chr, int event)
+static void mux_chr_be_event(Chardev *chr, QEMUChrEvent event)
 {
     MuxChardev *d = MUX_CHARDEV(chr);
 
@@ -232,7 +232,7 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
         }
 }
 
-void mux_chr_send_all_event(Chardev *chr, int event)
+void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event)
 {
     MuxChardev *d = MUX_CHARDEV(chr);
     int i;
@@ -247,7 +247,7 @@ void mux_chr_send_all_event(Chardev *chr, int event)
     }
 }
 
-static void mux_chr_event(void *opaque, int event)
+static void mux_chr_event(void *opaque, QEMUChrEvent event)
 {
     mux_chr_send_all_event(CHARDEV(opaque), event);
 }
diff --git a/chardev/char.c b/chardev/char.c
index c4b6bbc55a..3b60799813 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -48,7 +48,7 @@ static Object *get_chardevs_root(void)
     return container_get(object_get_root(), "/chardevs");
 }
 
-static void chr_be_event(Chardev *s, int event)
+static void chr_be_event(Chardev *s, QEMUChrEvent event)
 {
     CharBackend *be = s->be;
 
@@ -59,7 +59,7 @@ static void chr_be_event(Chardev *s, int event)
     be->chr_event(be->opaque, event);
 }
 
-void qemu_chr_be_event(Chardev *s, int event)
+void qemu_chr_be_event(Chardev *s, QEMUChrEvent event)
 {
     /* Keep track if the char device is open */
     switch (event) {
diff --git a/gdbstub.c b/gdbstub.c
index 4cf8af365e..ce304ff482 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -3171,7 +3171,7 @@ static void gdb_chr_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void gdb_chr_event(void *opaque, int event)
+static void gdb_chr_event(void *opaque, QEMUChrEvent event)
 {
     int i;
     GDBState *s = (GDBState *) opaque;
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index cdafde2f76..950ff4239a 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -1955,7 +1955,7 @@ static void pxa2xx_fir_rx(void *opaque, const uint8_t *buf, int size)
     pxa2xx_fir_update(s);
 }
 
-static void pxa2xx_fir_event(void *opaque, int event)
+static void pxa2xx_fir_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 6bee034914..c6776e8479 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -1093,7 +1093,7 @@ static void strongarm_uart_receive(void *opaque, const uint8_t *buf, int size)
     strongarm_uart_update_int_status(s);
 }
 
-static void strongarm_uart_event(void *opaque, int event)
+static void strongarm_uart_event(void *opaque, QEMUChrEvent event)
 {
     StrongARMUARTState *s = opaque;
     if (event == CHR_EVENT_BREAK) {
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 4e2b2efdd3..f4e7a53688 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -361,7 +361,7 @@ static gboolean vhost_user_blk_watch(GIOChannel *chan, GIOCondition cond,
     return true;
 }
 
-static void vhost_user_blk_event(void *opaque, int event)
+static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
 {
     DeviceState *dev = opaque;
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 0e315b2376..51791bd217 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -348,7 +348,7 @@ static void uart_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
     CadenceUARTState *s = opaque;
     uint8_t buf = '\0';
diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
index 974a2619dd..033eba0a6a 100644
--- a/hw/char/digic-uart.c
+++ b/hw/char/digic-uart.c
@@ -131,7 +131,7 @@ static void uart_rx(void *opaque, const uint8_t *buf, int size)
     s->reg_rx = *buf;
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 8f7bf322cb..c40c1d28f1 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -634,7 +634,7 @@ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
     serial_receive_byte(s, buf[0]);
 }
 
-static void serial_event(void *opaque, int event)
+static void serial_event(void *opaque, QEMUChrEvent event)
 {
     ESCCChannelState *s = opaque;
     if (event == CHR_EVENT_BREAK)
diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c
index 15ac12ef22..f34f767c60 100644
--- a/hw/char/etraxfs_ser.c
+++ b/hw/char/etraxfs_ser.c
@@ -202,7 +202,7 @@ static int serial_can_receive(void *opaque)
     return sizeof(s->rx_fifo) - s->rx_fifo_len;
 }
 
-static void serial_event(void *opaque, int event)
+static void serial_event(void *opaque, QEMUChrEvent event)
 {
 
 }
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index d6b6b62366..7e5c5ce789 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -528,7 +528,7 @@ static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int size)
 }
 
 
-static void exynos4210_uart_event(void *opaque, int event)
+static void exynos4210_uart_event(void *opaque, QEMUChrEvent event)
 {
     Exynos4210UartState *s = (Exynos4210UartState *)opaque;
 
diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
index fe3cbf41a3..8e59c3bc6e 100644
--- a/hw/char/grlib_apbuart.c
+++ b/hw/char/grlib_apbuart.c
@@ -155,7 +155,7 @@ static void grlib_apbuart_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void grlib_apbuart_event(void *opaque, int event)
+static void grlib_apbuart_event(void *opaque, QEMUChrEvent event)
 {
     trace_grlib_apbuart_event(event);
 }
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index fddde9b43d..d09c210709 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -323,7 +323,7 @@ static void imx_receive(void *opaque, const uint8_t *buf, int size)
     imx_put_data(opaque, *buf);
 }
 
-static void imx_event(void *opaque, int event)
+static void imx_event(void *opaque, QEMUChrEvent event)
 {
     if (event == CHR_EVENT_BREAK) {
         imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR);
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 66c163ba26..80e9dff701 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -503,7 +503,7 @@ static void hostdev_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void hostdev_event(void *opaque, int event)
+static void hostdev_event(void *opaque, QEMUChrEvent event)
 {
     SCC2698Channel *ch = opaque;
     switch (event) {
diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c
index e0b1bd6555..da9dd5668b 100644
--- a/hw/char/lm32_juart.c
+++ b/hw/char/lm32_juart.c
@@ -104,7 +104,7 @@ static int juart_can_rx(void *opaque)
     return !(s->jrx & JRX_FULL);
 }
 
-static void juart_event(void *opaque, int event)
+static void juart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c
index 32f29c44cf..8d7a475c91 100644
--- a/hw/char/lm32_uart.c
+++ b/hw/char/lm32_uart.c
@@ -235,7 +235,7 @@ static int uart_can_rx(void *opaque)
     return !(s->regs[R_LSR] & LSR_DR);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index 58323baf43..2de3680b5d 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -256,7 +256,7 @@ static void mcf_uart_push_byte(mcf_uart_state *s, uint8_t data)
     mcf_uart_update(s);
 }
 
-static void mcf_uart_event(void *opaque, int event)
+static void mcf_uart_event(void *opaque, QEMUChrEvent event)
 {
     mcf_uart_state *s = (mcf_uart_state *)opaque;
 
diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index c358ca07f3..1c7b61480e 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -180,7 +180,7 @@ static int uart_can_rx(void *opaque)
     return !(s->regs[R_STAT] & STAT_RX_EVT);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c
index 2777afe366..b67fd21089 100644
--- a/hw/char/nrf51_uart.c
+++ b/hw/char/nrf51_uart.c
@@ -245,7 +245,7 @@ static int uart_can_receive(void *opaque)
     return s->rx_started ? (UART_FIFO_LENGTH - s->rx_fifo_len) : 0;
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
     NRF51UARTState *s = NRF51_UART(opaque);
 
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 84ad8ff9fb..23cd544cc5 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -280,7 +280,7 @@ static void pl011_receive(void *opaque, const uint8_t *buf, int size)
     pl011_put_fifo(opaque, *buf);
 }
 
-static void pl011_event(void *opaque, int event)
+static void pl011_event(void *opaque, QEMUChrEvent event)
 {
     if (event == CHR_EVENT_BREAK)
         pl011_put_fifo(opaque, 0x400);
diff --git a/hw/char/serial.c b/hw/char/serial.c
index b4aa250950..992b5ee944 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -634,7 +634,7 @@ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
     serial_update_irq(s);
 }
 
-static void serial_event(void *opaque, int event)
+static void serial_event(void *opaque, QEMUChrEvent event)
 {
     SerialState *s = opaque;
     DPRINTF("event %x\n", event);
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 07dc16be13..167f4d8cb9 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -358,7 +358,7 @@ static void sh_serial_receive1(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void sh_serial_event(void *opaque, int event)
+static void sh_serial_event(void *opaque, QEMUChrEvent event)
 {
     sh_serial_state *s = opaque;
     if (event == CHR_EVENT_BREAK)
diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
index 9e59a2d92b..4ae9e1cff2 100644
--- a/hw/char/terminal3270.c
+++ b/hw/char/terminal3270.c
@@ -142,7 +142,7 @@ static void terminal_read(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     Terminal3270 *t = opaque;
     CcwDevice *ccw_dev = CCW_DEVICE(t);
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index d3f7ba36fe..35e31a4515 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -145,7 +145,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
     virtio_serial_write(port, buf, size);
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     VirtConsole *vcon = opaque;
     VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(vcon);
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
index 2c47275068..aa6bf02e21 100644
--- a/hw/char/xilinx_uartlite.c
+++ b/hw/char/xilinx_uartlite.c
@@ -206,7 +206,7 @@ static int uart_can_rx(void *opaque)
     return s->rx_fifo_len < sizeof(s->rx_fifo);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 
 }
diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 9d67e6a4a5..4dfb3ae8f5 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -379,7 +379,7 @@ static void receive(void *opaque, const uint8_t *buf, int size)
     handle_hw_op(ibe, hw_op);
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     IPMIBmcExtern *ibe = opaque;
     IPMIInterface *s = ibe->parent.intf;
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index ca7d813a52..29b476b4bd 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -98,7 +98,7 @@ enum boston_plat_reg {
     PLAT_SYS_CTL        = 0x48,
 };
 
-static void boston_lcd_event(void *opaque, int event)
+static void boston_lcd_event(void *opaque, QEMUChrEvent event)
 {
     BostonState *s = opaque;
     if (event == CHR_EVENT_OPENED && !s->lcd_inited) {
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 783cd99848..72c03baa8e 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -545,7 +545,7 @@ static void malta_fpga_reset(void *opaque)
     snprintf(s->display_text, 9, "        ");
 }
 
-static void malta_fgpa_display_event(void *opaque, int event)
+static void malta_fgpa_display_event(void *opaque, QEMUChrEvent event)
 {
     MaltaFPGAState *s = opaque;
 
diff --git a/hw/riscv/riscv_htif.c b/hw/riscv/riscv_htif.c
index 4f7b11dc37..ca87a5cf9f 100644
--- a/hw/riscv/riscv_htif.c
+++ b/hw/riscv/riscv_htif.c
@@ -96,7 +96,7 @@ static void htif_recv(void *opaque, const uint8_t *buf, int size)
  * Called by the char dev to supply special events to the HTIF console.
  * Not used for HTIF.
  */
-static void htif_event(void *opaque, int event)
+static void htif_event(void *opaque, QEMUChrEvent event)
 {
 
 }
diff --git a/hw/riscv/sifive_uart.c b/hw/riscv/sifive_uart.c
index a403ae90f5..9350482662 100644
--- a/hw/riscv/sifive_uart.c
+++ b/hw/riscv/sifive_uart.c
@@ -162,7 +162,7 @@ static int uart_can_rx(void *opaque)
     return s->rx_fifo_len < sizeof(s->rx_fifo);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 190f268da2..cfaddf7f45 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -307,7 +307,7 @@ static void ccid_card_vscard_read(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void ccid_card_vscard_event(void *opaque, int event)
+static void ccid_card_vscard_event(void *opaque, QEMUChrEvent event)
 {
     PassthruState *card = opaque;
 
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 497f932a5a..3504e6505a 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -461,7 +461,7 @@ static void usb_serial_read(void *opaque, const uint8_t *buf, int size)
     s->recv_used += size;
 }
 
-static void usb_serial_event(void *opaque, int event)
+static void usb_serial_event(void *opaque, QEMUChrEvent event)
 {
     USBSerialState *s = opaque;
 
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index acc376cc95..d5f85851b9 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1354,7 +1354,7 @@ static void usbredir_chardev_read(void *opaque, const uint8_t *buf, int size)
     usbredirparser_do_write(dev->parser);
 }
 
-static void usbredir_chardev_event(void *opaque, int event)
+static void usbredir_chardev_event(void *opaque, QEMUChrEvent event)
 {
     USBRedirDevice *dev = opaque;
 
diff --git a/monitor/hmp.c b/monitor/hmp.c
index d84238c120..ad9a599a88 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1322,7 +1322,7 @@ static void monitor_read(void *opaque, const uint8_t *buf, int size)
     cur_mon = old_mon;
 }
 
-static void monitor_event(void *opaque, int event)
+static void monitor_event(void *opaque, QEMUChrEvent event)
 {
     Monitor *mon = opaque;
     MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
diff --git a/monitor/qmp.c b/monitor/qmp.c
index d666b07e68..1c7cbbfff0 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -337,7 +337,7 @@ static QDict *qmp_greeting(MonitorQMP *mon)
         ver, cap_list);
 }
 
-static void monitor_qmp_event(void *opaque, int event)
+static void monitor_qmp_event(void *opaque, QEMUChrEvent event)
 {
     QDict *data;
     MonitorQMP *mon = opaque;
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 8d36009c53..d83e815545 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -132,7 +132,7 @@ static void redirector_chr_read(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void redirector_chr_event(void *opaque, int event)
+static void redirector_chr_event(void *opaque, QEMUChrEvent event)
 {
     NetFilterState *nf = opaque;
     MirrorState *s = FILTER_REDIRECTOR(nf);
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 383d68024e..051e1dbd6e 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -218,7 +218,7 @@ static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond,
     return TRUE;
 }
 
-static void net_vhost_user_event(void *opaque, int event);
+static void net_vhost_user_event(void *opaque, QEMUChrEvent event);
 
 static void chr_closed_bh(void *opaque)
 {
@@ -249,7 +249,7 @@ static void chr_closed_bh(void *opaque)
     }
 }
 
-static void net_vhost_user_event(void *opaque, int event)
+static void net_vhost_user_event(void *opaque, QEMUChrEvent event)
 {
     const char *name = opaque;
     NetClientState *ncs[MAX_QUEUE_NUM];
diff --git a/qtest.c b/qtest.c
index 8b50e2783e..12432f99cf 100644
--- a/qtest.c
+++ b/qtest.c
@@ -722,7 +722,7 @@ static int qtest_can_read(void *opaque)
     return 1024;
 }
 
-static void qtest_event(void *opaque, int event)
+static void qtest_event(void *opaque, QEMUChrEvent event)
 {
     int i;
 
diff --git a/tests/test-char.c b/tests/test-char.c
index 45e42af290..3afc9b1b8d 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -54,7 +54,7 @@ static void fe_read(void *opaque, const uint8_t *buf, int size)
     quit = true;
 }
 
-static void fe_event(void *opaque, int event)
+static void fe_event(void *opaque, QEMUChrEvent event)
 {
     FeHandler *h = opaque;
     bool new_open_state;
@@ -633,7 +633,7 @@ typedef struct {
 
 
 static void
-char_socket_event(void *opaque, int event)
+char_socket_event(void *opaque, QEMUChrEvent event)
 {
     CharSocketTestData *data = opaque;
     data->event = event;
@@ -1006,7 +1006,7 @@ static void char_socket_client_test(gconstpointer opaque)
 }
 
 static void
-count_closed_event(void *opaque, int event)
+count_closed_event(void *opaque, QEMUChrEvent event)
 {
     int *count = opaque;
     if (event == CHR_EVENT_CLOSED) {
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 91ea373ba5..2324b964ad 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -499,7 +499,7 @@ static TestServer *test_server_new(const gchar *name)
     return server;
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     TestServer *s = opaque;
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [PATCH 14/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef
@ 2019-12-17 16:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:38 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Philippe Mathieu-Daudé,
	Corey Minyard, Max Reitz, Li Zhijian, Gerd Hoffmann,
	Michael Walle, Markus Armbruster, Laurent Vivier, Igor Mitsyanko,
	Joel Stanley, Alex Bennée, Bastian Koppelmann,
	Alberto Garcia, Peter Chubb, Edgar E. Iglesias,
	Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

The Chardev events are listed in the QEMUChrEvent enum.

By using the enum in the IOEventHandler typedef we:

- make the IOEventHandler type more explicit (this handler
  process out-of-band information, while the IOReadHandler
  is in-band),
- help static code analyzers.

This patch was produced with the following spatch script:

  @match@
  expression backend, opaque, context, set_open;
  identifier fd_can_read, fd_read, fd_event, be_change;
  @@
  qemu_chr_fe_set_handlers(backend, fd_can_read, fd_read, fd_event,
                           be_change, opaque, context, set_open);

  @depends on match@
  identifier opaque, event;
  identifier match.fd_event;
  @@
   static
  -void fd_event(void *opaque, int event)
  +void fd_event(void *opaque, QEMUChrEvent event)
   {
   ...
   }

Then the following files were manually modified:

  - include/chardev/char-fe.h
  - include/chardev/char.h
  - include/chardev/char-mux.h
  - chardev/char.c
  - chardev/char-mux.c

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>
Cc: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
Cc: Fabien Chouteau <chouteau@adacore.com>
Cc: KONRAD Frederic <frederic.konrad@adacore.com>
Cc: Peter Chubb <peter.chubb@nicta.com.au>
Cc: Alberto Garcia <berto@igalia.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Thomas Huth <huth@tuxfamily.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: Corey Minyard <minyard@acm.org>
Cc: Paul Burton <pburton@wavecomp.com>
Cc: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Zhang Chen <chen.zhang@intel.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-arm@nongnu.org
Cc: qemu-block@nongnu.org
Cc: qemu-s390x@nongnu.org
Cc: qemu-riscv@nongnu.org
---
 include/chardev/char-fe.h       | 2 +-
 include/chardev/char-mux.h      | 2 +-
 include/chardev/char.h          | 4 ++--
 backends/cryptodev-vhost-user.c | 2 +-
 chardev/char-mux.c              | 8 ++++----
 chardev/char.c                  | 4 ++--
 gdbstub.c                       | 2 +-
 hw/arm/pxa2xx.c                 | 2 +-
 hw/arm/strongarm.c              | 2 +-
 hw/block/vhost-user-blk.c       | 2 +-
 hw/char/cadence_uart.c          | 2 +-
 hw/char/digic-uart.c            | 2 +-
 hw/char/escc.c                  | 2 +-
 hw/char/etraxfs_ser.c           | 2 +-
 hw/char/exynos4210_uart.c       | 2 +-
 hw/char/grlib_apbuart.c         | 2 +-
 hw/char/imx_serial.c            | 2 +-
 hw/char/ipoctal232.c            | 2 +-
 hw/char/lm32_juart.c            | 2 +-
 hw/char/lm32_uart.c             | 2 +-
 hw/char/mcf_uart.c              | 2 +-
 hw/char/milkymist-uart.c        | 2 +-
 hw/char/nrf51_uart.c            | 2 +-
 hw/char/pl011.c                 | 2 +-
 hw/char/serial.c                | 2 +-
 hw/char/sh_serial.c             | 2 +-
 hw/char/terminal3270.c          | 2 +-
 hw/char/virtio-console.c        | 2 +-
 hw/char/xilinx_uartlite.c       | 2 +-
 hw/ipmi/ipmi_bmc_extern.c       | 2 +-
 hw/mips/boston.c                | 2 +-
 hw/mips/mips_malta.c            | 2 +-
 hw/riscv/riscv_htif.c           | 2 +-
 hw/riscv/sifive_uart.c          | 2 +-
 hw/usb/ccid-card-passthru.c     | 2 +-
 hw/usb/dev-serial.c             | 2 +-
 hw/usb/redirect.c               | 2 +-
 monitor/hmp.c                   | 2 +-
 monitor/qmp.c                   | 2 +-
 net/filter-mirror.c             | 2 +-
 net/vhost-user.c                | 4 ++--
 qtest.c                         | 2 +-
 tests/test-char.c               | 6 +++---
 tests/vhost-user-test.c         | 2 +-
 44 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/include/chardev/char-fe.h b/include/chardev/char-fe.h
index 67601dc9a4..a553843364 100644
--- a/include/chardev/char-fe.h
+++ b/include/chardev/char-fe.h
@@ -4,7 +4,7 @@
 #include "chardev/char.h"
 #include "qemu/main-loop.h"
 
-typedef void IOEventHandler(void *opaque, int event);
+typedef void IOEventHandler(void *opaque, QEMUChrEvent event);
 typedef int BackendChangeHandler(void *opaque);
 
 /* This is the backend as seen by frontend, the actual backend is
diff --git a/include/chardev/char-mux.h b/include/chardev/char-mux.h
index 572cefd517..417fe32eed 100644
--- a/include/chardev/char-mux.h
+++ b/include/chardev/char-mux.h
@@ -56,6 +56,6 @@ typedef struct MuxChardev {
     object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
 
 void mux_set_focus(Chardev *chr, int focus);
-void mux_chr_send_all_event(Chardev *chr, int event);
+void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event);
 
 #endif /* CHAR_MUX_H */
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 087b202b62..00589a6025 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -210,7 +210,7 @@ void qemu_chr_be_update_read_handlers(Chardev *s,
  *
  * Send an event from the back end to the front end.
  */
-void qemu_chr_be_event(Chardev *s, int event);
+void qemu_chr_be_event(Chardev *s, QEMUChrEvent event);
 
 int qemu_chr_add_client(Chardev *s, int fd);
 Chardev *qemu_chr_find(const char *name);
@@ -273,7 +273,7 @@ typedef struct ChardevClass {
     void (*chr_accept_input)(Chardev *chr);
     void (*chr_set_echo)(Chardev *chr, bool echo);
     void (*chr_set_fe_open)(Chardev *chr, int fe_open);
-    void (*chr_be_event)(Chardev *s, int event);
+    void (*chr_be_event)(Chardev *s, QEMUChrEvent event);
     /* Return 0 if succeeded, 1 if failed */
     int (*chr_machine_done)(Chardev *chr);
 } ChardevClass;
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index d700934a0e..10e74c0b96 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -152,7 +152,7 @@ cryptodev_vhost_claim_chardev(CryptoDevBackendVhostUser *s,
     return chr;
 }
 
-static void cryptodev_vhost_user_event(void *opaque, int event)
+static void cryptodev_vhost_user_event(void *opaque, QEMUChrEvent event)
 {
     CryptoDevBackendVhostUser *s = opaque;
     CryptoDevBackend *b = CRYPTODEV_BACKEND(s);
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index 200c62a0d0..46c44af67c 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -117,7 +117,7 @@ static void mux_print_help(Chardev *chr)
     }
 }
 
-static void mux_chr_send_event(MuxChardev *d, int mux_nr, int event)
+static void mux_chr_send_event(MuxChardev *d, int mux_nr, QEMUChrEvent event)
 {
     CharBackend *be = d->backends[mux_nr];
 
@@ -126,7 +126,7 @@ static void mux_chr_send_event(MuxChardev *d, int mux_nr, int event)
     }
 }
 
-static void mux_chr_be_event(Chardev *chr, int event)
+static void mux_chr_be_event(Chardev *chr, QEMUChrEvent event)
 {
     MuxChardev *d = MUX_CHARDEV(chr);
 
@@ -232,7 +232,7 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
         }
 }
 
-void mux_chr_send_all_event(Chardev *chr, int event)
+void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event)
 {
     MuxChardev *d = MUX_CHARDEV(chr);
     int i;
@@ -247,7 +247,7 @@ void mux_chr_send_all_event(Chardev *chr, int event)
     }
 }
 
-static void mux_chr_event(void *opaque, int event)
+static void mux_chr_event(void *opaque, QEMUChrEvent event)
 {
     mux_chr_send_all_event(CHARDEV(opaque), event);
 }
diff --git a/chardev/char.c b/chardev/char.c
index c4b6bbc55a..3b60799813 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -48,7 +48,7 @@ static Object *get_chardevs_root(void)
     return container_get(object_get_root(), "/chardevs");
 }
 
-static void chr_be_event(Chardev *s, int event)
+static void chr_be_event(Chardev *s, QEMUChrEvent event)
 {
     CharBackend *be = s->be;
 
@@ -59,7 +59,7 @@ static void chr_be_event(Chardev *s, int event)
     be->chr_event(be->opaque, event);
 }
 
-void qemu_chr_be_event(Chardev *s, int event)
+void qemu_chr_be_event(Chardev *s, QEMUChrEvent event)
 {
     /* Keep track if the char device is open */
     switch (event) {
diff --git a/gdbstub.c b/gdbstub.c
index 4cf8af365e..ce304ff482 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -3171,7 +3171,7 @@ static void gdb_chr_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void gdb_chr_event(void *opaque, int event)
+static void gdb_chr_event(void *opaque, QEMUChrEvent event)
 {
     int i;
     GDBState *s = (GDBState *) opaque;
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index cdafde2f76..950ff4239a 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -1955,7 +1955,7 @@ static void pxa2xx_fir_rx(void *opaque, const uint8_t *buf, int size)
     pxa2xx_fir_update(s);
 }
 
-static void pxa2xx_fir_event(void *opaque, int event)
+static void pxa2xx_fir_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 6bee034914..c6776e8479 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -1093,7 +1093,7 @@ static void strongarm_uart_receive(void *opaque, const uint8_t *buf, int size)
     strongarm_uart_update_int_status(s);
 }
 
-static void strongarm_uart_event(void *opaque, int event)
+static void strongarm_uart_event(void *opaque, QEMUChrEvent event)
 {
     StrongARMUARTState *s = opaque;
     if (event == CHR_EVENT_BREAK) {
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 4e2b2efdd3..f4e7a53688 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -361,7 +361,7 @@ static gboolean vhost_user_blk_watch(GIOChannel *chan, GIOCondition cond,
     return true;
 }
 
-static void vhost_user_blk_event(void *opaque, int event)
+static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
 {
     DeviceState *dev = opaque;
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 0e315b2376..51791bd217 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -348,7 +348,7 @@ static void uart_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
     CadenceUARTState *s = opaque;
     uint8_t buf = '\0';
diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
index 974a2619dd..033eba0a6a 100644
--- a/hw/char/digic-uart.c
+++ b/hw/char/digic-uart.c
@@ -131,7 +131,7 @@ static void uart_rx(void *opaque, const uint8_t *buf, int size)
     s->reg_rx = *buf;
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 8f7bf322cb..c40c1d28f1 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -634,7 +634,7 @@ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
     serial_receive_byte(s, buf[0]);
 }
 
-static void serial_event(void *opaque, int event)
+static void serial_event(void *opaque, QEMUChrEvent event)
 {
     ESCCChannelState *s = opaque;
     if (event == CHR_EVENT_BREAK)
diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c
index 15ac12ef22..f34f767c60 100644
--- a/hw/char/etraxfs_ser.c
+++ b/hw/char/etraxfs_ser.c
@@ -202,7 +202,7 @@ static int serial_can_receive(void *opaque)
     return sizeof(s->rx_fifo) - s->rx_fifo_len;
 }
 
-static void serial_event(void *opaque, int event)
+static void serial_event(void *opaque, QEMUChrEvent event)
 {
 
 }
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index d6b6b62366..7e5c5ce789 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -528,7 +528,7 @@ static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int size)
 }
 
 
-static void exynos4210_uart_event(void *opaque, int event)
+static void exynos4210_uart_event(void *opaque, QEMUChrEvent event)
 {
     Exynos4210UartState *s = (Exynos4210UartState *)opaque;
 
diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
index fe3cbf41a3..8e59c3bc6e 100644
--- a/hw/char/grlib_apbuart.c
+++ b/hw/char/grlib_apbuart.c
@@ -155,7 +155,7 @@ static void grlib_apbuart_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void grlib_apbuart_event(void *opaque, int event)
+static void grlib_apbuart_event(void *opaque, QEMUChrEvent event)
 {
     trace_grlib_apbuart_event(event);
 }
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index fddde9b43d..d09c210709 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -323,7 +323,7 @@ static void imx_receive(void *opaque, const uint8_t *buf, int size)
     imx_put_data(opaque, *buf);
 }
 
-static void imx_event(void *opaque, int event)
+static void imx_event(void *opaque, QEMUChrEvent event)
 {
     if (event == CHR_EVENT_BREAK) {
         imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR);
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 66c163ba26..80e9dff701 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -503,7 +503,7 @@ static void hostdev_receive(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void hostdev_event(void *opaque, int event)
+static void hostdev_event(void *opaque, QEMUChrEvent event)
 {
     SCC2698Channel *ch = opaque;
     switch (event) {
diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c
index e0b1bd6555..da9dd5668b 100644
--- a/hw/char/lm32_juart.c
+++ b/hw/char/lm32_juart.c
@@ -104,7 +104,7 @@ static int juart_can_rx(void *opaque)
     return !(s->jrx & JRX_FULL);
 }
 
-static void juart_event(void *opaque, int event)
+static void juart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c
index 32f29c44cf..8d7a475c91 100644
--- a/hw/char/lm32_uart.c
+++ b/hw/char/lm32_uart.c
@@ -235,7 +235,7 @@ static int uart_can_rx(void *opaque)
     return !(s->regs[R_LSR] & LSR_DR);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index 58323baf43..2de3680b5d 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -256,7 +256,7 @@ static void mcf_uart_push_byte(mcf_uart_state *s, uint8_t data)
     mcf_uart_update(s);
 }
 
-static void mcf_uart_event(void *opaque, int event)
+static void mcf_uart_event(void *opaque, QEMUChrEvent event)
 {
     mcf_uart_state *s = (mcf_uart_state *)opaque;
 
diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index c358ca07f3..1c7b61480e 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -180,7 +180,7 @@ static int uart_can_rx(void *opaque)
     return !(s->regs[R_STAT] & STAT_RX_EVT);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c
index 2777afe366..b67fd21089 100644
--- a/hw/char/nrf51_uart.c
+++ b/hw/char/nrf51_uart.c
@@ -245,7 +245,7 @@ static int uart_can_receive(void *opaque)
     return s->rx_started ? (UART_FIFO_LENGTH - s->rx_fifo_len) : 0;
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
     NRF51UARTState *s = NRF51_UART(opaque);
 
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 84ad8ff9fb..23cd544cc5 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -280,7 +280,7 @@ static void pl011_receive(void *opaque, const uint8_t *buf, int size)
     pl011_put_fifo(opaque, *buf);
 }
 
-static void pl011_event(void *opaque, int event)
+static void pl011_event(void *opaque, QEMUChrEvent event)
 {
     if (event == CHR_EVENT_BREAK)
         pl011_put_fifo(opaque, 0x400);
diff --git a/hw/char/serial.c b/hw/char/serial.c
index b4aa250950..992b5ee944 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -634,7 +634,7 @@ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
     serial_update_irq(s);
 }
 
-static void serial_event(void *opaque, int event)
+static void serial_event(void *opaque, QEMUChrEvent event)
 {
     SerialState *s = opaque;
     DPRINTF("event %x\n", event);
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 07dc16be13..167f4d8cb9 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -358,7 +358,7 @@ static void sh_serial_receive1(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void sh_serial_event(void *opaque, int event)
+static void sh_serial_event(void *opaque, QEMUChrEvent event)
 {
     sh_serial_state *s = opaque;
     if (event == CHR_EVENT_BREAK)
diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
index 9e59a2d92b..4ae9e1cff2 100644
--- a/hw/char/terminal3270.c
+++ b/hw/char/terminal3270.c
@@ -142,7 +142,7 @@ static void terminal_read(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     Terminal3270 *t = opaque;
     CcwDevice *ccw_dev = CCW_DEVICE(t);
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index d3f7ba36fe..35e31a4515 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -145,7 +145,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
     virtio_serial_write(port, buf, size);
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     VirtConsole *vcon = opaque;
     VirtIOSerialPort *port = VIRTIO_SERIAL_PORT(vcon);
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
index 2c47275068..aa6bf02e21 100644
--- a/hw/char/xilinx_uartlite.c
+++ b/hw/char/xilinx_uartlite.c
@@ -206,7 +206,7 @@ static int uart_can_rx(void *opaque)
     return s->rx_fifo_len < sizeof(s->rx_fifo);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 
 }
diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
index 9d67e6a4a5..4dfb3ae8f5 100644
--- a/hw/ipmi/ipmi_bmc_extern.c
+++ b/hw/ipmi/ipmi_bmc_extern.c
@@ -379,7 +379,7 @@ static void receive(void *opaque, const uint8_t *buf, int size)
     handle_hw_op(ibe, hw_op);
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     IPMIBmcExtern *ibe = opaque;
     IPMIInterface *s = ibe->parent.intf;
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index ca7d813a52..29b476b4bd 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -98,7 +98,7 @@ enum boston_plat_reg {
     PLAT_SYS_CTL        = 0x48,
 };
 
-static void boston_lcd_event(void *opaque, int event)
+static void boston_lcd_event(void *opaque, QEMUChrEvent event)
 {
     BostonState *s = opaque;
     if (event == CHR_EVENT_OPENED && !s->lcd_inited) {
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 783cd99848..72c03baa8e 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -545,7 +545,7 @@ static void malta_fpga_reset(void *opaque)
     snprintf(s->display_text, 9, "        ");
 }
 
-static void malta_fgpa_display_event(void *opaque, int event)
+static void malta_fgpa_display_event(void *opaque, QEMUChrEvent event)
 {
     MaltaFPGAState *s = opaque;
 
diff --git a/hw/riscv/riscv_htif.c b/hw/riscv/riscv_htif.c
index 4f7b11dc37..ca87a5cf9f 100644
--- a/hw/riscv/riscv_htif.c
+++ b/hw/riscv/riscv_htif.c
@@ -96,7 +96,7 @@ static void htif_recv(void *opaque, const uint8_t *buf, int size)
  * Called by the char dev to supply special events to the HTIF console.
  * Not used for HTIF.
  */
-static void htif_event(void *opaque, int event)
+static void htif_event(void *opaque, QEMUChrEvent event)
 {
 
 }
diff --git a/hw/riscv/sifive_uart.c b/hw/riscv/sifive_uart.c
index a403ae90f5..9350482662 100644
--- a/hw/riscv/sifive_uart.c
+++ b/hw/riscv/sifive_uart.c
@@ -162,7 +162,7 @@ static int uart_can_rx(void *opaque)
     return s->rx_fifo_len < sizeof(s->rx_fifo);
 }
 
-static void uart_event(void *opaque, int event)
+static void uart_event(void *opaque, QEMUChrEvent event)
 {
 }
 
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 190f268da2..cfaddf7f45 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -307,7 +307,7 @@ static void ccid_card_vscard_read(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void ccid_card_vscard_event(void *opaque, int event)
+static void ccid_card_vscard_event(void *opaque, QEMUChrEvent event)
 {
     PassthruState *card = opaque;
 
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 497f932a5a..3504e6505a 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -461,7 +461,7 @@ static void usb_serial_read(void *opaque, const uint8_t *buf, int size)
     s->recv_used += size;
 }
 
-static void usb_serial_event(void *opaque, int event)
+static void usb_serial_event(void *opaque, QEMUChrEvent event)
 {
     USBSerialState *s = opaque;
 
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index acc376cc95..d5f85851b9 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1354,7 +1354,7 @@ static void usbredir_chardev_read(void *opaque, const uint8_t *buf, int size)
     usbredirparser_do_write(dev->parser);
 }
 
-static void usbredir_chardev_event(void *opaque, int event)
+static void usbredir_chardev_event(void *opaque, QEMUChrEvent event)
 {
     USBRedirDevice *dev = opaque;
 
diff --git a/monitor/hmp.c b/monitor/hmp.c
index d84238c120..ad9a599a88 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1322,7 +1322,7 @@ static void monitor_read(void *opaque, const uint8_t *buf, int size)
     cur_mon = old_mon;
 }
 
-static void monitor_event(void *opaque, int event)
+static void monitor_event(void *opaque, QEMUChrEvent event)
 {
     Monitor *mon = opaque;
     MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
diff --git a/monitor/qmp.c b/monitor/qmp.c
index d666b07e68..1c7cbbfff0 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -337,7 +337,7 @@ static QDict *qmp_greeting(MonitorQMP *mon)
         ver, cap_list);
 }
 
-static void monitor_qmp_event(void *opaque, int event)
+static void monitor_qmp_event(void *opaque, QEMUChrEvent event)
 {
     QDict *data;
     MonitorQMP *mon = opaque;
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 8d36009c53..d83e815545 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -132,7 +132,7 @@ static void redirector_chr_read(void *opaque, const uint8_t *buf, int size)
     }
 }
 
-static void redirector_chr_event(void *opaque, int event)
+static void redirector_chr_event(void *opaque, QEMUChrEvent event)
 {
     NetFilterState *nf = opaque;
     MirrorState *s = FILTER_REDIRECTOR(nf);
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 383d68024e..051e1dbd6e 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -218,7 +218,7 @@ static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond,
     return TRUE;
 }
 
-static void net_vhost_user_event(void *opaque, int event);
+static void net_vhost_user_event(void *opaque, QEMUChrEvent event);
 
 static void chr_closed_bh(void *opaque)
 {
@@ -249,7 +249,7 @@ static void chr_closed_bh(void *opaque)
     }
 }
 
-static void net_vhost_user_event(void *opaque, int event)
+static void net_vhost_user_event(void *opaque, QEMUChrEvent event)
 {
     const char *name = opaque;
     NetClientState *ncs[MAX_QUEUE_NUM];
diff --git a/qtest.c b/qtest.c
index 8b50e2783e..12432f99cf 100644
--- a/qtest.c
+++ b/qtest.c
@@ -722,7 +722,7 @@ static int qtest_can_read(void *opaque)
     return 1024;
 }
 
-static void qtest_event(void *opaque, int event)
+static void qtest_event(void *opaque, QEMUChrEvent event)
 {
     int i;
 
diff --git a/tests/test-char.c b/tests/test-char.c
index 45e42af290..3afc9b1b8d 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -54,7 +54,7 @@ static void fe_read(void *opaque, const uint8_t *buf, int size)
     quit = true;
 }
 
-static void fe_event(void *opaque, int event)
+static void fe_event(void *opaque, QEMUChrEvent event)
 {
     FeHandler *h = opaque;
     bool new_open_state;
@@ -633,7 +633,7 @@ typedef struct {
 
 
 static void
-char_socket_event(void *opaque, int event)
+char_socket_event(void *opaque, QEMUChrEvent event)
 {
     CharSocketTestData *data = opaque;
     data->event = event;
@@ -1006,7 +1006,7 @@ static void char_socket_client_test(gconstpointer opaque)
 }
 
 static void
-count_closed_event(void *opaque, int event)
+count_closed_event(void *opaque, QEMUChrEvent event)
 {
     int *count = opaque;
     if (event == CHR_EVENT_CLOSED) {
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 91ea373ba5..2324b964ad 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -499,7 +499,7 @@ static TestServer *test_server_new(const gchar *name)
     return server;
 }
 
-static void chr_event(void *opaque, int event)
+static void chr_event(void *opaque, QEMUChrEvent event)
 {
     TestServer *s = opaque;
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 39+ messages in thread

* Re: [PATCH 00/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef
  2019-12-17 16:37 ` Philippe Mathieu-Daudé
@ 2019-12-17 16:50   ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:50 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel, Stefan Hajnoczi
  Cc: Peter Maydell, Li Zhijian, Paul Burton, Jason Wang,
	KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo, Antony Pavlov,
	Laurent Vivier, Corey Minyard, Amit Shah, Alistair Francis,
	Dr. David Alan Gilbert, Fabien Chouteau, qemu-s390x, qemu-arm,
	Peter Chubb, Alex Bennée, Kevin Wolf, qemu-riscv,
	Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck, Max Reitz,
	Zhang Chen, Michael Walle, Palmer Dabbelt, Thomas Huth,
	Aleksandar Markovic, Aurelien Jarno

On 12/17/19 5:37 PM, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> After this chat on #qemu IRC:
> 13:20 <stsquad> so what is the difference between a IOReadHandler and IOEventHandler?
> 13:25 <f4bug> stsquad: one is in-band and the other out-of-band?
> 13:26 <stsquad> f4bug: ahh yes it seems so - connect/disconnect etc...
> 13:27 <f4bug> see QEMUChrEvent for IOEventHandler
> 
> I thought it might be a good opportunity to make the IOEventHandler
> typedef meaning more obvious, by using the QEMUChrEvent enum.
> 
> To be able to build I had to explicit a 'default' case when frontends
> use a switch(event) case and do not handle all events.
> 
> Then I used a coccinelle spatch to change the various IOEventHandler.
> I don't think the last patch can be split, but suggestions are welcome!
> 
> Regards,
> 
> Phil.
> 
> PD: I use git-publish. To avoid spamming too much, I'm using per-patch
> Cc tag, after the '---' separator. This way each recipient should get
> the cover and the specific patches of interests, + the last one.
> 
> Sent with: 'git publish --suppress-cc=cccmd'

While 'git-publish --verbose' show it was adding recipient from the tags:
(mbox) Adding cc: ...
(mbox) Adding cc: ...

It still sent each patch to everybody from the cover:
Server:
MAIL FROM:
RCPT TO: ...
RCPT TO: ...

Maybe the list was cached in the tag and I should have use the 
--override-cc flag too:

   --override-cc     Ignore any profile or saved CC emails

I apologize for the no-relevant patches I spammed you with :(

> Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Alex Bennée" <alex.bennee@linaro.org>
> Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
> Cc: Andrzej Zaborowski <balrogg@gmail.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Max Reitz <mreitz@redhat.com>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Cc: Alistair Francis <alistair@alistair23.me>
> Cc: Antony Pavlov <antonynpavlov@gmail.com>
> Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
> Cc: Fabien Chouteau <chouteau@adacore.com>
> Cc: KONRAD Frederic <frederic.konrad@adacore.com>
> Cc: Peter Chubb <peter.chubb@nicta.com.au>
> Cc: Alberto Garcia <berto@igalia.com>
> Cc: Michael Walle <michael@walle.cc>
> Cc: Thomas Huth <huth@tuxfamily.org>
> Cc: Joel Stanley <joel@jms.id.au>
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Amit Shah <amit@kernel.org>
> Cc: Corey Minyard <minyard@acm.org>
> Cc: Paul Burton <pburton@wavecomp.com>
> Cc: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Zhang Chen <chen.zhang@intel.com>
> Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-block@nongnu.org
> Cc: qemu-s390x@nongnu.org
> Cc: qemu-riscv@nongnu.org



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [PATCH 00/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef
@ 2019-12-17 16:50   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 16:50 UTC (permalink / raw)
  To: Paolo Bonzini, Marc-André Lureau, qemu-devel, Stefan Hajnoczi
  Cc: Cornelia Huck, Zhang Chen, Michael S. Tsirkin, Fabien Chouteau,
	Paul Burton, Peter Maydell, KONRAD Frederic, Aurelien Jarno,
	Jason Wang, qemu-block, Corey Minyard, Max Reitz, Li Zhijian,
	Gerd Hoffmann, Michael Walle, Markus Armbruster, Laurent Vivier,
	Igor Mitsyanko, Joel Stanley, Alex Bennée,
	Bastian Koppelmann, Alberto Garcia, Peter Chubb,
	Edgar E. Iglesias, Dr. David Alan Gilbert, Christian Borntraeger,
	Andrzej Zaborowski, Aleksandar Rikalo, Aleksandar Markovic,
	Sagar Karandikar, Antony Pavlov, qemu-arm, Alistair Francis,
	Kevin Wolf, qemu-s390x, Gonglei (Arei),
	Palmer Dabbelt, Samuel Thibault, Amit Shah, qemu-riscv,
	Halil Pasic, Thomas Huth

On 12/17/19 5:37 PM, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> After this chat on #qemu IRC:
> 13:20 <stsquad> so what is the difference between a IOReadHandler and IOEventHandler?
> 13:25 <f4bug> stsquad: one is in-band and the other out-of-band?
> 13:26 <stsquad> f4bug: ahh yes it seems so - connect/disconnect etc...
> 13:27 <f4bug> see QEMUChrEvent for IOEventHandler
> 
> I thought it might be a good opportunity to make the IOEventHandler
> typedef meaning more obvious, by using the QEMUChrEvent enum.
> 
> To be able to build I had to explicit a 'default' case when frontends
> use a switch(event) case and do not handle all events.
> 
> Then I used a coccinelle spatch to change the various IOEventHandler.
> I don't think the last patch can be split, but suggestions are welcome!
> 
> Regards,
> 
> Phil.
> 
> PD: I use git-publish. To avoid spamming too much, I'm using per-patch
> Cc tag, after the '---' separator. This way each recipient should get
> the cover and the specific patches of interests, + the last one.
> 
> Sent with: 'git publish --suppress-cc=cccmd'

While 'git-publish --verbose' show it was adding recipient from the tags:
(mbox) Adding cc: ...
(mbox) Adding cc: ...

It still sent each patch to everybody from the cover:
Server:
MAIL FROM:
RCPT TO: ...
RCPT TO: ...

Maybe the list was cached in the tag and I should have use the 
--override-cc flag too:

   --override-cc     Ignore any profile or saved CC emails

I apologize for the no-relevant patches I spammed you with :(

> Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Alex Bennée" <alex.bennee@linaro.org>
> Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
> Cc: Andrzej Zaborowski <balrogg@gmail.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Max Reitz <mreitz@redhat.com>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Cc: Alistair Francis <alistair@alistair23.me>
> Cc: Antony Pavlov <antonynpavlov@gmail.com>
> Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
> Cc: Fabien Chouteau <chouteau@adacore.com>
> Cc: KONRAD Frederic <frederic.konrad@adacore.com>
> Cc: Peter Chubb <peter.chubb@nicta.com.au>
> Cc: Alberto Garcia <berto@igalia.com>
> Cc: Michael Walle <michael@walle.cc>
> Cc: Thomas Huth <huth@tuxfamily.org>
> Cc: Joel Stanley <joel@jms.id.au>
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Amit Shah <amit@kernel.org>
> Cc: Corey Minyard <minyard@acm.org>
> Cc: Paul Burton <pburton@wavecomp.com>
> Cc: Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Cc: Aleksandar Markovic <amarkovic@wavecomp.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Zhang Chen <chen.zhang@intel.com>
> Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-block@nongnu.org
> Cc: qemu-s390x@nongnu.org
> Cc: qemu-riscv@nongnu.org



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC PATCH 10/14] monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandler
  2019-12-17 16:38   ` Philippe Mathieu-Daudé
  (?)
@ 2019-12-17 17:37   ` Dr. David Alan Gilbert
  2019-12-17 17:46     ` Philippe Mathieu-Daudé
  -1 siblings, 1 reply; 39+ messages in thread
From: Dr. David Alan Gilbert @ 2019-12-17 17:37 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel

* Philippe Mathieu-Daudé (philmd@redhat.com) wrote:
> The Chardev events are listed in the QEMUChrEvent enum. To be
> able to use this enum in the IOEventHandler typedef, we need to
> explicit when frontends ignore some events, to silent GCC the
> following warnings:
> 
>     CC      monitor/hmp.o
>   monitor/hmp.c: In function ‘monitor_event’:
>   monitor/hmp.c:1330:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
>    1330 |     switch (event) {
>         |     ^~~~~~
>   cc1: all warnings being treated as errors
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---


Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  for HMP

Note that the use of 'default' will make life more unpredictable
if you ever come to add a new event type.

Dave


> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> ---
>  monitor/hmp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 8942e28933..d84238c120 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -1371,6 +1371,10 @@ static void monitor_event(void *opaque, int event)
>          mon_refcount--;
>          monitor_fdsets_cleanup();
>          break;
> +
> +    default:
> +        /* Ignore */
> +        break;
>      }
>  }
>  
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC PATCH 10/14] monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandler
  2019-12-17 17:37   ` Dr. David Alan Gilbert
@ 2019-12-17 17:46     ` Philippe Mathieu-Daudé
  2019-12-17 17:51       ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-17 17:46 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

On 12/17/19 6:37 PM, Dr. David Alan Gilbert wrote:
> * Philippe Mathieu-Daudé (philmd@redhat.com) wrote:
>> The Chardev events are listed in the QEMUChrEvent enum. To be
>> able to use this enum in the IOEventHandler typedef, we need to
>> explicit when frontends ignore some events, to silent GCC the
>> following warnings:
>>
>>      CC      monitor/hmp.o
>>    monitor/hmp.c: In function ‘monitor_event’:
>>    monitor/hmp.c:1330:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
>>     1330 |     switch (event) {
>>          |     ^~~~~~
>>    cc1: all warnings being treated as errors
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
> 
> 
> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>    for HMP
> 
> Note that the use of 'default' will make life more unpredictable
> if you ever come to add a new event type.

You are right, this patch not good as it dumbly ignore the warning...
I will add all the missing cases:

-- >8 --
@@ -1371,6 +1371,10 @@ static void monitor_event(void *opaque, int event)
          mon_refcount--;
          monitor_fdsets_cleanup();
          break;
+
+    case CHR_EVENT_BREAK:
+        /* Ignored */
+        break;
      }
  }

---

And keep your Acked-by. Thanks!

>> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>> ---
>>   monitor/hmp.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/monitor/hmp.c b/monitor/hmp.c
>> index 8942e28933..d84238c120 100644
>> --- a/monitor/hmp.c
>> +++ b/monitor/hmp.c
>> @@ -1371,6 +1371,10 @@ static void monitor_event(void *opaque, int event)
>>           mon_refcount--;
>>           monitor_fdsets_cleanup();
>>           break;
>> +
>> +    default:
>> +        /* Ignore */
>> +        break;
>>       }
>>   }
>>   
>> -- 
>> 2.21.0
>>
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> 



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC PATCH 10/14] monitor/hmp: Explicit we ignore a QEMUChrEvent in IOEventHandler
  2019-12-17 17:46     ` Philippe Mathieu-Daudé
@ 2019-12-17 17:51       ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 39+ messages in thread
From: Dr. David Alan Gilbert @ 2019-12-17 17:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel

* Philippe Mathieu-Daudé (philmd@redhat.com) wrote:
> On 12/17/19 6:37 PM, Dr. David Alan Gilbert wrote:
> > * Philippe Mathieu-Daudé (philmd@redhat.com) wrote:
> > > The Chardev events are listed in the QEMUChrEvent enum. To be
> > > able to use this enum in the IOEventHandler typedef, we need to
> > > explicit when frontends ignore some events, to silent GCC the
> > > following warnings:
> > > 
> > >      CC      monitor/hmp.o
> > >    monitor/hmp.c: In function ‘monitor_event’:
> > >    monitor/hmp.c:1330:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
> > >     1330 |     switch (event) {
> > >          |     ^~~~~~
> > >    cc1: all warnings being treated as errors
> > > 
> > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > > ---
> > 
> > 
> > Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> >    for HMP
> > 
> > Note that the use of 'default' will make life more unpredictable
> > if you ever come to add a new event type.
> 
> You are right, this patch not good as it dumbly ignore the warning...
> I will add all the missing cases:
> 
> -- >8 --
> @@ -1371,6 +1371,10 @@ static void monitor_event(void *opaque, int event)
>          mon_refcount--;
>          monitor_fdsets_cleanup();
>          break;
> +
> +    case CHR_EVENT_BREAK:
> +        /* Ignored */
> +        break;
>      }
>  }
> 
> ---
> 
> And keep your Acked-by. Thanks!

Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> 
> > > Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > > ---
> > >   monitor/hmp.c | 4 ++++
> > >   1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/monitor/hmp.c b/monitor/hmp.c
> > > index 8942e28933..d84238c120 100644
> > > --- a/monitor/hmp.c
> > > +++ b/monitor/hmp.c
> > > @@ -1371,6 +1371,10 @@ static void monitor_event(void *opaque, int event)
> > >           mon_refcount--;
> > >           monitor_fdsets_cleanup();
> > >           break;
> > > +
> > > +    default:
> > > +        /* Ignore */
> > > +        break;
> > >       }
> > >   }
> > > -- 
> > > 2.21.0
> > > 
> > --
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> > 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC PATCH 13/14] hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
  2019-12-17 16:38   ` Philippe Mathieu-Daudé
@ 2019-12-19  6:52     ` Markus Armbruster
  -1 siblings, 0 replies; 39+ messages in thread
From: Markus Armbruster @ 2019-12-19  6:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Sagar Karandikar, Paul Burton, Jason Wang,
	qemu-devel, KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Li Zhijian, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Antony Pavlov, Marc-André Lureau, Aleksandar Rikalo,
	Joel Stanley, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Samuel Thibault,
	Alex Bennée, Kevin Wolf, qemu-riscv, Igor Mitsyanko,
	Bastian Koppelmann, Cornelia Huck, Max Reitz, Zhang Chen,
	Michael Walle, Palmer Dabbelt, Thomas Huth, Aleksandar Markovic,
	Paolo Bonzini, Aurelien Jarno

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> The Chardev events are listed in the QEMUChrEvent enum. To be
> able to use this enum in the IOEventHandler typedef, we need to
> explicit when frontends ignore some events, to silent GCC the
> following warnings:
>
>     CC      s390x-softmmu/hw/char/terminal3270.o
>   hw/char/terminal3270.c: In function ‘chr_event’:
>   hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
>     156 |     switch (event) {
>         |     ^~~~~~
>   hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
>   hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
>   cc1: all warnings being treated as errors
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: qemu-s390x@nongnu.org
> ---
>  hw/char/terminal3270.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
> index 6859c1bcb2..9e59a2d92b 100644
> --- a/hw/char/terminal3270.c
> +++ b/hw/char/terminal3270.c
> @@ -166,6 +166,9 @@ static void chr_event(void *opaque, int event)
>          sch->curr_status.scsw.dstat = SCSW_DSTAT_DEVICE_END;
>          css_conditional_io_interrupt(sch);
>          break;
> +    default:
> +        /* Ignore */
> +        break;
>      }
>  }

I doubt the /* Ignore */ comment is worth its keep.

Splitting PATCH 02-13 feels excessive to me.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC PATCH 13/14] hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
@ 2019-12-19  6:52     ` Markus Armbruster
  0 siblings, 0 replies; 39+ messages in thread
From: Markus Armbruster @ 2019-12-19  6:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Paolo Bonzini, Marc-André Lureau, qemu-devel, Peter Maydell,
	Li Zhijian, Paul Burton, Jason Wang, KONRAD Frederic,
	Gerd Hoffmann, Edgar E. Iglesias, Alberto Garcia,
	Sagar Karandikar, qemu-block, Michael S. Tsirkin,
	Markus Armbruster, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo, Antony Pavlov,
	Laurent Vivier, Corey Minyard, Amit Shah, Alistair Francis,
	Dr. David Alan Gilbert, Fabien Chouteau, qemu-s390x, qemu-arm,
	Peter Chubb, Alex Bennée, Kevin Wolf, qemu-riscv,
	Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck, Max Reitz,
	Zhang Chen, Michael Walle, Palmer Dabbelt, Thomas Huth,
	Aleksandar Markovic, Aurelien Jarno

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> The Chardev events are listed in the QEMUChrEvent enum. To be
> able to use this enum in the IOEventHandler typedef, we need to
> explicit when frontends ignore some events, to silent GCC the
> following warnings:
>
>     CC      s390x-softmmu/hw/char/terminal3270.o
>   hw/char/terminal3270.c: In function ‘chr_event’:
>   hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
>     156 |     switch (event) {
>         |     ^~~~~~
>   hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
>   hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
>   cc1: all warnings being treated as errors
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: qemu-s390x@nongnu.org
> ---
>  hw/char/terminal3270.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
> index 6859c1bcb2..9e59a2d92b 100644
> --- a/hw/char/terminal3270.c
> +++ b/hw/char/terminal3270.c
> @@ -166,6 +166,9 @@ static void chr_event(void *opaque, int event)
>          sch->curr_status.scsw.dstat = SCSW_DSTAT_DEVICE_END;
>          css_conditional_io_interrupt(sch);
>          break;
> +    default:
> +        /* Ignore */
> +        break;
>      }
>  }

I doubt the /* Ignore */ comment is worth its keep.

Splitting PATCH 02-13 feels excessive to me.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC PATCH 13/14] hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
  2019-12-19  6:52     ` Markus Armbruster
@ 2019-12-19 13:09       ` Philippe Mathieu-Daudé
  -1 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-19 13:09 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Peter Maydell, Sagar Karandikar, Paul Burton, Jason Wang,
	qemu-devel, KONRAD Frederic, Gerd Hoffmann, Edgar E. Iglesias,
	Alberto Garcia, Li Zhijian, qemu-block, Michael S. Tsirkin,
	Halil Pasic, Christian Borntraeger, Gonglei (Arei),
	Antony Pavlov, Marc-André Lureau, Aleksandar Rikalo,
	Joel Stanley, Laurent Vivier, Corey Minyard, Amit Shah,
	Alistair Francis, Dr. David Alan Gilbert, Fabien Chouteau,
	qemu-s390x, qemu-arm, Peter Chubb, Samuel Thibault,
	Alex Bennée, Kevin Wolf, qemu-riscv, Igor Mitsyanko,
	Bastian Koppelmann, Cornelia Huck, Max Reitz, Zhang Chen,
	Michael Walle, Palmer Dabbelt, Thomas Huth, Aleksandar Markovic,
	Paolo Bonzini, Aurelien Jarno

Hi Markus,

On 12/19/19 7:52 AM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> 
>> The Chardev events are listed in the QEMUChrEvent enum. To be
>> able to use this enum in the IOEventHandler typedef, we need to
>> explicit when frontends ignore some events, to silent GCC the
>> following warnings:
>>
>>      CC      s390x-softmmu/hw/char/terminal3270.o
>>    hw/char/terminal3270.c: In function ‘chr_event’:
>>    hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
>>      156 |     switch (event) {
>>          |     ^~~~~~
>>    hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
>>    hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
>>    cc1: all warnings being treated as errors
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> Cc: Cornelia Huck <cohuck@redhat.com>
>> Cc: Halil Pasic <pasic@linux.ibm.com>
>> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
>> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: qemu-s390x@nongnu.org
>> ---
>>   hw/char/terminal3270.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
>> index 6859c1bcb2..9e59a2d92b 100644
>> --- a/hw/char/terminal3270.c
>> +++ b/hw/char/terminal3270.c
>> @@ -166,6 +166,9 @@ static void chr_event(void *opaque, int event)
>>           sch->curr_status.scsw.dstat = SCSW_DSTAT_DEVICE_END;
>>           css_conditional_io_interrupt(sch);
>>           break;
>> +    default:
>> +        /* Ignore */
>> +        break;
>>       }
>>   }
> 
> I doubt the /* Ignore */ comment is worth its keep.

OK I don't mind dropping it.

> Splitting PATCH 02-13 feels excessive to me.

I agree, but I have the feeling when a patch touch many subsystems, we 
don't wait for all the maintainers to Ack it, we are fine with 2 or 3.
In this case, maybe a subsystem neglected a QEMUChrEvent case, so I 
prefer to have each of them to confirm we can ignore the missing cases.

In v2 I don't replace by a 'default' entry, all the cases are explicit.

Regards,

Phil.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC PATCH 13/14] hw/char/terminal3270: Explicit ignored QEMUChrEvent in IOEventHandler
@ 2019-12-19 13:09       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 39+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-19 13:09 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Paolo Bonzini, Marc-André Lureau, qemu-devel, Peter Maydell,
	Li Zhijian, Paul Burton, Jason Wang, KONRAD Frederic,
	Gerd Hoffmann, Edgar E. Iglesias, Alberto Garcia,
	Sagar Karandikar, qemu-block, Michael S. Tsirkin, Halil Pasic,
	Christian Borntraeger, Gonglei (Arei),
	Joel Stanley, Samuel Thibault, Aleksandar Rikalo, Antony Pavlov,
	Laurent Vivier, Corey Minyard, Amit Shah, Alistair Francis,
	Dr. David Alan Gilbert, Fabien Chouteau, qemu-s390x, qemu-arm,
	Peter Chubb, Alex Bennée, Kevin Wolf, qemu-riscv,
	Igor Mitsyanko, Bastian Koppelmann, Cornelia Huck, Max Reitz,
	Zhang Chen, Michael Walle, Palmer Dabbelt, Thomas Huth,
	Aleksandar Markovic, Aurelien Jarno

Hi Markus,

On 12/19/19 7:52 AM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> 
>> The Chardev events are listed in the QEMUChrEvent enum. To be
>> able to use this enum in the IOEventHandler typedef, we need to
>> explicit when frontends ignore some events, to silent GCC the
>> following warnings:
>>
>>      CC      s390x-softmmu/hw/char/terminal3270.o
>>    hw/char/terminal3270.c: In function ‘chr_event’:
>>    hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_BREAK’ not handled in switch [-Werror=switch]
>>      156 |     switch (event) {
>>          |     ^~~~~~
>>    hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_IN’ not handled in switch [-Werror=switch]
>>    hw/char/terminal3270.c:156:5: error: enumeration value ‘CHR_EVENT_MUX_OUT’ not handled in switch [-Werror=switch]
>>    cc1: all warnings being treated as errors
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> Cc: Cornelia Huck <cohuck@redhat.com>
>> Cc: Halil Pasic <pasic@linux.ibm.com>
>> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
>> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: qemu-s390x@nongnu.org
>> ---
>>   hw/char/terminal3270.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c
>> index 6859c1bcb2..9e59a2d92b 100644
>> --- a/hw/char/terminal3270.c
>> +++ b/hw/char/terminal3270.c
>> @@ -166,6 +166,9 @@ static void chr_event(void *opaque, int event)
>>           sch->curr_status.scsw.dstat = SCSW_DSTAT_DEVICE_END;
>>           css_conditional_io_interrupt(sch);
>>           break;
>> +    default:
>> +        /* Ignore */
>> +        break;
>>       }
>>   }
> 
> I doubt the /* Ignore */ comment is worth its keep.

OK I don't mind dropping it.

> Splitting PATCH 02-13 feels excessive to me.

I agree, but I have the feeling when a patch touch many subsystems, we 
don't wait for all the maintainers to Ack it, we are fine with 2 or 3.
In this case, maybe a subsystem neglected a QEMUChrEvent case, so I 
prefer to have each of them to confirm we can ignore the missing cases.

In v2 I don't replace by a 'default' entry, all the cases are explicit.

Regards,

Phil.



^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2019-12-19 13:13 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 16:37 [PATCH 00/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef Philippe Mathieu-Daudé
2019-12-17 16:37 ` Philippe Mathieu-Daudé
2019-12-17 16:37 ` [PATCH 01/14] hw/ipmi: Remove unnecessary declarations Philippe Mathieu-Daudé
2019-12-17 16:37   ` Philippe Mathieu-Daudé
2019-12-17 16:37 ` [RFC PATCH 02/14] chardev/char: Explicit we ignore some QEMUChrEvent in IOEventHandler Philippe Mathieu-Daudé
2019-12-17 16:37   ` Philippe Mathieu-Daudé
2019-12-17 16:37 ` [RFC PATCH 03/14] vhost-user: " Philippe Mathieu-Daudé
2019-12-17 16:37   ` Philippe Mathieu-Daudé
2019-12-17 16:37 ` [RFC PATCH 04/14] virtio-console: " Philippe Mathieu-Daudé
2019-12-17 16:37   ` Philippe Mathieu-Daudé
2019-12-17 16:37 ` [RFC PATCH 05/14] hw/ipmi: " Philippe Mathieu-Daudé
2019-12-17 16:37   ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [RFC PATCH 06/14] hw/usb/dev-serial: Explicit we ignore few " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [RFC PATCH 07/14] ccid-card-passthru: Explicit we ignore " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [RFC PATCH 08/14] hw/usb/redirect: Explicit we ignore few " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [RFC PATCH 09/14] monitor/qmp: " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [RFC PATCH 10/14] monitor/hmp: Explicit we ignore a " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 17:37   ` Dr. David Alan Gilbert
2019-12-17 17:46     ` Philippe Mathieu-Daudé
2019-12-17 17:51       ` Dr. David Alan Gilbert
2019-12-17 16:38 ` [RFC PATCH 11/14] net/vhost-user: Explicit we ignore few " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [RFC PATCH 12/14] vhost-user-blk: " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [RFC PATCH 13/14] hw/char/terminal3270: Explicit ignored " Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-19  6:52   ` Markus Armbruster
2019-12-19  6:52     ` Markus Armbruster
2019-12-19 13:09     ` Philippe Mathieu-Daudé
2019-12-19 13:09       ` Philippe Mathieu-Daudé
2019-12-17 16:38 ` [PATCH 14/14] chardev: Use QEMUChrEvent enum in IOEventHandler typedef Philippe Mathieu-Daudé
2019-12-17 16:38   ` Philippe Mathieu-Daudé
2019-12-17 16:50 ` [PATCH 00/14] " Philippe Mathieu-Daudé
2019-12-17 16:50   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.