diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2021-12-10 18:38:16 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-12-15 22:39:21 +0000 |
commit | 55dce1d55df554e684c87ab1baea9edfcb12aa09 (patch) | |
tree | d779575821c070f50f18abdacea1c446ff433b9c /src/drivers | |
parent | e3ae755575e0646f9dd47400a1dfc6018e16e9a8 (diff) |
drivers/spi/spi-generic: document SPI_CNTRLR_DEDUCT_CMD_LEN better
This should make it a bit clearer what the differences between
SPI_CNTRLR_DEDUCT_OPCODE_LEN and SPI_CNTRLR_DEDUCT_CMD_LEN and the
corresponding functionality in spi_crop_chunk are.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I809adebb182fc0866b93372b5b486117176da388
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60122
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/spi/spi-generic.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/drivers/spi/spi-generic.c b/src/drivers/spi/spi-generic.c index 9796663da2..e6ec7bd8d5 100644 --- a/src/drivers/spi/spi-generic.c +++ b/src/drivers/spi/spi-generic.c @@ -98,6 +98,10 @@ unsigned int spi_crop_chunk(const struct spi_slave *slave, unsigned int cmd_len, if (deduct_opcode_len) cmd_len--; + /* Subtract command length from useable buffer size. If + deduct_opcode_len is set, only subtract the number command bytes + after the opcode. If the adjusted cmd_len is larger than ctrlr_max + return 0 to inidicate an error. */ if (deduct_cmd_len) { if (ctrlr_max >= cmd_len) { ctrlr_max -= cmd_len; |