[alsa-devel] [PATCH] cs4231-lib: replace common delay loop by function
Rene Herman
rene.herman at gmail.com
Wed Sep 5 00:37:01 CEST 2007
On 09/04/2007 06:49 PM, Krzysztof Helt wrote:
> +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?
> +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) {
> cs4231_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
More information about the Alsa-devel
mailing list