msm : Add support to get user defined TTY device for Uart port

Currently UART port is enumerating with platform device ID. It is not
necessary that TTY<ID> is same as available UART device ID. Provide
optional support which allows to override used platform device ID with
uart port by userid to get TTY based Uart device as /dev/ttyHS<userid>
instead of /dev/ttyHS<ID>.This support helps third party application/test
framework to use the same TTY uart device name across different platform
without changing in those applications as it is not necessary that on
different platform used UART device would be having same TTY<ID> name.
The userid value should be from 0 to 256

CRs-Fixed: 386736
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
(cherry picked from commit 51690e5e8c2d6199a0e1162aa2c0317a2c6a9f89)

Change-Id: I3d9546ceab48345d0e3456c6223e3ff82e5a2f8b
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>

Signed-off-by: Dilip Kota <c_dkota@codeaurora.org>
diag: Fix possible underflow/overflow issues

Add check in order to fix possible integer underflow
during HDLC encoding which may lead to buffer
overflow. Also added check for packet length to
avoid buffer overflow.

Change-Id: I72858e7625764652571aee3154e3c2eb61655168
CRs-Fixed: 483400
CRs-Fixed: 483408
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
Merge "msm : Add support to get user defined TTY device for Uart port"
Merge "diag: Fix possible underflow/overflow issues"