diff options
author | Serge Semin <Sergey.Semin@baikalelectronics.ru> | 2020-10-08 02:54:57 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-10-08 23:00:11 +0100 |
commit | 8dedbeac8ab24d2da9271df2c8291971169846f2 (patch) | |
tree | efa6a87f45c5205e3e4443dda47fc57aa8710d18 /drivers/spi/spi-dw.h | |
parent | 3ff60c6b644e2002e062ed97825ead19e31c2769 (diff) | |
download | linux-8dedbeac8ab24d2da9271df2c8291971169846f2.tar.bz2 |
spi: dw: Refactor data IO procedure
The Tx and Rx data write/read procedure can be significantly simplified by
using Tx/Rx transfer lengths instead of the end pointers. By having the
Tx/Rx data leftover lengths (in the number of transfer words) we can get
rid of all subtraction and division operations utilized here and there in
the tx_max(), rx_max(), dw_writer() and dw_reader() methods. Such
modification will not only give us the more optimized IO procedures, but
will make the data IO methods much more readable than before.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20201007235511.4935-9-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-dw.h')
-rw-r--r-- | drivers/spi/spi-dw.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h index 14f9b64b63d7..70fc9db9eb98 100644 --- a/drivers/spi/spi-dw.h +++ b/drivers/spi/spi-dw.h @@ -147,11 +147,10 @@ struct dw_spi { void (*set_cs)(struct spi_device *spi, bool enable); /* Current message transfer state info */ - size_t len; void *tx; - void *tx_end; + unsigned int tx_len; void *rx; - void *rx_end; + unsigned int rx_len; int dma_mapped; u8 n_bytes; /* current is a 1/2 bytes op */ irqreturn_t (*transfer_handler)(struct dw_spi *dws); |