aboutsummaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-07-05 13:22:10 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-08-31 19:47:43 +0200
commit53c7c924228a9227bfdbb4d2f92e657cb805a37d (patch)
treeaefea1f72addbc0c212bfc834414e2f98f211c0e /hw/char
parentb3a1090fe55669e4ce19649525745ce551232a43 (diff)
downloadqemu-53c7c924228a9227bfdbb4d2f92e657cb805a37d.zip
qemu-53c7c924228a9227bfdbb4d2f92e657cb805a37d.tar.gz
qemu-53c7c924228a9227bfdbb4d2f92e657cb805a37d.tar.bz2
hw/char: Have FEWatchFunc handlers return G_SOURCE_CONTINUE/REMOVE
GLib recommend to use G_SOURCE_REMOVE / G_SOURCE_CONTINUE for GSourceFunc callbacks. Our FEWatchFunc is a GSourceFunc returning such value. Use such definitions which are "more memorable" [*]. [*] https://docs.gtk.org/glib/callback.SourceFunc.html#return-value Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230705133139.54419-5-philmd@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/cadence_uart.c8
-rw-r--r--hw/char/cmsdk-apb-uart.c6
-rw-r--r--hw/char/ibex_uart.c8
-rw-r--r--hw/char/nrf51_uart.c4
-rw-r--r--hw/char/serial.c2
-rw-r--r--hw/char/virtio-console.c2
6 files changed, 15 insertions, 15 deletions
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 807e398..eff0304 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -307,11 +307,11 @@ static gboolean cadence_uart_xmit(void *do_not_use, GIOCondition cond,
/* instant drain the fifo when there's no back-end */
if (!qemu_chr_fe_backend_connected(&s->chr)) {
s->tx_count = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (!s->tx_count) {
- return FALSE;
+ return G_SOURCE_REMOVE;
}
ret = qemu_chr_fe_write(&s->chr, s->tx_fifo, s->tx_count);
@@ -326,12 +326,12 @@ static gboolean cadence_uart_xmit(void *do_not_use, GIOCondition cond,
cadence_uart_xmit, s);
if (!r) {
s->tx_count = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
}
uart_update_status(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_write_tx_fifo(CadenceUARTState *s, const uint8_t *buf,
diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c
index f8dc89e..d466cd9 100644
--- a/hw/char/cmsdk-apb-uart.c
+++ b/hw/char/cmsdk-apb-uart.c
@@ -199,7 +199,7 @@ static gboolean uart_transmit(void *do_not_use, GIOCondition cond, void *opaque)
s->watch_tag = 0;
if (!(s->ctrl & R_CTRL_TX_EN_MASK) || !(s->state & R_STATE_TXFULL_MASK)) {
- return FALSE;
+ return G_SOURCE_REMOVE;
}
ret = qemu_chr_fe_write(&s->chr, &s->txbuf, 1);
@@ -215,7 +215,7 @@ static gboolean uart_transmit(void *do_not_use, GIOCondition cond, void *opaque)
}
/* Transmit pending */
trace_cmsdk_apb_uart_tx_pending();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
buffer_drained:
@@ -227,7 +227,7 @@ buffer_drained:
s->intstatus |= R_INTSTATUS_TX_MASK;
}
cmsdk_apb_uart_update(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_cancel_transmit(CMSDKAPBUART *s)
diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c
index f70adb5..51708c0 100644
--- a/hw/char/ibex_uart.c
+++ b/hw/char/ibex_uart.c
@@ -147,7 +147,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
/* instant drain the fifo when there's no back-end */
if (!qemu_chr_fe_backend_connected(&s->chr)) {
s->tx_level = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
if (!s->tx_level) {
@@ -156,7 +156,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
s->uart_intr_state |= R_INTR_STATE_TX_EMPTY_MASK;
s->uart_intr_state &= ~R_INTR_STATE_TX_WATERMARK_MASK;
ibex_uart_update_irqs(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
ret = qemu_chr_fe_write(&s->chr, s->tx_fifo, s->tx_level);
@@ -171,7 +171,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
ibex_uart_xmit, s);
if (!r) {
s->tx_level = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
}
@@ -192,7 +192,7 @@ static gboolean ibex_uart_xmit(void *do_not_use, GIOCondition cond,
}
ibex_uart_update_irqs(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_write_tx_fifo(IbexUartState *s, const uint8_t *buf,
diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c
index 3c6f982..dfe2276 100644
--- a/hw/char/nrf51_uart.c
+++ b/hw/char/nrf51_uart.c
@@ -93,13 +93,13 @@ static gboolean uart_transmit(void *do_not_use, GIOCondition cond, void *opaque)
*/
goto buffer_drained;
}
- return FALSE;
+ return G_SOURCE_REMOVE;
}
buffer_drained:
s->reg[R_UART_TXDRDY] = 1;
s->pending_tx_byte = false;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_cancel_transmit(NRF51UARTState *s)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 270e1b1..f3094f8 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -226,7 +226,7 @@ static gboolean serial_watch_cb(void *do_not_use, GIOCondition cond,
SerialState *s = opaque;
s->watch_tag = 0;
serial_xmit(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void serial_xmit(SerialState *s)
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index dd5a02e..dbe0b28 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -45,7 +45,7 @@ static gboolean chr_write_unblocked(void *do_not_use, GIOCondition cond,
vcon->watch = 0;
virtio_serial_throttle_port(VIRTIO_SERIAL_PORT(vcon), false);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
/* Callback function that's called when the guest sends us data */