Loading
msm_serial_hs_lite : Prevent pushing extra bytes to the top layer
In scenarios where hslite UART communicating with peer UART device it
may happen that we many not receive all the sent bytes at one go. This
can happen when the peer is not able to send complete payload at once
due to smaller FIFO size or rescheduled by high priority threads. Unless
its Last chunk, driver assumes it will receive and push 4 bytes to the
tty Layer which is not correct always. There is an issue that we are not
verifying the bytes pushed to the tty layer and always assumes its either
in multiple of 4 or its a last chunk having less than 4 bytes.
For example, 1 Byte FIFO size on peer device tries to send total 10 bytes
of data but after 7 bytes it may get delayed sending remaining 3 bytes
due to ISR or high priority threads. In this case hslite driver will
receive 7 Bytes + 1 wrongly padded byte + 3 bytes remaining. Hence,
totally user space receives 11 bytes instead 10 Bytes.
This change makes sure that it reads the data and push the same number of
bytes to the top layer without any extra padding.
Change-Id: I12754a2c95ee7e3d85dd020093d99b01a2a2831a
Signed-off-by:
Mukesh Kumar Savaliya <msavaliy@codeaurora.org>