spi: use spi_valid_{tx,rx}buf() in stats function
authorDavid Lechner <dlechner@baylibre.com>
Tue, 30 Apr 2024 20:15:27 +0000 (15:15 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 1 May 2024 02:01:21 +0000 (11:01 +0900)
commit52267fe8456a2a05f70b29d68292eec789c960b9
tree4266fb86db9e0882e7aac7523ab10ba8f6602d5e
parent47766799f546249813e97a0ccde8978ba114e89f
spi: use spi_valid_{tx,rx}buf() in stats function

There are macros spi_valid_txbuf() and spi_valid_rxbuf() for determining
if an xfer actually intended to send or receive data.

These checks were hard-coded in spi_statistics_add_transfer_stats(). We
can make use of the macros instead to make the code more readable and
more robust against potential future changes in case the definition of
what valid means changes.

The macro takes the spi_message as an argument, so we need to change
spi_statistics_add_transfer_stats() to take the spi_message as an
argument instead of the controller.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240430201530.2138095-3-dlechner@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c