[alsa-devel] [PATCH] alsa-lib: if card driver name is empty string, use card name instead

Takashi Iwai tiwai at suse.de
Tue Sep 20 12:33:41 CEST 2011


At Tue, 20 Sep 2011 11:14:34 +0100,
Mark Brown wrote:
> 
> On Tue, Sep 20, 2011 at 08:24:52AM +0200, Takashi Iwai wrote:
> > Scott Jiang wrote:
> 
> > > Some drivers don't have a card driver name, but they have a nice card name containing enough info.
> > > So we can use card name to search card config if we found driver name is not valid.
> 
> > It's rather a bug of driver, no?
> > I don't think we need to work around it.
> 
> This was introduced by your commit 873bd4 (ASoC: don't set invalid name
> string to snd_card->driver field) which means we no longer provide a
> driver name for any ASoC cards as they're all relying on using the card
> name as the driver name.  We should be doing something like replacing '
> ' by '_' in the driver name we generate rather than just not generating
> a name.
> 
> I have to confess I didn't review the patch at the time as it was
> applied too quickly after it was mailed out for me to have a chance to
> see it.  Sorry about that.

Well, you can follow a short history from the commit: the commit above
was really a fix to get back to the old good behavior.  Until 3.0,
ASoC had no way to set card->driver field.  The method to set
card->driver was firstly introduced by Liam's patch in 3.0-rc2,
22de71ba03311cdc1063757c50a1488cb90a1fca
	ASoC: core - allow ASoC more flexible machine name

Then it turned out this gives a string "(null)", so some workaround
was added, 2b39535b9e54888649923beaab443af212b6c0fd
    ASoC: core: Don't set "(null)" as a driver name

But, this was no good move, too.  The card->driver field is to be a
concise string without special letters while card->name contains more
flexible string.  So, I changed the way back to the state before 3.0
there, the commit 873bd4.

All this happened in 3.0 development cycle, so it's no longer history
than NULL driver name :)

Of course, it'd be nice to implement a logic in ASoC core to
automatically generate some valid driver-name string.  But, the driver
name string is at most 15 letters, and card->name is an arbitrary
string, so you'd need to do it a bit carefully.


thanks,

Takashi


More information about the Alsa-devel mailing list