From 0ed2c976cc0bf569a3901be686a467150c089896 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 10 Apr 2022 17:37:33 +0200 Subject: kernel/driver: modify the ps2/serial drivers to use ring_t --- src/shared/container/ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/shared/container') diff --git a/src/shared/container/ring.c b/src/shared/container/ring.c index 525fade..8c56acd 100644 --- a/src/shared/container/ring.c +++ b/src/shared/container/ring.c @@ -27,7 +27,7 @@ void ring_put1b(ring_t *r, uint8_t byte) { size_t ring_get(ring_t *r, void *buf, size_t len) { for (size_t i = 0; i < len; i++) { - if (at_end(r)) return i; + if (r->_head == r->_tail || at_end(r)) return i; ((uint8_t*)buf)[i] = ((uint8_t*)r->buf)[r->_tail++]; if (r->_tail >= r->capacity) r->_tail = 0; } -- cgit v1.2.3