spi: spi-dw: Remove extraneous locking
authorSerge Semin <Sergey.Semin@baikalelectronics.ru>
Sun, 20 Sep 2020 11:28:48 +0000 (14:28 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 29 Sep 2020 16:22:28 +0000 (17:22 +0100)
commit0b6bfad4cee4a3d5c49e01fa00284db4b676360e
treeeb8e2603198844ff100d9ef0a04d07ac3233e1a4
parentffb7ca54c95b4c76ad8a9aa1b2b16d61df2a7139
spi: spi-dw: Remove extraneous locking

There is no point in having the commit 19b61392c5a8 ("spi: spi-dw: Add
lock protect dw_spi rx/tx to prevent concurrent calls") applied. The
commit author made an assumption that the problem with the rx data
mismatch was due to the lack of the data protection. While most likely it
was caused by the lack of the memory barrier. So having the
commit bfda044533b2 ("spi: dw: use "smp_mb()" to avoid sending spi data
error") applied would be enough to fix the problem.

Indeed the spin unlock operation makes sure each memory operation issued
before the release will be completed before it's completed. In other words
it works as an implicit one way memory barrier. So having both smp_mb()
and the spin_unlock_irqrestore() here is just redundant. One of them would
be enough. It's better to leave the smp_mb() since the Tx/Rx buffers
consistency is provided by the data transfer algorithm implementation:
first we initialize the buffers pointers, then make sure the assignments
are visible by the other CPUs by calling the smp_mb(), only after that
enable the interrupt, which handler uses the buffers.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20200920112914.26501-5-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw-core.c
drivers/spi/spi-dw.h