Skip to content

Commit 571b90f

Browse files
Wolfram SangAndi Shyti
authored andcommitted
i2c: amd-mp2-plat: 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. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 5895a86 commit 571b90f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/i2c/busses/i2c-amd-mp2-plat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ static void i2c_amd_cmd_completion(struct amd_i2c_common *i2c_common)
9797
static int i2c_amd_check_cmd_completion(struct amd_i2c_dev *i2c_dev)
9898
{
9999
struct amd_i2c_common *i2c_common = &i2c_dev->common;
100-
unsigned long timeout;
100+
unsigned long time_left;
101101

102-
timeout = wait_for_completion_timeout(&i2c_dev->cmd_complete,
103-
i2c_dev->adap.timeout);
102+
time_left = wait_for_completion_timeout(&i2c_dev->cmd_complete,
103+
i2c_dev->adap.timeout);
104104

105105
if ((i2c_common->reqcmd == i2c_read ||
106106
i2c_common->reqcmd == i2c_write) &&
107107
i2c_common->msg->len > 32)
108108
i2c_amd_dma_unmap(i2c_common);
109109

110-
if (timeout == 0) {
110+
if (time_left == 0) {
111111
amd_mp2_rw_timeout(i2c_common);
112112
return -ETIMEDOUT;
113113
}

0 commit comments

Comments
 (0)