]> git.baikalelectronics.ru Git - kernel.git/commit
spi: Ensure the io_mutex is held until spi_finalize_current_message()
authorDavid Jander <david@protonic.nl>
Tue, 21 Jun 2022 06:12:33 +0000 (08:12 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 27 Jun 2022 12:27:25 +0000 (13:27 +0100)
commita7098bd2164fb5f1a76bb249fe23e7ee8000c264
tree08eb639a0785fd1564e05e2664532164917d2f28
parent2a6a6df3deef9325ee5df0d7e6d4f1a09ba1dbbf
spi: Ensure the io_mutex is held until spi_finalize_current_message()

This patch introduces a completion that is completed in
spi_finalize_current_message() and waited for in
__spi_pump_transfer_message(). This way all manipulation of ctlr->cur_msg
is done with the io_mutex held and strictly ordered:
__spi_pump_transfer_message() will not return until
spi_finalize_current_message() is done using ctlr->cur_msg, and its
calling context is only touching ctlr->cur_msg after returning.
Due to this, we can safely drop the spin-locks around ctlr->cur_msg.

Signed-off-by: David Jander <david@protonic.nl>
Link: https://lore.kernel.org/r/20220621061234.3626638-11-david@protonic.nl
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c
include/linux/spi/spi.h