aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorManuel Lauss <mano@roarinelk.homelinux.net>2007-11-06 05:56:17 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:17 -0500
commit690eceb58ca900a55ae0cec5e8770ac166a881d8 (patch)
treed4cb76b81691fd959e8194d65cb036e3aac02040 /sound/soc
parente035b841015251062316cb60b47d1f11d2703f6d (diff)
[ALSA] ASoC: sh: improve generated code for HAC module (AC97)
Change loops in ac97_read/write functions to count down to zero rather than up. Gcc will then use the 'dt' (decrement-and-test) op instead of an increment/compare op-pair. Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/sh/hac.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c
index 8e3f03908cdb..34b77b9fbb9c 100644
--- a/sound/soc/sh/hac.c
+++ b/sound/soc/sh/hac.c
@@ -105,7 +105,7 @@ static int hac_get_codec_data(struct hac_priv *hac, unsigned short r,
105 unsigned int to1, to2, i; 105 unsigned int to1, to2, i;
106 unsigned short adr; 106 unsigned short adr;
107 107
108 for (i = 0; i < AC97_READ_RETRY; ++i) { 108 for (i = AC97_READ_RETRY; i; i--) {
109 *v = 0; 109 *v = 0;
110 /* wait for HAC to receive something from the codec */ 110 /* wait for HAC to receive something from the codec */
111 for (to1 = TMO_E4; 111 for (to1 = TMO_E4;
@@ -132,7 +132,7 @@ static int hac_get_codec_data(struct hac_priv *hac, unsigned short r,
132 udelay(21); 132 udelay(21);
133 } 133 }
134 HACREG(HACRSR) &= ~(RSR_STDRY | RSR_STARY); 134 HACREG(HACRSR) &= ~(RSR_STDRY | RSR_STARY);
135 return (i < AC97_READ_RETRY); 135 return i;
136} 136}
137 137
138static unsigned short hac_read_codec_aux(struct hac_priv *hac, 138static unsigned short hac_read_codec_aux(struct hac_priv *hac,
@@ -141,7 +141,7 @@ static unsigned short hac_read_codec_aux(struct hac_priv *hac,
141 unsigned short val; 141 unsigned short val;
142 unsigned int i, to; 142 unsigned int i, to;
143 143
144 for (i = 0; i < AC97_READ_RETRY; i++) { 144 for (i = AC97_READ_RETRY; i; i--) {
145 /* send_read_request */ 145 /* send_read_request */
146 local_irq_disable(); 146 local_irq_disable();
147 HACREG(HACTSR) &= ~(TSR_CMDAMT); 147 HACREG(HACTSR) &= ~(TSR_CMDAMT);
@@ -159,10 +159,7 @@ static unsigned short hac_read_codec_aux(struct hac_priv *hac,
159 break; 159 break;
160 } 160 }
161 161
162 if (i == AC97_READ_RETRY) 162 return i ? val : ~0;
163 return ~0;
164
165 return val;
166} 163}
167 164
168static void hac_ac97_write(struct snd_ac97 *ac97, unsigned short reg, 165static void hac_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
@@ -172,7 +169,7 @@ static void hac_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
172 struct hac_priv *hac = &hac_cpu_data[unit_id]; 169 struct hac_priv *hac = &hac_cpu_data[unit_id];
173 unsigned int i, to; 170 unsigned int i, to;
174 /* write_codec_aux */ 171 /* write_codec_aux */
175 for (i = 0; i < AC97_WRITE_RETRY; i++) { 172 for (i = AC97_WRITE_RETRY; i; i--) {
176 /* send_write_request */ 173 /* send_write_request */
177 local_irq_disable(); 174 local_irq_disable();
178 HACREG(HACTSR) &= ~(TSR_CMDDMT | TSR_CMDAMT); 175 HACREG(HACTSR) &= ~(TSR_CMDDMT | TSR_CMDAMT);