* [PATCH] ASoC: Avoid a redundant read in cs42l51_pdn_event
@ 2011-11-01 7:17 Axel Lin
2011-11-08 11:02 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-11-01 7:17 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Liam Girdwood, Arnaud Patard
snd_soc_update_bits already does read-modify-write,
no need to read the register before calling snd_soc_update_bits.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
sound/soc/codecs/cs42l51.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 8c3c820..00718b5 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -175,21 +175,18 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- unsigned long value;
-
- value = snd_soc_read(w->codec, CS42L51_POWER_CTL1);
- value &= ~CS42L51_POWER_CTL1_PDN;
-
switch (event) {
case SND_SOC_DAPM_PRE_PMD:
- value |= CS42L51_POWER_CTL1_PDN;
+ snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
+ CS42L51_POWER_CTL1_PDN,
+ CS42L51_POWER_CTL1_PDN);
break;
default:
case SND_SOC_DAPM_POST_PMD:
+ snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
+ CS42L51_POWER_CTL1_PDN, 0);
break;
}
- snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
- CS42L51_POWER_CTL1_PDN, value);
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-08 11:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 7:17 [PATCH] ASoC: Avoid a redundant read in cs42l51_pdn_event Axel Lin
2011-11-08 11:02 ` Mark Brown
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.