diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-02-19 15:35:53 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-03-04 14:45:34 +0100 |
commit | f33af61dbab3b6fe0923bd829461584eaa41039e (patch) | |
tree | a92eaee1df399654052c24803a65e26abaa655cc | |
parent | abf2b6a028670bd2890bb3aee7e103fe53e4b0df (diff) | |
download | qemu-f33af61dbab3b6fe0923bd829461584eaa41039e.zip qemu-f33af61dbab3b6fe0923bd829461584eaa41039e.tar.gz qemu-f33af61dbab3b6fe0923bd829461584eaa41039e.tar.bz2 |
hw/char/pl011: Simplify a bit pl011_can_receive()
Introduce 'fifo_depth' and 'fifo_available' local variables
to better express the 'r' variable use.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Luc Michel <luc.michel@amd.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250220092903.3726-3-philmd@linaro.org>
-rw-r--r-- | hw/char/pl011.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 12a2d4b..5bb83c5 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -486,7 +486,9 @@ static void pl011_write(void *opaque, hwaddr offset, static int pl011_can_receive(void *opaque) { PL011State *s = (PL011State *)opaque; - int r; + unsigned fifo_depth = pl011_get_fifo_depth(s); + unsigned fifo_available = fifo_depth - s->read_count; + int r = fifo_available ? 1 : 0; if (!(s->cr & CR_UARTEN)) { qemu_log_mask(LOG_GUEST_ERROR, @@ -496,7 +498,6 @@ static int pl011_can_receive(void *opaque) qemu_log_mask(LOG_GUEST_ERROR, "PL011 receiving data on disabled RX UART\n"); } - r = s->read_count < pl011_get_fifo_depth(s); trace_pl011_can_receive(s->lcr, s->read_count, r); return r; } |