From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: "Evgeny Iakovlev" <eiakovlev@linux.microsoft.com>,
"Rayhan Faizel" <rayhan.faizel@gmail.com>,
"Luc Michel" <luc.michel@amd.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Thomas Huth" <huth@tuxfamily.org>,
"Shin'ichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-arm@nongnu.org
Subject: [PATCH 7/9] hw/char/mcf_uart: Use FIFO_DEPTH definition instead of magic values
Date: Wed, 19 Feb 2025 22:08:39 +0100 [thread overview]
Message-ID: <20250219210841.94797-8-philmd@linaro.org> (raw)
In-Reply-To: <20250219210841.94797-1-philmd@linaro.org>
Defines FIFO_DEPTH and use it, fixing coding style.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/char/mcf_uart.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index 980a12fcb7d..95f269ee9b7 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -17,6 +17,8 @@
#include "chardev/char-fe.h"
#include "qom/object.h"
+#define FIFO_DEPTH 4
+
struct mcf_uart_state {
SysBusDevice parent_obj;
@@ -27,7 +29,7 @@ struct mcf_uart_state {
uint8_t imr;
uint8_t bg1;
uint8_t bg2;
- uint8_t fifo[4];
+ uint8_t fifo[FIFO_DEPTH];
uint8_t tb;
int current_mr;
int fifo_len;
@@ -247,14 +249,16 @@ static void mcf_uart_reset(DeviceState *dev)
static void mcf_uart_push_byte(mcf_uart_state *s, uint8_t data)
{
/* Break events overwrite the last byte if the fifo is full. */
- if (s->fifo_len == 4)
+ if (s->fifo_len == FIFO_DEPTH) {
s->fifo_len--;
+ }
s->fifo[s->fifo_len] = data;
s->fifo_len++;
s->sr |= MCF_UART_RxRDY;
- if (s->fifo_len == 4)
+ if (s->fifo_len == FIFO_DEPTH) {
s->sr |= MCF_UART_FFULL;
+ }
mcf_uart_update(s);
}
--
2.47.1
next prev parent reply other threads:[~2025-02-19 21:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 21:08 [PATCH 0/9] hw/char: Improve RX FIFO depth uses Philippe Mathieu-Daudé
2025-02-19 21:08 ` [PATCH 1/9] hw/char/pl011: Warn when using disabled receiver Philippe Mathieu-Daudé
2025-02-20 8:11 ` Luc Michel
2025-02-19 21:08 ` [PATCH 2/9] hw/char/pl011: Simplify a bit pl011_can_receive() Philippe Mathieu-Daudé
2025-02-20 8:12 ` Luc Michel
2025-02-19 21:08 ` [PATCH 3/9] hw/char/pl011: Improve RX flow tracing events Philippe Mathieu-Daudé
2025-02-19 22:09 ` Alex Bennée
2025-02-20 8:14 ` Luc Michel
2025-02-19 21:08 ` [PATCH 4/9] hw/char/pl011: Really use RX FIFO depth Philippe Mathieu-Daudé
2025-02-20 8:17 ` Luc Michel
2025-02-19 21:08 ` [PATCH 5/9] hw/char/bcm2835_aux: " Philippe Mathieu-Daudé
2025-02-20 8:21 ` Luc Michel
2025-02-20 8:28 ` Philippe Mathieu-Daudé
2025-02-19 21:08 ` [PATCH 6/9] hw/char/imx_serial: " Philippe Mathieu-Daudé
2025-02-20 8:22 ` Luc Michel
2025-02-19 21:08 ` Philippe Mathieu-Daudé [this message]
2025-02-20 8:24 ` [PATCH 7/9] hw/char/mcf_uart: Use FIFO_DEPTH definition instead of magic values Luc Michel
2025-02-19 21:08 ` [PATCH 8/9] hw/char/mcf_uart: Really use RX FIFO depth Philippe Mathieu-Daudé
2025-02-20 8:26 ` Luc Michel
2025-02-19 21:08 ` [PATCH 9/9] hw/char/sh_serial: Return correct number of empty RX FIFO elements Philippe Mathieu-Daudé
2025-02-20 8:30 ` Luc Michel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250219210841.94797-8-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=eiakovlev@linux.microsoft.com \
--cc=huth@tuxfamily.org \
--cc=luc.michel@amd.com \
--cc=magnus.damm@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rayhan.faizel@gmail.com \
--cc=shinichiro.kawasaki@wdc.com \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).