[alsa-devel] Improving or replacing snd_printk()

Joe Perches joe at perches.com
Thu May 30 22:30:14 CEST 2013


On Thu, 2013-05-30 at 15:43 -0400, Alan Stern wrote:
> On Thu, 30 May 2013, Jaroslav Kysela wrote:
> 
> > Date 30.5.2013 20:14, Alan Stern wrote:
> > > On Wed, 29 May 2013, Joe Perches wrote:
> > > 
> > >> On Wed, 2013-05-29 at 15:27 -0400, Alan Stern wrote:
> > >>> Has there been any thought of improving snd_printk(), or even better,
> > >>> changing the call sites to use the dev_*() routines instead?
> > >>
> > >> Perhaps better would be to add and use some combination of
> > >> type specific logging message functions/macros like:
> > >>
> > >> void snd_<level>(const struct snd_device *dev, const char *fmt, ...)
> > >> void snd_card_<level>(const struct snd_card *card, const char *fmt, ...)
> > >> void snd_ac97_<level>(const struct snd_ac97 *ac97, const char *fmt, ...)
> > >>
> > >> allowing NULL as the type pointer when necessary/appropriate.
> > > 
> > > Almost anything would be better than the current situation.  The only 
> > > enhancement provided by CONFIG_SND_VERBOSE_PRINTK is to print the 
> > > filename and line number, which is relatively unhelpful (unless there 
> > > are multiple copies of the same message in several places).
> > 
> > I don't think that it's useless to see the origin of the source message
> > from the first glance. It may be improved, of course, but adding more
> > and more functions with minor benefits is another step to another hell.
> 
> Maybe so.  However, including the device and driver names in the log 
> messages is a major benefit, not a minor one.
> 
> I'd be happy to have just a snd_<level> family of functions, with 
> snd_printk and snd_printd deprecated.  Does anybody object?

Not me.

I think the benefit of the consolidated family of
macros/functions is avoiding the visual clutter of:

	dev_<level>(&pointer->deref->deref->dev,
		    fmt, ...)

and potential uses of

	if (pointer->deref && pointer->deref->deref)
		dev_<level>(etc...)
	else
		pr_<level>("unregistered dev: " fmt, ...)




More information about the Alsa-devel mailing list