cs4231-lib: replace common delay loop by function
A message that is not in the archive (sent off-list or not yet received): [email protected]
Review
Quoted 11 lines · Krzysztof Helt
(quoted diff) +3
-1+static void snd_cs4231_ready(struct snd_cs4231 *chip) { int timeout; - unsigned char tmp; for (timeout = 250; timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); timeout--) udelay(100); +} +
Would you terribly mind calling this snd_cs4231_wait() or something close?
Quoted 15 lines
(quoted diff) +7
-4+static void snd_cs4231_outm(struct snd_cs4231 *chip, unsigned char reg, + unsigned char mask, unsigned char value) +{ + unsigned char tmp = (chip->image[reg] & mask) | value; + + snd_cs4231_ready(chip); #ifdef CONFIG_SND_DEBUG if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); #endif - if (chip->calibrate_mute) { - chip->image[reg] &= mask; - chip->image[reg] |= value; - } else { + if (!chip->calibrate_mute) {
Review
Quoted 10 lines
(quoted diff) +2
-3cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); - mb(); - tmp = (chip->image[reg] & mask) | value; + wmb(); cs4231_outb(chip, CS4231P(REG), tmp); - chip->image[reg] = tmp; mb(); } + chip->image[reg] = tmp; }
Mmm, for the ! case, the chip->image[reg] = tmp is now after the mb() -- but that's okay right?
Rene