[alsa-devel] Improving or replacing snd_printk()

Takashi Iwai tiwai at suse.de
Fri May 31 16:34:08 CEST 2013

At Fri, 31 May 2013 10:24:51 -0400 (EDT),
Alan Stern wrote:
> On Fri, 31 May 2013, Takashi Iwai wrote:
> > > I don't see the complexity/hell in adding functions
> > > for specific types of struct * to reduce the complexity
> > > of the code though.  Centralizing those indirections
> > > into functions also generally reduces overall code size.
> > 
> > I don't mind to add the struct pointer to new snd_*() -- if we really
> > introduce them.  The bigger question is whether we really need to
> > introduce such, and if yes, what variants.  And for that, I don't
> > think we need to add many functions.  Maybe snd_card_<level>() would
> > be good.  But others don't seem to make sense to me (remember that I
> > suggest dropping CONFIG_SND_VERBOSE_PRINTK).
> struct snd_card contains pointers to two different devices: dev and 
> card_dev.  Some contexts might want to use one of them for log messages 
> while other contexts might want to use the other.

Yes, there are some corner cases, indeed.

Also, another expected problem is that neither card->card_dev nor
card->dev are set when snd_card_err() is called.  Many drivers set the
device pointers at the late stage just before the device
registration.  So, systematic replacements won't work as expected in
many cases.  (The same is applied for replacement with dev_*(), too.)


More information about the Alsa-devel mailing list