Skip to content

Commit 4e1f953

Browse files
Wolfram Sangbroonie
authored andcommitted
ASoC: codecs: wm8996: 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]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Charles Keepax <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 19c70b4 commit 4e1f953

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sound/soc/codecs/wm8996.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -655,28 +655,28 @@ static void wait_for_dc_servo(struct snd_soc_component *component, u16 mask)
655655
struct i2c_client *i2c = to_i2c_client(component->dev);
656656
struct wm8996_priv *wm8996 = snd_soc_component_get_drvdata(component);
657657
int ret;
658-
unsigned long timeout = 200;
658+
unsigned long time_left = 200;
659659

660660
snd_soc_component_write(component, WM8996_DC_SERVO_2, mask);
661661

662662
/* Use the interrupt if possible */
663663
do {
664664
if (i2c->irq) {
665-
timeout = wait_for_completion_timeout(&wm8996->dcs_done,
666-
msecs_to_jiffies(200));
667-
if (timeout == 0)
665+
time_left = wait_for_completion_timeout(&wm8996->dcs_done,
666+
msecs_to_jiffies(200));
667+
if (time_left == 0)
668668
dev_err(component->dev, "DC servo timed out\n");
669669

670670
} else {
671671
msleep(1);
672-
timeout--;
672+
time_left--;
673673
}
674674

675675
ret = snd_soc_component_read(component, WM8996_DC_SERVO_2);
676676
dev_dbg(component->dev, "DC servo state: %x\n", ret);
677-
} while (timeout && ret & mask);
677+
} while (time_left && ret & mask);
678678

679-
if (timeout == 0)
679+
if (time_left == 0)
680680
dev_err(component->dev, "DC servo timed out for %x\n", mask);
681681
else
682682
dev_dbg(component->dev, "DC servo complete for %x\n", mask);

0 commit comments

Comments
 (0)