From 5593a67ad054689bf749974979517e42dd90dc78 Mon Sep 17 00:00:00 2001 From: Arun Kumar Neelakantam Date: Fri, 10 Apr 2020 10:40:45 +0530 Subject: [PATCH] qrtr: mhi-dev: Wait for RX channel to be enumerated Registering only for endpoint RX channel to complete enumeration and starting to open both RX/TX channels leads to race condition on TX channel. Since the host does TX followed by RX init. Wait for endpoint TX channel init to synchronise with host. Change-Id: Ied002a89b51f71fa30cb7557f7dce27cfe1fd202 Signed-off-by: Sricharan R Signed-off-by: Arun Kumar Neelakantam --- net/qrtr/mhi_dev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/qrtr/mhi_dev.c b/net/qrtr/mhi_dev.c index eb1692353661..8333f83a94d1 100644 --- a/net/qrtr/mhi_dev.c +++ b/net/qrtr/mhi_dev.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, The Linux Foundation. All rights reserved. +/* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -222,8 +222,11 @@ static int qrtr_mhi_dev_probe(struct platform_device *pdev) mutex_init(&qep->out_lock); init_completion(&qep->out_tre); qep->ep.xmit = qrtr_mhi_dev_send; + /* HOST init TX first followed by RX, so register for endpoint TX + * which makes both channel ready by checking one channel state. + */ rc = mhi_register_state_cb(qrtr_mhi_dev_state_cb, qep, - QRTR_MHI_DEV_IN); + QRTR_MHI_DEV_OUT); if (rc) return rc;