Skip to content

Commit 0800660

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

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sound/soc/codecs/wm8993.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ static int _wm8993_set_fll(struct snd_soc_component *component, int fll_id, int
470470
struct i2c_client *i2c = to_i2c_client(component->dev);
471471
u16 reg1, reg4, reg5;
472472
struct _fll_div fll_div;
473-
unsigned int timeout;
473+
unsigned long time_left;
474474
int ret;
475475

476476
/* Any change? */
@@ -543,19 +543,19 @@ static int _wm8993_set_fll(struct snd_soc_component *component, int fll_id, int
543543

544544
/* If we've got an interrupt wired up make sure we get it */
545545
if (i2c->irq)
546-
timeout = msecs_to_jiffies(20);
546+
time_left = msecs_to_jiffies(20);
547547
else if (Fref < 1000000)
548-
timeout = msecs_to_jiffies(3);
548+
time_left = msecs_to_jiffies(3);
549549
else
550-
timeout = msecs_to_jiffies(1);
550+
time_left = msecs_to_jiffies(1);
551551

552552
try_wait_for_completion(&wm8993->fll_lock);
553553

554554
/* Enable the FLL */
555555
snd_soc_component_write(component, WM8993_FLL_CONTROL_1, reg1 | WM8993_FLL_ENA);
556556

557-
timeout = wait_for_completion_timeout(&wm8993->fll_lock, timeout);
558-
if (i2c->irq && !timeout)
557+
time_left = wait_for_completion_timeout(&wm8993->fll_lock, time_left);
558+
if (i2c->irq && !time_left)
559559
dev_warn(component->dev, "Timed out waiting for FLL\n");
560560

561561
dev_dbg(component->dev, "FLL enabled at %dHz->%dHz\n", Fref, Fout);

0 commit comments

Comments
 (0)