msm: mhi_dev: Initialize UCI client channel numbers early
Move the channel number initialization for UCI clients to
uci_init_client_attributes function to ensure the correct channel
number is used for registering callback with the MHI driver.
Correct the index used to retrieve the client handle.
Change-Id: I5987366aed582ac47895a1310e0e0ee0de07c470
Signed-off-by: Siva Kumar Akkireddi <sivaa@codeaurora.org>
diff --git a/drivers/platform/msm/mhi_dev/mhi_uci.c b/drivers/platform/msm/mhi_dev/mhi_uci.c
index f47d0f0..52d324e 100644
--- a/drivers/platform/msm/mhi_dev/mhi_uci.c
+++ b/drivers/platform/msm/mhi_dev/mhi_uci.c
@@ -1140,8 +1140,6 @@
{
init_waitqueue_head(&mhi_client->read_wq);
init_waitqueue_head(&mhi_client->write_wq);
- mhi_client->out_chan = index * 2 + 1;
- mhi_client->in_chan = index * 2;
mhi_client->client_index = index;
mutex_init(&mhi_client->in_chan_lock);
@@ -1301,10 +1299,12 @@
for (i = 0; i < ARRAY_SIZE(uci_chan_attr_table); i += 2) {
chan_attrib = &uci_chan_attr_table[i];
- index = CHAN_TO_CLIENT(i);
+ index = CHAN_TO_CLIENT(chan_attrib->chan_id);
client = &uci_ctxt->client_handles[index];
client->out_chan_attr = chan_attrib;
client->in_chan_attr = ++chan_attrib;
+ client->in_chan = index * 2;
+ client->out_chan = index * 2 + 1;
client->in_buf_list =
kcalloc(chan_attrib->nr_trbs,
sizeof(struct mhi_dev_iov),