]> git.baikalelectronics.ru Git - kernel.git/commit
drm/mipi-dbi: align max_chunk to 2 in spi_transfer
authorYunhao Tian <t123yh.xyz@gmail.com>
Tue, 10 May 2022 03:02:19 +0000 (11:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:17:37 +0000 (11:17 +0200)
commitd47709c2ed0254a001c59b6de3a5cc1fa687bfbd
tree9f15c7e7ed8ae015cc47e29187b224484c871f93
parent99857be6ab535bdf017cab8f8fd8f0939a9aa24f
drm/mipi-dbi: align max_chunk to 2 in spi_transfer

[ Upstream commit 6527d3d2a64078a227cc9f26eee25e37d4170e26 ]

In __spi_validate, there's a validation that no partial transfers
are accepted (xfer->len % w_size must be zero). When
max_chunk is not a multiple of bpw (e.g. max_chunk = 65535,
bpw = 16), the transfer will be rejected.

This patch aligns max_chunk to 2 bytes (the maximum value of bpw is 16),
so that no partial transfer will occur.

Fixes: ecdffcc97ac3 ("drm/tinydrm: Move tinydrm_spi_transfer()")
Signed-off-by: Yunhao Tian <t123yh.xyz@gmail.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220510030219.2486687-1-t123yh.xyz@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_mipi_dbi.c