[alsa-devel] export pcm_debug_name?

Eliot Blennerhassett linux at audioscience.com
Fri Apr 1 01:41:15 CEST 2011

On 31/03/11 22:52, Takashi Iwai wrote:
> At Thu, 31 Mar 2011 11:08:24 +1300,
> Eliot Blennerhassett wrote:
>> Currently  pcm_debug_name is defined locally in pcm_lib.c, this function would be useful
>> for debug output from drivers too?
>> Any objection to exporting this function?
> It's fine to me.  Or, can this be a static inline function?

Thanks Takashi

I'm happy either way. I'd leave it to you and Jaroslav to decide.

BTW Should it become "snd_pcm_debug_name" ?

One thing I'm not sure about is whether this is a debug_only function,
and if so, what to do about the necessary variable required to hold the
name for printing? I.e when debug is turned off, will get warnings about
unused variable "name"

static inline pcm_debug_name etc.
#define pcm_debug_name(s,n,l) while (0) do {}

Typical usage

static int somefunc(struct snd_pcm_substream * substream)
  char name[16];

  pcm_debug_name(substream, name, sizeof(name))
  snd_printd("%s foo %d\n", name, other);

Is there a nice way to avoid the #ifdef around name[]?


More information about the Alsa-devel mailing list