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>
/* 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);
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,
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);
}
/* Transmit pending */
trace_cmsdk_apb_uart_tx_pending();
- return FALSE;
+ return G_SOURCE_REMOVE;
}
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)
/* 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) {
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);
ibex_uart_xmit, s);
if (!r) {
s->tx_level = 0;
- return FALSE;
+ return G_SOURCE_REMOVE;
}
}
}
ibex_uart_update_irqs(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void uart_write_tx_fifo(IbexUartState *s, const uint8_t *buf,
*/
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)
SerialState *s = opaque;
s->watch_tag = 0;
serial_xmit(s);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void serial_xmit(SerialState *s)
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 */
dev->watch = 0;
usbredirparser_do_write(dev->parser);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static int usbredir_write(void *priv, uint8_t *data, int count)
QEMU_LOCK_GUARD(&mon->mon_lock);
mon->out_watch = 0;
monitor_flush_locked(mon);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
/* Caller must hold mon->mon_lock */
qemu_chr_fe_disconnect(&s->chr);
- return TRUE;
+ return G_SOURCE_CONTINUE;
}
static void net_vhost_user_event(void *opaque, QEMUChrEvent event);