Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@gmail.com>
To: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: Alsa-devel <alsa-devel@alsa-project.org>
Subject: Re: [PATCH] cs4231-lib: replace common delay loop by function
Date: Wed, 05 Sep 2007 00:37:01 +0200	[thread overview]
Message-ID: <46DDDE0D.7070904@gmail.com> (raw)
In-Reply-To: <20070904184927.0bb3bc7c.krzysztof.h1@wp.pl>

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

       reply	other threads:[~2007-09-04 22:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070904184927.0bb3bc7c.krzysztof.h1@wp.pl>
2007-09-04 22:37 ` Rene Herman [this message]
2007-09-05 17:09 [PATCH] cs4231-lib: replace common delay loop by function Krzysztof Helt
2007-09-05 19:11 ` Rene Herman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46DDDE0D.7070904@gmail.com \
    --to=rene.herman@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=krzysztof.h1@wp.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox