[alsa-devel] [PATCH] alsa: lx6464es - initialization fixes

Takashi Iwai tiwai at suse.de
Tue Jul 26 07:54:18 CEST 2011


At Mon, 25 Jul 2011 20:34:56 +0200,
Tim Blechmann wrote:
> 
> this using this fix, the driver is usable with non-rt kernels. the card
> initialization is moved from the prepare to the hw_params callback.

I don't care much and will accept the change like this (after fixing some
issues below), but still wonder why moving to hw_params fixes the
issue...

> also
> the error handling is improved.
> 
> Signed-off-by: Tim Blechmann <tim at klingt.org>
> ---
>  sound/pci/lx6464es/lx6464es.c |   72 +++++++++++++++++++++--------------------
>  sound/pci/lx6464es/lx6464es.h |    1 +
>  sound/pci/lx6464es/lx_core.c  |   43 +++++++++++++++----------
>  sound/pci/lx6464es/lx_core.h  |    3 +-
>  4 files changed, 66 insertions(+), 53 deletions(-)
> 
> diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
> index 1bd7a54..722212e 100644
> --- a/sound/pci/lx6464es/lx6464es.c
> +++ b/sound/pci/lx6464es/lx6464es.c
> @@ -103,16 +103,14 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran);
>  
>  
>  static int lx_hardware_open(struct lx6464es *chip,
> -			    struct snd_pcm_substream *substream)
> +			    struct snd_pcm_substream *substream,
> +			    int channels, snd_pcm_uframes_t period_size)
>  {
>  	int err = 0;
> -	struct snd_pcm_runtime *runtime = substream->runtime;
> -	int channels = runtime->channels;
>  	int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
>  
> -	snd_pcm_uframes_t period_size = runtime->period_size;
> -
> -	snd_printd(LXP "allocating pipe for %d channels\n", channels);
> +	snd_printk(LXP "allocating pipe for %d channels, %lu period size\n",
> +		   channels, period_size);

Please don't change the debug message to a normal message.
This would appear way too likely.  Even I think snd_printdd() would be
more appropriate there, since snd_printd() is enabled on most distros.

> @@ -295,13 +293,33 @@ static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream
>  	return pos;
>  }
>  
> +
>  static int lx_pcm_prepare(struct snd_pcm_substream *substream)
>  {
>  	struct lx6464es *chip = snd_pcm_substream_chip(substream);
>  	int err = 0;
> -	const int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
>  
> -	snd_printdd("->lx_pcm_prepare\n");
> +	snd_printd("->lx_pcm_prepare %d\n", is_capture);

Ditto.  I'd suggest to change all this kind of debug prints to
snd_printdd(), at least.  But this can be done in a different patch.


thanks,

Takashi


More information about the Alsa-devel mailing list