diff options
author | Serge Semin <Sergey.Semin@baikalelectronics.ru> | 2020-09-20 14:28:47 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-09-29 17:22:21 +0100 |
commit | 8225c1c9a073c323f68833d136fcf94fbc75a275 (patch) | |
tree | 60cdbc1227042f677410132bfada4bec137ca17e /drivers | |
parent | 07918df724f2fed02327e3cbfe58a5d5568b2cc2 (diff) | |
download | linux-stable-8225c1c9a073c323f68833d136fcf94fbc75a275.tar.gz linux-stable-8225c1c9a073c323f68833d136fcf94fbc75a275.tar.bz2 linux-stable-8225c1c9a073c323f68833d136fcf94fbc75a275.zip |
spi: dw: Initialize n_bytes before the memory barrier
Since n_bytes field of the DW SPI private data is also utilized by the
IRQ handler, we need to make sure it' initialization is done before the
memory barrier.
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20200920112914.26501-4-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-dw-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c index 55afdcee7d2b..dc54990bff6b 100644 --- a/drivers/spi/spi-dw-core.c +++ b/drivers/spi/spi-dw-core.c @@ -299,6 +299,7 @@ static int dw_spi_transfer_one(struct spi_controller *master, dws->dma_mapped = 0; spin_lock_irqsave(&dws->buf_lock, flags); + dws->n_bytes = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE); dws->tx = (void *)transfer->tx_buf; dws->tx_end = dws->tx + transfer->len; dws->rx = transfer->rx_buf; @@ -323,7 +324,6 @@ static int dw_spi_transfer_one(struct spi_controller *master, } transfer->effective_speed_hz = dws->max_freq / chip->clk_div; - dws->n_bytes = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE); cr0 = dws->update_cr0(master, spi, transfer); dw_writel(dws, DW_SPI_CTRLR0, cr0); |