summaryrefslogtreecommitdiff
path: root/drivers/slimbus/messaging.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/slimbus/messaging.c')
-rw-r--r--drivers/slimbus/messaging.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c
index e5ae26227bdb..e2dbe4a66b70 100644
--- a/drivers/slimbus/messaging.c
+++ b/drivers/slimbus/messaging.c
@@ -13,8 +13,8 @@
*
* @ctrl: Controller handle
* @reply: Reply received from the device
- * @len: Length of the reply
* @tid: Transaction ID received with which framework can associate reply.
+ * @len: Length of the reply
*
* Called by controller to inform framework about the response received.
* This helps in making the API asynchronous, and controller-driver doesn't need
@@ -79,7 +79,7 @@ int slim_alloc_txn_tid(struct slim_controller *ctrl, struct slim_msg_txn *txn)
EXPORT_SYMBOL_GPL(slim_alloc_txn_tid);
/**
- * slim_free_txn_tid() - Freee tid of txn
+ * slim_free_txn_tid() - Free tid of txn
*
* @ctrl: Controller handle
* @txn: transaction whose tid should be freed
@@ -101,7 +101,7 @@ EXPORT_SYMBOL_GPL(slim_free_txn_tid);
* @txn: Transaction to be sent over SLIMbus
*
* Called by controller to transmit messaging transactions not dealing with
- * Interface/Value elements. (e.g. transmittting a message to assign logical
+ * Interface/Value elements. (e.g. transmitting a message to assign logical
* address to a slave device
*
* Return: -ETIMEDOUT: If transmission of this message timed out
@@ -111,7 +111,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
{
DECLARE_COMPLETION_ONSTACK(done);
bool need_tid = false, clk_pause_msg = false;
- int ret, timeout;
+ int ret;
+ unsigned long time_left;
/*
* do not vote for runtime-PM if the transactions are part of clock
@@ -142,18 +143,17 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
if (!txn->msg->comp)
txn->comp = &done;
- else
- txn->comp = txn->comp;
}
ret = ctrl->xfer_msg(ctrl, txn);
-
- if (!ret && need_tid && !txn->msg->comp) {
+ if (ret == -ETIMEDOUT) {
+ slim_free_txn_tid(ctrl, txn);
+ } else if (!ret && need_tid && !txn->msg->comp) {
unsigned long ms = txn->rl + HZ;
- timeout = wait_for_completion_timeout(txn->comp,
- msecs_to_jiffies(ms));
- if (!timeout) {
+ time_left = wait_for_completion_timeout(txn->comp,
+ msecs_to_jiffies(ms));
+ if (!time_left) {
ret = -ETIMEDOUT;
slim_free_txn_tid(ctrl, txn);
}
@@ -222,7 +222,7 @@ static u16 slim_slicesize(int code)
/**
* slim_xfer_msg() - Transfer a value info message on slim device
*
- * @sbdev: slim device to which this msg has to be transfered
+ * @sbdev: slim device to which this msg has to be transferred
* @msg: value info message pointer
* @mc: message code of the message
*