Skip to content

Commit e8835b7

Browse files
committed
[ot] util: fifo8: remove fifo8_consume_all API
Upstream QEMU has added an equivalent `fifo8_drop` function in the time since this was introduced. Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
1 parent b3716e7 commit e8835b7

5 files changed

Lines changed: 2 additions & 30 deletions

File tree

hw/ibexdemo/ibexdemo_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static void ibexdemo_uart_xmit(IbexDemoUARTState *s)
108108
ret = qemu_chr_fe_write(&s->chr, buf, size);
109109

110110
if (ret > 0) {
111-
fifo8_consume_all(&s->tx_fifo, ret);
111+
fifo8_drop(&s->tx_fifo, ret);
112112
}
113113
}
114114

hw/opentitan/ot_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static void ot_uart_xmit(OtUARTState *s)
369369
ret = qemu_chr_fe_write(&s->chr, buf, (int)size);
370370
/* if some characters where sent, remove them from the FIFO */
371371
if (ret >= 0) {
372-
fifo8_consume_all(&s->tx_fifo, ret);
372+
fifo8_drop(&s->tx_fifo, ret);
373373
}
374374
}
375375

include/hw/opentitan/ot_fifo32.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ ot_fifo32_peek_buf(const OtFifo32 *fifo, uint32_t max, uint32_t *num)
9696
return ret;
9797
}
9898

99-
static inline void ot_fifo32_consume_all(OtFifo32 *fifo, uint32_t num)
100-
{
101-
num = MIN(fifo->capacity - fifo->head, num);
102-
fifo->head += num;
103-
fifo->head %= fifo->capacity;
104-
fifo->num -= num;
105-
}
106-
10799
static inline void ot_fifo32_reset(OtFifo32 *fifo)
108100
{
109101
fifo->num = 0u;

include/qemu/fifo8.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,6 @@ const uint8_t *fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr);
165165
*/
166166
void fifo8_drop(Fifo8 *fifo, uint32_t len);
167167

168-
/**
169-
* fifo8_consume_all:
170-
* @fifo: fifo to consume from
171-
* @num: number of bytes to consume
172-
*
173-
* Remove data bytes from the FIFO. Behaviour is undefined if the FIFO is empty.
174-
* Clients are responsible for checking for emptyness using fifo8_is_empty().
175-
*
176-
*/
177-
178-
void fifo8_consume_all(Fifo8 *fifo, uint32_t num);
179-
180168
/**
181169
* fifo8_reset:
182170
* @fifo: FIFO to reset

util/fifo8.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,6 @@ static const uint8_t *fifo8_peekpop_bufptr(Fifo8 *fifo, uint32_t max,
101101
return ret;
102102
}
103103

104-
void fifo8_consume_all(Fifo8 *fifo, uint32_t num)
105-
{
106-
num = MIN(fifo->capacity - fifo->head, num);
107-
fifo->head += num;
108-
fifo->head %= fifo->capacity;
109-
fifo->num -= num;
110-
}
111-
112104
const uint8_t *fifo8_peek_bufptr(Fifo8 *fifo, uint32_t max, uint32_t *numptr)
113105
{
114106
return fifo8_peekpop_bufptr(fifo, max, 0, numptr, false);

0 commit comments

Comments
 (0)