spi: move splitting transfers to spi_optimize_message()
authorDavid Lechner <dlechner@baylibre.com>
Mon, 19 Feb 2024 22:33:19 +0000 (16:33 -0600)
committerMark Brown <broonie@kernel.org>
Mon, 26 Feb 2024 13:55:11 +0000 (13:55 +0000)
commitfab53fea21a909e4e0656764a8ee7c356fe89d6f
tree74422173750cff6eff702ef7da1e9f4b5be8be09
parent7b1d87af14d9ae902ed0c5dc5fabf4eea5abdf02
spi: move splitting transfers to spi_optimize_message()

Splitting transfers is an expensive operation so we can potentially
optimize it by doing it only once per optimization of the message
instead of repeating each time the message is transferred.

The transfer splitting functions are currently the only user of
spi_res_alloc() so spi_res_release() can be safely moved at this time
from spi_finalize_current_message() to spi_unoptimize_message().

The doc comments of the public functions for splitting transfers are
also updated so that callers will know when it is safe to call them
to ensure proper resource management.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://msgid.link/r/20240219-mainline-spi-precook-message-v2-2-4a762c6701b9@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c