Skip to content

Commit 8d699ff

Browse files
vwaxbroonie
authored andcommitted
spi: Split transfers larger than max size
A couple of drivers call spi_split_transfers_maxsize() from their ->prepare_message() callbacks to split transfers which are too big for them to handle. Add support in the core to do this based on ->max_transfer_size() to avoid code duplication. Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Link: https://lore.kernel.org/r/20220927112117.77599-4-vincent.whitchurch@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0c17ba7 commit 8d699ff

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/spi/spi.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,15 @@ static int __spi_pump_transfer_message(struct spi_controller *ctlr,
16491649

16501650
trace_spi_message_start(msg);
16511651

1652+
ret = spi_split_transfers_maxsize(ctlr, msg,
1653+
spi_max_transfer_size(msg->spi),
1654+
GFP_KERNEL | GFP_DMA);
1655+
if (ret) {
1656+
msg->status = ret;
1657+
spi_finalize_current_message(ctlr);
1658+
return ret;
1659+
}
1660+
16521661
if (ctlr->prepare_message) {
16531662
ret = ctlr->prepare_message(ctlr, msg);
16541663
if (ret) {

0 commit comments

Comments
 (0)