Skip to content

Commit eee75a3

Browse files
Wolfram Sanggregkh
authored andcommitted
slimbus: messaging: 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 <wsa+renesas@sang-engineering.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com> Link: https://lore.kernel.org/r/20240902141004.70048-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 59d617d commit eee75a3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

drivers/slimbus/messaging.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
111111
{
112112
DECLARE_COMPLETION_ONSTACK(done);
113113
bool need_tid = false, clk_pause_msg = false;
114-
int ret, timeout;
114+
int ret;
115+
unsigned long time_left;
115116

116117
/*
117118
* do not vote for runtime-PM if the transactions are part of clock
@@ -151,9 +152,9 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
151152
if (!ret && need_tid && !txn->msg->comp) {
152153
unsigned long ms = txn->rl + HZ;
153154

154-
timeout = wait_for_completion_timeout(txn->comp,
155-
msecs_to_jiffies(ms));
156-
if (!timeout) {
155+
time_left = wait_for_completion_timeout(txn->comp,
156+
msecs_to_jiffies(ms));
157+
if (!time_left) {
157158
ret = -ETIMEDOUT;
158159
slim_free_txn_tid(ctrl, txn);
159160
}

0 commit comments

Comments
 (0)