Skip to content

Commit 222a596

Browse files
Wolfram Sangtiwai
authored andcommitted
ALSA: aoa: soundbus: i2sbus: pcm: 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> Link: https://lore.kernel.org/r/20240430121028.30443-1-wsa+renesas@sang-engineering.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 44f69dd commit 222a596

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • sound/aoa/soundbus/i2sbus

sound/aoa/soundbus/i2sbus/pcm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,24 +255,24 @@ static void i2sbus_wait_for_stop(struct i2sbus_dev *i2sdev,
255255
{
256256
unsigned long flags;
257257
DECLARE_COMPLETION_ONSTACK(done);
258-
long timeout;
258+
unsigned long time_left;
259259

260260
spin_lock_irqsave(&i2sdev->low_lock, flags);
261261
if (pi->dbdma_ring.stopping) {
262262
pi->stop_completion = &done;
263263
spin_unlock_irqrestore(&i2sdev->low_lock, flags);
264-
timeout = wait_for_completion_timeout(&done, HZ);
264+
time_left = wait_for_completion_timeout(&done, HZ);
265265
spin_lock_irqsave(&i2sdev->low_lock, flags);
266266
pi->stop_completion = NULL;
267-
if (timeout == 0) {
267+
if (time_left == 0) {
268268
/* timeout expired, stop dbdma forcefully */
269269
printk(KERN_ERR "i2sbus_wait_for_stop: timed out\n");
270270
/* make sure RUN, PAUSE and S0 bits are cleared */
271271
out_le32(&pi->dbdma->control, (RUN | PAUSE | 1) << 16);
272272
pi->dbdma_ring.stopping = 0;
273-
timeout = 10;
273+
time_left = 10;
274274
while (in_le32(&pi->dbdma->status) & ACTIVE) {
275-
if (--timeout <= 0)
275+
if (--time_left <= 0)
276276
break;
277277
udelay(1);
278278
}

0 commit comments

Comments
 (0)