Re: [PATCH 1/4] serial: fix circular rx buffer edge case

2024-10-17 Thread Simon Glass
Hi Rasmus, On Wed, 9 Oct 2024 at 05:03, Rasmus Villemoes wrote: > > Simon Glass writes: > > > On Thu, 3 Oct 2024 at 08:10, Rasmus Villemoes wrote: > >> > >> drivers/serial/serial-uclass.c | 10 ++ > >> include/serial.h | 4 ++-- > >> 2 files changed, 8 insertions(+), 6 d

Re: [PATCH 1/4] serial: fix circular rx buffer edge case

2024-10-09 Thread Rasmus Villemoes
Simon Glass writes: > On Thu, 3 Oct 2024 at 08:10, Rasmus Villemoes wrote: >> >> drivers/serial/serial-uclass.c | 10 ++ >> include/serial.h | 4 ++-- >> 2 files changed, 8 insertions(+), 6 deletions(-) > > Reviewed-by: Simon Glass > > Perhaps we should use membuff, like

Re: [PATCH 1/4] serial: fix circular rx buffer edge case

2024-10-08 Thread Simon Glass
On Thu, 3 Oct 2024 at 08:10, Rasmus Villemoes wrote: > > The current implementation of the circular rx buffer falls into a > common trap with circular buffers: It keeps the head/tail indices > reduced modulo the buffer size. The problem with that is that it makes > it impossible to distinguish "bu

[PATCH 1/4] serial: fix circular rx buffer edge case

2024-10-03 Thread Rasmus Villemoes
The current implementation of the circular rx buffer falls into a common trap with circular buffers: It keeps the head/tail indices reduced modulo the buffer size. The problem with that is that it makes it impossible to distinguish "buffer full" from "buffer empty", because in both situations one h