unsigned int to1, to2, i;
unsigned short adr;
- for (i = 0; i < AC97_READ_RETRY; ++i) {
+ for (i = AC97_READ_RETRY; i; i--) {
*v = 0;
/* wait for HAC to receive something from the codec */
for (to1 = TMO_E4;
udelay(21);
}
HACREG(HACRSR) &= ~(RSR_STDRY | RSR_STARY);
- return (i < AC97_READ_RETRY);
+ return i;
}
static unsigned short hac_read_codec_aux(struct hac_priv *hac,
unsigned short val;
unsigned int i, to;
- for (i = 0; i < AC97_READ_RETRY; i++) {
+ for (i = AC97_READ_RETRY; i; i--) {
/* send_read_request */
local_irq_disable();
HACREG(HACTSR) &= ~(TSR_CMDAMT);
break;
}
- if (i == AC97_READ_RETRY)
- return ~0;
-
- return val;
+ return i ? val : ~0;
}
static void hac_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
struct hac_priv *hac = &hac_cpu_data[unit_id];
unsigned int i, to;
/* write_codec_aux */
- for (i = 0; i < AC97_WRITE_RETRY; i++) {
+ for (i = AC97_WRITE_RETRY; i; i--) {
/* send_write_request */
local_irq_disable();
HACREG(HACTSR) &= ~(TSR_CMDDMT | TSR_CMDAMT);