alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Eliot Blennerhassett <linux@audioscience.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: export pcm_debug_name?
Date: Fri, 01 Apr 2011 12:41:15 +1300	[thread overview]
Message-ID: <4D95111B.2090209@audioscience.com> (raw)
In-Reply-To: <s5htyejzkfz.wl%tiwai@suse.de>

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"

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

Typical usage

static int somefunc(struct snd_pcm_substream * substream)
{
#ifdef CONFIG_SND_DEBUG
  char name[16];
#endif

  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[]?

--
Eliot

  reply	other threads:[~2011-03-31 23:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-30 22:08 export pcm_debug_name? Eliot Blennerhassett
2011-03-31  9:52 ` Takashi Iwai
2011-03-31 23:41   ` Eliot Blennerhassett [this message]
2011-04-01 13:07     ` Takashi Iwai

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=4D95111B.2090209@audioscience.com \
    --to=linux@audioscience.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).