slim_msm: don't call completion after timeout
making the completion pointer to NULL, if the timeout
occurs before firing the interrupt. This is to avoid
calling the complete function from the interrupt
handler, if the interrupt fires after completion
timeout. It's from QCT
Change-Id: I31d4a74297e670711041d866de55e1b5350575c1
diff --git a/drivers/slimbus/slim-msm-ctrl.c b/drivers/slimbus/slim-msm-ctrl.c
index fa9d1df..84ba5f9 100644
--- a/drivers/slimbus/slim-msm-ctrl.c
+++ b/drivers/slimbus/slim-msm-ctrl.c
@@ -888,14 +888,16 @@
}
}
}
+ if (!timeout) {
+ dev_err(dev->dev, "TX timed out:MC:0x%x,mt:0x%x",
+ txn->mc, txn->mt);
+ dev->wr_comp = NULL;
+ }
+
mutex_unlock(&dev->tx_lock);
if (msgv >= 0)
msm_slim_put_ctrl(dev);
- if (!timeout)
- dev_err(dev->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc,
- txn->mt);
-
return timeout ? dev->err : -ETIMEDOUT;
}
@@ -918,6 +920,8 @@
dev->wr_comp = &done;
msm_send_msg_buf(ctrl, buf, 9);
timeout = wait_for_completion_timeout(&done, HZ);
+ if (!timeout)
+ dev->wr_comp = NULL;
mutex_unlock(&dev->tx_lock);
return timeout ? dev->err : -ETIMEDOUT;
}