[alsa-devel] [PATCH 01/11] sound: core: Add debug-print helper function

Mark Brown broonie at opensource.wolfsonmicro.com
Tue May 8 16:08:03 CEST 2012


On Tue, May 08, 2012 at 03:56:25PM +0200, Ola Lilja wrote:
> Adds a function getting the stream-name as a string for
> a specific stream.

Adding Takashi as this is an ALSA core thing.  Always CC maintainers on
patches and always try to use subject lines matching the standard for
the subsystem.  Not cutting any text for his benefit.

> 
> Signed-off-by: Ola Lilja <ola.o.lilja at stericsson.com>
> ---
>  include/sound/pcm.h |    2 ++
>  sound/core/pcm.c    |   10 ++++++++++
>  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/include/sound/pcm.h b/include/sound/pcm.h
> index 0d11128..8a153e6 100644
> --- a/include/sound/pcm.h
> +++ b/include/sound/pcm.h
> @@ -1073,4 +1073,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
>  
>  const char *snd_pcm_format_name(snd_pcm_format_t format);
>  
> +const char *snd_pcm_stream_str(struct snd_pcm_substream *substream);
> +
>  #endif /* __SOUND_PCM_H */
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 1a3070b..9e83f00 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -1187,6 +1187,16 @@ static void snd_pcm_proc_done(void)
>  #define snd_pcm_proc_done()
>  #endif /* CONFIG_PROC_FS */
>  
> +/**
> + * Get a string naming the direction of a stream
> + */
> +const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
> +{
> +	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> +		return "Playback";
> +	else
> +		return "Capture";
> +}

This needs to be exported for modular builds, or perhaps just made a
static inline in the header.

>  
>  /*
>   *  ENTRY functions
> -- 
> 1.7.8.3
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20120508/5080fcf9/attachment.sig 


More information about the Alsa-devel mailing list