mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
firmware/sniffer: Avoid extra call for rbuf_is_full
rbuf_write() will tell us in the return value if the buffer was full (error) or not (success). Let's use that return value rather than a theoretically race-y call to rbuf_is_full() before. It's theoretical as the write happens from IRQ context and the read from normal process context, so the fill-level cannot really change while we're in the USART interrupt. So it doesn't fix a bug, just improves coding style and also avoids an extra function call + irq-disable/re-enable. Change-Id: Icf570d0aa48d67a19e63c6e2b6caa14438fe88e3
This commit is contained in:
@@ -826,11 +826,8 @@ void Sniffer_usart_isr(void)
|
|||||||
/* Reset WT timer */
|
/* Reset WT timer */
|
||||||
wt_remaining = wt;
|
wt_remaining = wt;
|
||||||
/* Store sniffed data into buffer (also clear interrupt */
|
/* Store sniffed data into buffer (also clear interrupt */
|
||||||
if (rbuf_is_full(&sniff_buffer)) {
|
if (rbuf_write(&sniff_buffer, byte) != 0)
|
||||||
TRACE_ERROR("USART buffer full\n\r");
|
TRACE_ERROR("USART buffer full\n\r");
|
||||||
} else {
|
|
||||||
rbuf_write(&sniff_buffer, byte);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Verify it WT timeout occurred, to detect unresponsive card */
|
/* Verify it WT timeout occurred, to detect unresponsive card */
|
||||||
|
|||||||
Reference in New Issue
Block a user