On Wed, Jun 11, 2025 at 03:40:40PM +0100, James Clark wrote:
Also, could there be individual error messages for TFUF and for RFOF?
If you are concerned about the penalty for the error-free case, make the
check two-level. First for all errors, then for individual errors.
If I was going to split them I would probably let the compiler optimize it
whichever way was best. The real reason for combining them is because
usually you get them both together. As long as the message and fifos are
configured correctly you'd always get TFUF and RFOF at the same time and I
wanted to avoid printing twice for one event.
In that case, why not:
if (spi_sr & (SPI_SR_TFUF | SPI_SR_RFOF)) {
dev_err_ratelimited(dev, "FIFO errors:%s%s\n",
spi_sr & SPI_SR_TFUF ? " TX underflow," : "",
spi_sr & SPI_SR_RFOF ? " RX overflow," : "");
}
}