Commit 609d7694 authored by Rene Herman's avatar Rene Herman Committed by Jaroslav Kysela

[ALSA] Fix probe of non-PnP ISA devices

isa_register_driver() returns an error if no device is found
and it's no fatal error for the drivers with pnp support.
Signed-off-by: default avatarRene Herman <rene.herman@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 60af15f5
...@@ -109,6 +109,7 @@ module_param_array(wssdma, int, NULL, 0444); ...@@ -109,6 +109,7 @@ module_param_array(wssdma, int, NULL, 0444);
MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver.");
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered; static int pnp_registered;
#endif #endif
...@@ -686,14 +687,18 @@ static int __init alsa_card_cmi8330_init(void) ...@@ -686,14 +687,18 @@ static int __init alsa_card_cmi8330_init(void)
int err; int err;
err = isa_register_driver(&snd_cmi8330_driver, SNDRV_CARDS); err = isa_register_driver(&snd_cmi8330_driver, SNDRV_CARDS);
if (err < 0)
return err;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (!err)
isa_registered = 1;
err = pnp_register_card_driver(&cmi8330_pnpc_driver); err = pnp_register_card_driver(&cmi8330_pnpc_driver);
if (!err) if (!err)
pnp_registered = 1; pnp_registered = 1;
if (isa_registered)
err = 0;
#endif #endif
return 0; return err;
} }
static void __exit alsa_card_cmi8330_exit(void) static void __exit alsa_card_cmi8330_exit(void)
...@@ -701,6 +706,8 @@ static void __exit alsa_card_cmi8330_exit(void) ...@@ -701,6 +706,8 @@ static void __exit alsa_card_cmi8330_exit(void)
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (pnp_registered) if (pnp_registered)
pnp_unregister_card_driver(&cmi8330_pnpc_driver); pnp_unregister_card_driver(&cmi8330_pnpc_driver);
if (isa_registered)
#endif #endif
isa_unregister_driver(&snd_cmi8330_driver); isa_unregister_driver(&snd_cmi8330_driver);
} }
......
...@@ -127,6 +127,7 @@ module_param_array(dma2, int, NULL, 0444); ...@@ -127,6 +127,7 @@ module_param_array(dma2, int, NULL, 0444);
MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver.");
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isa_registered;
static int pnpc_registered; static int pnpc_registered;
#ifdef CS4232 #ifdef CS4232
static int pnp_registered; static int pnp_registered;
...@@ -770,9 +771,9 @@ static int __init alsa_card_cs423x_init(void) ...@@ -770,9 +771,9 @@ static int __init alsa_card_cs423x_init(void)
int err; int err;
err = isa_register_driver(&cs423x_isa_driver, SNDRV_CARDS); err = isa_register_driver(&cs423x_isa_driver, SNDRV_CARDS);
if (err < 0)
return err;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (!err)
isa_registered = 1;
#ifdef CS4232 #ifdef CS4232
err = pnp_register_driver(&cs4232_pnp_driver); err = pnp_register_driver(&cs4232_pnp_driver);
if (!err) if (!err)
...@@ -781,8 +782,14 @@ static int __init alsa_card_cs423x_init(void) ...@@ -781,8 +782,14 @@ static int __init alsa_card_cs423x_init(void)
err = pnp_register_card_driver(&cs423x_pnpc_driver); err = pnp_register_card_driver(&cs423x_pnpc_driver);
if (!err) if (!err)
pnpc_registered = 1; pnpc_registered = 1;
#endif /* CONFIG_PNP */ #ifdef CS4232
return 0; if (pnp_registered)
err = 0;
#endif
if (isa_registered)
err = 0;
#endif
return err;
} }
static void __exit alsa_card_cs423x_exit(void) static void __exit alsa_card_cs423x_exit(void)
...@@ -794,7 +801,8 @@ static void __exit alsa_card_cs423x_exit(void) ...@@ -794,7 +801,8 @@ static void __exit alsa_card_cs423x_exit(void)
if (pnp_registered) if (pnp_registered)
pnp_unregister_driver(&cs4232_pnp_driver); pnp_unregister_driver(&cs4232_pnp_driver);
#endif #endif
#endif /* CONFIG_PNP */ if (isa_registered)
#endif
isa_unregister_driver(&cs423x_isa_driver); isa_unregister_driver(&cs423x_isa_driver);
} }
......
...@@ -2036,7 +2036,9 @@ module_param_array(dma2, int, NULL, 0444); ...@@ -2036,7 +2036,9 @@ module_param_array(dma2, int, NULL, 0444);
MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver.");
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int pnp_registered, pnpc_registered; static int isa_registered;
static int pnp_registered;
static int pnpc_registered;
static struct pnp_device_id snd_audiodrive_pnpbiosids[] = { static struct pnp_device_id snd_audiodrive_pnpbiosids[] = {
{ .id = "ESS1869" }, { .id = "ESS1869" },
...@@ -2466,18 +2468,22 @@ static int __init alsa_card_es18xx_init(void) ...@@ -2466,18 +2468,22 @@ static int __init alsa_card_es18xx_init(void)
int err; int err;
err = isa_register_driver(&snd_es18xx_isa_driver, SNDRV_CARDS); err = isa_register_driver(&snd_es18xx_isa_driver, SNDRV_CARDS);
if (err < 0)
return err;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (!err)
isa_registered = 1;
err = pnp_register_driver(&es18xx_pnp_driver); err = pnp_register_driver(&es18xx_pnp_driver);
if (!err) if (!err)
pnp_registered = 1; pnp_registered = 1;
err = pnp_register_card_driver(&es18xx_pnpc_driver); err = pnp_register_card_driver(&es18xx_pnpc_driver);
if (!err) if (!err)
pnpc_registered = 1; pnpc_registered = 1;
if (isa_registered || pnp_registered)
err = 0;
#endif #endif
return 0; return err;
} }
static void __exit alsa_card_es18xx_exit(void) static void __exit alsa_card_es18xx_exit(void)
...@@ -2487,6 +2493,7 @@ static void __exit alsa_card_es18xx_exit(void) ...@@ -2487,6 +2493,7 @@ static void __exit alsa_card_es18xx_exit(void)
pnp_unregister_card_driver(&es18xx_pnpc_driver); pnp_unregister_card_driver(&es18xx_pnpc_driver);
if (pnp_registered) if (pnp_registered)
pnp_unregister_driver(&es18xx_pnp_driver); pnp_unregister_driver(&es18xx_pnp_driver);
if (isa_registered)
#endif #endif
isa_unregister_driver(&snd_es18xx_isa_driver); isa_unregister_driver(&snd_es18xx_isa_driver);
} }
......
...@@ -135,6 +135,7 @@ struct snd_interwave { ...@@ -135,6 +135,7 @@ struct snd_interwave {
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered; static int pnp_registered;
static struct pnp_card_device_id snd_interwave_pnpids[] = { static struct pnp_card_device_id snd_interwave_pnpids[] = {
...@@ -934,15 +935,18 @@ static int __init alsa_card_interwave_init(void) ...@@ -934,15 +935,18 @@ static int __init alsa_card_interwave_init(void)
int err; int err;
err = isa_register_driver(&snd_interwave_driver, SNDRV_CARDS); err = isa_register_driver(&snd_interwave_driver, SNDRV_CARDS);
if (err < 0)
return err;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
/* ISA PnP cards */ if (!err)
isa_registered = 1;
err = pnp_register_card_driver(&interwave_pnpc_driver); err = pnp_register_card_driver(&interwave_pnpc_driver);
if (!err) if (!err)
pnp_registered = 1; pnp_registered = 1;
if (isa_registered)
err = 0;
#endif #endif
return 0; return err;
} }
static void __exit alsa_card_interwave_exit(void) static void __exit alsa_card_interwave_exit(void)
...@@ -950,6 +954,7 @@ static void __exit alsa_card_interwave_exit(void) ...@@ -950,6 +954,7 @@ static void __exit alsa_card_interwave_exit(void)
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (pnp_registered) if (pnp_registered)
pnp_unregister_card_driver(&interwave_pnpc_driver); pnp_unregister_card_driver(&interwave_pnpc_driver);
if (isa_registered)
#endif #endif
isa_unregister_driver(&snd_interwave_driver); isa_unregister_driver(&snd_interwave_driver);
} }
......
...@@ -92,6 +92,7 @@ module_param_array(opl3sa3_ymode, int, NULL, 0444); ...@@ -92,6 +92,7 @@ module_param_array(opl3sa3_ymode, int, NULL, 0444);
MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi."); MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi.");
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered; static int pnp_registered;
static int pnpc_registered; static int pnpc_registered;
#endif #endif
...@@ -967,17 +968,22 @@ static int __init alsa_card_opl3sa2_init(void) ...@@ -967,17 +968,22 @@ static int __init alsa_card_opl3sa2_init(void)
int err; int err;
err = isa_register_driver(&snd_opl3sa2_isa_driver, SNDRV_CARDS); err = isa_register_driver(&snd_opl3sa2_isa_driver, SNDRV_CARDS);
if (err < 0)
return err;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (!err)
isa_registered = 1;
err = pnp_register_driver(&opl3sa2_pnp_driver); err = pnp_register_driver(&opl3sa2_pnp_driver);
if (!err) if (!err)
pnp_registered = 1; pnp_registered = 1;
err = pnp_register_card_driver(&opl3sa2_pnpc_driver); err = pnp_register_card_driver(&opl3sa2_pnpc_driver);
if (!err) if (!err)
pnpc_registered = 1; pnpc_registered = 1;
if (isa_registered || pnp_registered)
err = 0;
#endif #endif
return 0; return err;
} }
static void __exit alsa_card_opl3sa2_exit(void) static void __exit alsa_card_opl3sa2_exit(void)
...@@ -987,6 +993,7 @@ static void __exit alsa_card_opl3sa2_exit(void) ...@@ -987,6 +993,7 @@ static void __exit alsa_card_opl3sa2_exit(void)
pnp_unregister_card_driver(&opl3sa2_pnpc_driver); pnp_unregister_card_driver(&opl3sa2_pnpc_driver);
if (pnp_registered) if (pnp_registered)
pnp_unregister_driver(&opl3sa2_pnp_driver); pnp_unregister_driver(&opl3sa2_pnp_driver);
if (isa_registered)
#endif #endif
isa_unregister_driver(&snd_opl3sa2_isa_driver); isa_unregister_driver(&snd_opl3sa2_isa_driver);
} }
......
...@@ -129,6 +129,7 @@ MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth."); ...@@ -129,6 +129,7 @@ MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth.");
#endif #endif
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered; static int pnp_registered;
#endif #endif
...@@ -702,15 +703,18 @@ static int __init alsa_card_sb16_init(void) ...@@ -702,15 +703,18 @@ static int __init alsa_card_sb16_init(void)
int err; int err;
err = isa_register_driver(&snd_sb16_isa_driver, SNDRV_CARDS); err = isa_register_driver(&snd_sb16_isa_driver, SNDRV_CARDS);
if (err < 0)
return err;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
/* PnP cards at last */ if (!err)
isa_registered = 1;
err = pnp_register_card_driver(&sb16_pnpc_driver); err = pnp_register_card_driver(&sb16_pnpc_driver);
if (!err) if (!err)
pnp_registered = 1; pnp_registered = 1;
if (isa_registered)
err = 0;
#endif #endif
return 0; return err;
} }
static void __exit alsa_card_sb16_exit(void) static void __exit alsa_card_sb16_exit(void)
...@@ -718,6 +722,7 @@ static void __exit alsa_card_sb16_exit(void) ...@@ -718,6 +722,7 @@ static void __exit alsa_card_sb16_exit(void)
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (pnp_registered) if (pnp_registered)
pnp_unregister_card_driver(&sb16_pnpc_driver); pnp_unregister_card_driver(&sb16_pnpc_driver);
if (isa_registered)
#endif #endif
isa_unregister_driver(&snd_sb16_isa_driver); isa_unregister_driver(&snd_sb16_isa_driver);
} }
......
...@@ -69,7 +69,9 @@ module_param_array(dma, int, NULL, 0444); ...@@ -69,7 +69,9 @@ module_param_array(dma, int, NULL, 0444);
MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); MODULE_PARM_DESC(dma, "DMA # for SoundScape driver.");
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered; static int pnp_registered;
static struct pnp_card_device_id sscape_pnpids[] = { static struct pnp_card_device_id sscape_pnpids[] = {
{ .id = "ENS3081", .devs = { { "ENS0000" } } }, { .id = "ENS3081", .devs = { { "ENS0000" } } },
{ .id = "" } /* end */ { .id = "" } /* end */
...@@ -1405,22 +1407,21 @@ static struct pnp_card_driver sscape_pnpc_driver = { ...@@ -1405,22 +1407,21 @@ static struct pnp_card_driver sscape_pnpc_driver = {
static int __init sscape_init(void) static int __init sscape_init(void)
{ {
int ret; int err;
/* err = isa_register_driver(&snd_sscape_driver, SNDRV_CARDS);
* First check whether we were passed any parameters.
* These MUST take precedence over ANY automatic way
* of allocating cards, because the operator is
* S-P-E-L-L-I-N-G it out for us...
*/
ret = isa_register_driver(&snd_sscape_driver, SNDRV_CARDS);
if (ret < 0)
return ret;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (pnp_register_card_driver(&sscape_pnpc_driver) == 0) if (!err)
isa_registered = 1;
err = pnp_register_card_driver(&sscape_pnpc_driver);
if (!err)
pnp_registered = 1; pnp_registered = 1;
if (isa_registered)
err = 0;
#endif #endif
return 0; return err;
} }
static void __exit sscape_exit(void) static void __exit sscape_exit(void)
...@@ -1428,6 +1429,7 @@ static void __exit sscape_exit(void) ...@@ -1428,6 +1429,7 @@ static void __exit sscape_exit(void)
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (pnp_registered) if (pnp_registered)
pnp_unregister_card_driver(&sscape_pnpc_driver); pnp_unregister_card_driver(&sscape_pnpc_driver);
if (isa_registered)
#endif #endif
isa_unregister_driver(&snd_sscape_driver); isa_unregister_driver(&snd_sscape_driver);
} }
......
...@@ -86,6 +86,7 @@ module_param_array(use_cs4232_midi, bool, NULL, 0444); ...@@ -86,6 +86,7 @@ module_param_array(use_cs4232_midi, bool, NULL, 0444);
MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isa_registered;
static int pnp_registered; static int pnp_registered;
static struct pnp_card_device_id snd_wavefront_pnpids[] = { static struct pnp_card_device_id snd_wavefront_pnpids[] = {
...@@ -706,14 +707,18 @@ static int __init alsa_card_wavefront_init(void) ...@@ -706,14 +707,18 @@ static int __init alsa_card_wavefront_init(void)
int err; int err;
err = isa_register_driver(&snd_wavefront_driver, SNDRV_CARDS); err = isa_register_driver(&snd_wavefront_driver, SNDRV_CARDS);
if (err < 0)
return err;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (!err)
isa_registered = 1;
err = pnp_register_card_driver(&wavefront_pnpc_driver); err = pnp_register_card_driver(&wavefront_pnpc_driver);
if (!err) if (!err)
pnp_registered = 1; pnp_registered = 1;
if (isa_registered)
err = 0;
#endif #endif
return 0; return err;
} }
static void __exit alsa_card_wavefront_exit(void) static void __exit alsa_card_wavefront_exit(void)
...@@ -721,6 +726,7 @@ static void __exit alsa_card_wavefront_exit(void) ...@@ -721,6 +726,7 @@ static void __exit alsa_card_wavefront_exit(void)
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (pnp_registered) if (pnp_registered)
pnp_unregister_card_driver(&wavefront_pnpc_driver); pnp_unregister_card_driver(&wavefront_pnpc_driver);
if (isa_registered)
#endif #endif
isa_unregister_driver(&snd_wavefront_driver); isa_unregister_driver(&snd_wavefront_driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment