Patch "drm/mipi-dbi: align max_chunk to 2 in spi_transfer" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/mipi-dbi: align max_chunk to 2 in spi_transfer

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-mipi-dbi-align-max_chunk-to-2-in-spi_transfer.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b135a42205f361977f19a833132f08a147411766
Author: Yunhao Tian <t123yh.xyz@xxxxxxxxx>
Date:   Tue May 10 11:02:19 2022 +0800

    drm/mipi-dbi: align max_chunk to 2 in spi_transfer
    
    [ Upstream commit 435c249008cba04ed6a7975e9411f3b934620204 ]
    
    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: d23d4d4dac01 ("drm/tinydrm: Move tinydrm_spi_transfer()")
    
    Signed-off-by: Yunhao Tian <t123yh.xyz@xxxxxxxxx>
    Signed-off-by: Noralf Trønnes <noralf@xxxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220510030219.2486687-1-t123yh.xyz@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 230c4fd7131c..9f132229aed1 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -1137,6 +1137,13 @@ int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz,
 	size_t chunk;
 	int ret;
 
+	/* In __spi_validate, there's a validation that no partial transfers
+	 * are accepted (xfer->len % w_size must be zero).
+	 * Here we align max_chunk to multiple of 2 (16bits),
+	 * to prevent transfers from being rejected.
+	 */
+	max_chunk = ALIGN_DOWN(max_chunk, 2);
+
 	spi_message_init_with_transfers(&m, &tr, 1);
 
 	while (len) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux