From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: alsa-devel@alsa-project.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>
Subject: [PATCH] ASoC: wm_hubs: Remove unneeded count variable in wait_for_dc_servo
Date: Fri, 07 Oct 2011 15:54:25 +0800 [thread overview]
Message-ID: <1317974065.16830.1.camel@phoenix> (raw)
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
WARNING: multiple messages have this Message-ID (diff)
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>,
alsa-devel@alsa-project.org
Subject: [PATCH] ASoC: wm_hubs: Remove unneeded count variable in wait_for_dc_servo
Date: Fri, 07 Oct 2011 15:54:25 +0800 [thread overview]
Message-ID: <1317974065.16830.1.camel@phoenix> (raw)
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
next reply other threads:[~2011-10-07 7:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 7:54 Axel Lin [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317974065.16830.1.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.