netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: qrtr: mhi: make it work again
@ 2021-08-29 12:45 Dmitry Baryshkov
  2021-08-29 13:49 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Baryshkov @ 2021-08-29 12:45 UTC (permalink / raw)
  To: Manivannan Sadhasivam, David S. Miller; +Cc: linux-arm-msm, netdev

The commit ce78ffa3ef16 ("net: really fix the build...") introduced two
issues into the mhi.c driver:
 - use of initialized completion
 - calling mhi_prepare_for_transfer twice

While the first one is pretty obvious, the second one makes all devices
using mhi.c to return -EINVAL during probe. Fist
mhi_prepare_for_transfer() would change both channels state to ENABLED.
Then when second mhi_prepare_for_transfer() would be called it would
also try switching them to ENABLED again, which is forbidden by the
state machine in the mhi_update_channel_state() function (see
drivers/bus/mhi/core/main.c).
These two issues make all drivers using qcom_mhi_qrtr (e.g. ath11k) to
fail with -EINVAL.

Fix them by removing first mhi_prepare_for_transfer() call and by adding
the init_completion() call.

Fixes: ce78ffa3ef16 ("net: really fix the build...")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 net/qrtr/mhi.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c
index 1dc955ca57d3..f3f4a5fdeaf3 100644
--- a/net/qrtr/mhi.c
+++ b/net/qrtr/mhi.c
@@ -83,15 +83,12 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
 	struct qrtr_mhi_dev *qdev;
 	int rc;
 
-	/* start channels */
-	rc = mhi_prepare_for_transfer(mhi_dev, 0);
-	if (rc)
-		return rc;
-
 	qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL);
 	if (!qdev)
 		return -ENOMEM;
 
+	init_completion(&qdev->ready);
+
 	qdev->mhi_dev = mhi_dev;
 	qdev->dev = &mhi_dev->dev;
 	qdev->ep.xmit = qcom_mhi_qrtr_send;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-29 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-29 12:45 [PATCH] net: qrtr: mhi: make it work again Dmitry Baryshkov
2021-08-29 13:49 ` Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).