
At Tue, 7 Oct 2008 16:34:29 +0800, Wu Fengguang wrote:
On Tue, Oct 07, 2008 at 10:10:43AM +0200, Takashi Iwai wrote:
At Tue, 7 Oct 2008 14:56:06 +0800, Wu Fengguang wrote:
Enlarge snd_card.components[80] to 128 bytes, with space for 4 codecs. The previous size 80 cannot support HP 2230s which has 3 codecs.
Signed-off-by: Wu Fengguang wfg@linux.intel.com
Thanks for the patch. Unfortunately, this can't be applied as is. struct snd_ctl_card_info is exported and used as the ioctl parameter, thus you cannot change the size.
One possible fix is to merge reserved[48] into components[80] so that the struct size is kept as is. But still we have to be very careful to such a change, and need to investigate all possible places to refer it.
OK.
FYI, this is the debug patch and kernel message(lookout the first line) on HP 2230s:
diff --git a/sound/core/init.c b/sound/core/init.c index 8af467d..704d7e8 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -706,6 +706,8 @@ int snd_component_add(struct snd_card *card, const char *component) return 1; } if (strlen(card->components) + 1 + len + 1 > sizeof(card->components)) {
snd_printk(KERN_ERR "components = %s + %s\n",
snd_BUG(); return -ENOMEM; }card->components, component);
[ 12.590150] ALSA sound/core/init.c:710: components = HDA:11d4194a,103c3037,00100400 HDA:11c11040,103c1378,00100200 + HDA:80862802,80860101,00100000 [ 12.590163] ------------[ cut here ]------------ [ 12.590166] WARNING: at sound/core/init.c:711 snd_component_add+0xfa/0x110 [snd]() [ 12.590168] BUG? [ 12.590170] Modules linked in: snd_hda_intel(+) snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss iwlagn snd_pcm snd_timer iwlcore snd_page_alloc snd_hwdep rfkill snd pcspkr led_class sky2 wmi soundcore uhci_hcd ohci_hcd ehci_hcd [ 12.590197] Pid: 2410, comm: modprobe Not tainted 2.6.27-rc7 #4
(snip)
Argh, that's bad. Then I agree with increasing the components as a simple workaround.
How about the patch below? The control protocol number is increased for this change as well.
thanks,
Takashi
diff --git a/include/sound/asound.h b/include/sound/asound.h index 3eaf155..fbfe992 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -696,7 +696,7 @@ struct snd_timer_tread { * * ****************************************************************************/
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
struct snd_ctl_card_info { int card; /* card number */ @@ -707,8 +707,7 @@ struct snd_ctl_card_info { unsigned char longname[80]; /* name + info text about soundcard */ unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ unsigned char mixername[80]; /* visual mixer identification */ - unsigned char components[80]; /* card components / fine identification, delimited with one space (AC97 etc..) */ - unsigned char reserved[48]; /* reserved for future */ + unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ };
typedef int __bitwise snd_ctl_elem_type_t; diff --git a/include/sound/core.h b/include/sound/core.h index 558b962..221554e 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -114,7 +114,7 @@ struct snd_card { char shortname[32]; /* short name of this soundcard */ char longname[80]; /* name of this soundcard */ char mixername[80]; /* mixer name */ - char components[80]; /* card components delimited with + char components[128]; /* card components delimited with space */ struct module *module; /* top-level module */