Skip to contentSkip to conversation

ISA drivers bailing on first !enable[i]

ALSA Rene Herman 2 participants 4 messages Mar 24, 2006 – Mar 25, 2006 Sound

lore
Share & tools
lore
#0 lore raw

Hi Takashi.

After the change to the platform_driver stuff in 2.6.16, all ISA card module_inits loop over the cards using:

	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {

This means that the driver bails completely on the first !enable[i]. This did not use to be the case and does not seem right. I believe it should rather be:

	for (i = 0; i < SNDRV_CARDS; i++) {
		if (!enable[i])
			continue;

This would restore the previous behaviour for the enable parameter; ie, only ignore the one.

Assuming this was indeed the idea, I've attached a patch against 2.6.16. If it's correct, but you need it against ALSA CVS instead, please say so

    sound/isa/ad1848/ad1848.c       |    4 +++-
    sound/isa/cmi8330.c             |    4 ++--
    sound/isa/cs423x/cs4231.c       |    4 +++-
    sound/isa/cs423x/cs4236.c       |    4 ++--
    sound/isa/es1688/es1688.c       |    4 +++-
    sound/isa/gus/gusclassic.c      |    4 +++-
    sound/isa/gus/gusextreme.c      |    4 +++-
    sound/isa/gus/gusmax.c          |    4 +++-
    sound/isa/gus/interwave.c       |    4 +++-
    sound/isa/opl3sa2.c             |    4 +++-
    sound/isa/sb/sb16.c             |    4 ++--
    sound/isa/sb/sb8.c              |    4 +++-
    sound/isa/sgalaxy.c             |    4 +++-
    sound/isa/wavefront/wavefront.c |    4 +++-
    14 files changed, 39 insertions(+), 17 deletions(-)

Rene.

sound/isa/ad1848/ad1848.c +3 -1
Index: local/sound/isa/ad1848/ad1848.c
===================================================================
@@ -187,8 +187,10 @@ static int __init alsa_card_ad1848_init(
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(SND_AD1848_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/cmi8330.c +2 -2
Index: local/sound/isa/cmi8330.c
===================================================================
@@ -690,9 +690,9 @@ static int __init alsa_card_cmi8330_init
 	if ((err = platform_driver_register(&snd_cmi8330_driver)) < 0)
 		return err;
 
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
-		if (is_isapnp_selected(i))
+		if (!enable[i] || is_isapnp_selected(i))
 			continue;
 		device = platform_device_register_simple(CMI8330_DRIVER,
 							 i, NULL, 0);
sound/isa/cs423x/cs4231.c +3 -1
Index: local/sound/isa/cs423x/cs4231.c
===================================================================
@@ -203,8 +203,10 @@ static int __init alsa_card_cs4231_init(
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(SND_CS4231_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/cs423x/cs4236.c +2 -2
Index: local/sound/isa/cs423x/cs4236.c
===================================================================
@@ -771,9 +771,9 @@ static int __init alsa_card_cs423x_init(
 	if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0)
 		return err;
 
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
-		if (is_isapnp_selected(i))
+		if (!enable[i] || is_isapnp_selected(i))
 			continue;
 		device = platform_device_register_simple(CS423X_DRIVER,
 							 i, NULL, 0);
sound/isa/es1688/es1688.c +3 -1
Index: local/sound/isa/es1688/es1688.c
===================================================================
@@ -207,8 +207,10 @@ static int __init alsa_card_es1688_init(
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(ES1688_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/gus/gusclassic.c +3 -1
Index: local/sound/isa/gus/gusclassic.c
===================================================================
@@ -247,8 +247,10 @@ static int __init alsa_card_gusclassic_i
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(GUSCLASSIC_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/gus/gusextreme.c +3 -1
Index: local/sound/isa/gus/gusextreme.c
===================================================================
@@ -357,8 +357,10 @@ static int __init alsa_card_gusextreme_i
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(GUSEXTREME_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/gus/gusmax.c +3 -1
Index: local/sound/isa/gus/gusmax.c
===================================================================
@@ -384,8 +384,10 @@ static int __init alsa_card_gusmax_init(
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(GUSMAX_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/gus/interwave.c +3 -1
Index: local/sound/isa/gus/interwave.c
===================================================================
@@ -935,8 +935,10 @@ static int __init alsa_card_interwave_in
 	if ((err = platform_driver_register(&snd_interwave_driver)) < 0)
 		return err;
 
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 #ifdef CONFIG_PNP
 		if (isapnp[i])
 			continue;
sound/isa/opl3sa2.c +3 -1
Index: local/sound/isa/opl3sa2.c
===================================================================
@@ -949,8 +949,10 @@ static int __init alsa_card_opl3sa2_init
 	if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0)
 		return err;
 
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 #ifdef CONFIG_PNP
 		if (isapnp[i])
 			continue;
sound/isa/sb/sb16.c +2 -2
Index: local/sound/isa/sb/sb16.c
===================================================================
@@ -712,9 +712,9 @@ static int __init alsa_card_sb16_init(vo
 	if ((err = platform_driver_register(&snd_sb16_nonpnp_driver)) < 0)
 		return err;
 
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
-		if (is_isapnp_selected(i))
+		if (!enable[i] || is_isapnp_selected(i))
 			continue;
 		device = platform_device_register_simple(SND_SB16_DRIVER,
 							 i, NULL, 0);
sound/isa/sb/sb8.c +3 -1
Index: local/sound/isa/sb/sb8.c
===================================================================
@@ -258,8 +258,10 @@ static int __init alsa_card_sb8_init(voi
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(SND_SB8_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/sgalaxy.c +3 -1
Index: local/sound/isa/sgalaxy.c
===================================================================
@@ -360,8 +360,10 @@ static int __init alsa_card_sgalaxy_init
 		return err;
 
 	cards = 0;
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 		device = platform_device_register_simple(SND_SGALAXY_DRIVER,
 							 i, NULL, 0);
 		if (IS_ERR(device)) {
sound/isa/wavefront/wavefront.c +3 -1
Index: local/sound/isa/wavefront/wavefront.c
===================================================================
@@ -710,8 +710,10 @@ static int __init alsa_card_wavefront_in
 	if ((err = platform_driver_register(&snd_wavefront_driver)) < 0)
 		return err;
 
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
+		if (!enable[i])
+			continue;
 #ifdef CONFIG_PNP
 		if (isapnp[i])
 			continue;
#1 lore raw

At Fri, 24 Mar 2006 06:32:50 +0100,

Quoted 16 lines · Rene Herman

Hi Takashi.

After the change to the platform_driver stuff in 2.6.16, all ISA card module_inits loop over the cards using:

	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {

This means that the driver bails completely on the first !enable[i]. This did not use to be the case and does not seem right. I believe it should rather be:

	for (i = 0; i < SNDRV_CARDS; i++) {
		if (!enable[i])
			continue;
Quoted 5 lines

This would restore the previous behaviour for the enable parameter; ie, only ignore the one.

Assuming this was indeed the idea, I've attached a patch against 2.6.16. If it's correct, but you need it against ALSA CVS instead, please say so

Yes, these are correct fixes. Most of them should have been already in the latest ALSA tree, i.e. also in Linus git tree now.

Could you check what's still missing? I might missed some drivers.

Thanks.

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#2 lore raw
In reply to Rene Herman

At Fri, 24 Mar 2006 06:32:50 +0100,

Quoted 16 lines · Rene Herman

Hi Takashi.

After the change to the platform_driver stuff in 2.6.16, all ISA card module_inits loop over the cards using:

	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {

This means that the driver bails completely on the first !enable[i]. This did not use to be the case and does not seem right. I believe it should rather be:

	for (i = 0; i < SNDRV_CARDS; i++) {
		if (!enable[i])
			continue;
Quoted 5 lines

This would restore the previous behaviour for the enable parameter; ie, only ignore the one.

Assuming this was indeed the idea, I've attached a patch against 2.6.16. If it's correct, but you need it against ALSA CVS instead, please say so

Yes, these are correct fixes. Most of them should have been already in the latest ALSA tree, i.e. also in Linus git tree now.

Could you check what's still missing? I might missed some drivers.

Thanks.

Takashi

#3 lore raw
Quoted 5 lines · Takashi Iwai
Quoted 2 lines

Assuming this was indeed the idea, I've attached a patch against 2.6.16. If it's correct, but you need it against ALSA CVS instead, please say so

Yes, these are correct fixes. Most of them should have been already in the latest ALSA tree, i.e. also in Linus git tree now.

I had a feeling I should've checked that when I was composing the message...

Quoted 1 line

Could you check what's still missing? I might missed some drivers.

CMI8330 was missing, see attached (generated against -git9). Yes, the original patch is still useful for -stable; will submit.

Rene.

sound/isa/cmi8330.c +2 -2
Index: linux-2.6.16-git9/sound/isa/cmi8330.c
===================================================================
@@ -690,9 +690,9 @@ static int __init alsa_card_cmi8330_init
 	if ((err = platform_driver_register(&snd_cmi8330_driver)) < 0)
 		return err;
 
-	for (i = 0; i < SNDRV_CARDS && enable[i]; i++) {
+	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
-		if (is_isapnp_selected(i))
+		if (! enable[i] || is_isapnp_selected(i))
 			continue;
 		device = platform_device_register_simple(CMI8330_DRIVER,
 							 i, NULL, 0);