Skip to content

Commit 9c6fd5f

Browse files
Wolfram Sanggregkh
authored andcommitted
slimbus: qcom-ctrl: use 'time_left' variable with wait_for_completion_timeout()
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_for_completion_timeout() causing patterns like: timeout = wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Fix to the proper variable type 'unsigned long' while here. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent eee75a3 commit 9c6fd5f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/slimbus/qcom-ctrl.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ static int qcom_xfer_msg(struct slim_controller *sctrl,
330330
void *pbuf = slim_alloc_txbuf(ctrl, txn, &done);
331331
unsigned long ms = txn->rl + HZ;
332332
u8 *puc;
333-
int ret = 0, timeout, retries = QCOM_BUF_ALLOC_RETRIES;
333+
int ret = 0, retries = QCOM_BUF_ALLOC_RETRIES;
334+
unsigned long time_left;
334335
u8 la = txn->la;
335336
u32 *head;
336337
/* HW expects length field to be excluded */
@@ -374,9 +375,9 @@ static int qcom_xfer_msg(struct slim_controller *sctrl,
374375
memcpy(puc, txn->msg->wbuf, txn->msg->num_bytes);
375376

376377
qcom_slim_queue_tx(ctrl, head, txn->rl, MGR_TX_MSG);
377-
timeout = wait_for_completion_timeout(&done, msecs_to_jiffies(ms));
378+
time_left = wait_for_completion_timeout(&done, msecs_to_jiffies(ms));
378379

379-
if (!timeout) {
380+
if (!time_left) {
380381
dev_err(ctrl->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc,
381382
txn->mt);
382383
ret = -ETIMEDOUT;

0 commit comments

Comments
 (0)