]> git.baikalelectronics.ru Git - kernel.git/commit
spi: Don't use the message queue if possible in spi_sync
authorDavid Jander <david@protonic.nl>
Tue, 21 Jun 2022 06:12:25 +0000 (08:12 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 27 Jun 2022 12:27:17 +0000 (13:27 +0100)
commitf516f2ccda119c9e61e038ee67d0ae629fab296f
tree23155ebdfdee2cf38b3ed9bd918e323c1fcc5ca8
parent7cc2346b50f6d05920a00271367429f99acea040
spi: Don't use the message queue if possible in spi_sync

The interaction with the controller message queue and its corresponding
auxiliary flags and variables requires the use of the queue_lock which is
costly. Since spi_sync will transfer the complete message anyway, and not
return until it is finished, there is no need to put the message into the
queue if the queue is empty. This can save a lot of overhead.

As an example of how significant this is, when using the MCP2518FD SPI CAN
controller on a i.MX8MM SoC, the time during which the interrupt line
stays active (during 3 relatively short spi_sync messages), is reduced
from 98us to 72us by this patch.

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