* [PATCH] ASoC: wm_hubs: Remove unneeded count variable in wait_for_dc_servo
@ 2011-10-07 7:54 Axel Lin
2011-10-07 10:13 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-10-07 7:54 UTC (permalink / raw)
To: linux-kernel; +Cc: Mark Brown, Liam Girdwood, alsa-devel
The count variable is not required, decrement timeout in the while loop
can achieve the same effect.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
sound/soc/codecs/wm_hubs.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 84f33d4..6e2e122 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -66,7 +66,6 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
{
struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
unsigned int reg;
- int count = 0;
int timeout;
unsigned int val;
@@ -83,7 +82,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
timeout = 400;
do {
- count++;
+ timeout--;
if (hubs->dcs_done_irq)
wait_for_completion_timeout(&hubs->dcs_done,
@@ -93,9 +92,9 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op)
reg = snd_soc_read(codec, WM8993_DC_SERVO_0);
dev_dbg(codec->dev, "DC servo: %x\n", reg);
- } while (reg & op && count < timeout);
+ } while ((reg & op) && timeout);
- if (reg & op)
+ if (timeout == 0)
dev_err(codec->dev, "Timed out waiting for DC Servo %x\n",
op);
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-07 10:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 7:54 [PATCH] ASoC: wm_hubs: Remove unneeded count variable in wait_for_dc_servo Axel Lin
2011-10-07 10:13 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox