From 3baa0daae9fc2b3a8faf14cad291b1f466100760 Mon Sep 17 00:00:00 2001 From: Sai Chaitanya Kaveti Date: Fri, 29 Jul 2022 18:08:13 +0530 Subject: [PATCH] msm: mhi_dev: Avoiding delay in transfer completion When size of user client buffer is smaller than the size of data read, client calls the mhi_uci_client_read API for the second time with the remaining bytes of data to be copied. In this, data is already read from host but copying to client buffer is pending. With the current logic device waits for read_wq and then eventually exits as there is no data to read from host. This is causing a delay in the transfer completion in the case where user client buffer is less than data read from host. To avoid this delay, entering the loop to read data from host only if it is a new transfer. For old transfers, as read from host is already done, waiting for read_wq is avoided with this change. Change-Id: I75b6f6e3673cf5c05693579acaddf189b5478926 Signed-off-by: Sai Chaitanya Kaveti --- drivers/platform/msm/mhi_dev/mhi_uci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/msm/mhi_dev/mhi_uci.c b/drivers/platform/msm/mhi_dev/mhi_uci.c index e65264480c75..d8c8f8655f25 100644 --- a/drivers/platform/msm/mhi_dev/mhi_uci.c +++ b/drivers/platform/msm/mhi_dev/mhi_uci.c @@ -1327,7 +1327,7 @@ static int __mhi_uci_client_read(struct uci_client *uci_handle, { int ret_val = 0; - do { + while (!uci_handle->pkt_loc) { if (!mhi_uci_are_channels_connected(uci_handle)) { uci_log(UCI_DBG_ERROR, "Channels are not connected\n"); return -ENODEV; @@ -1371,7 +1371,7 @@ static int __mhi_uci_client_read(struct uci_client *uci_handle, uci_handle->in_chan); break; } - } while (!uci_handle->pkt_loc); + } return ret_val; }