Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
[sfrench/cifs-2.6.git] / sound / isa / wavefront / wavefront.c
index ae2038e682f0412238c69ce8a323518561c3da2c..83c2fc4cfc64fb1bfc7bdde14e4f3623927ce452 100644 (file)
@@ -40,7 +40,9 @@ MODULE_SUPPORTED_DEVICE("{{Turtle Beach,Maui/Tropez/Tropez+}}");
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;         /* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;          /* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;     /* Enable this card */
+#ifdef CONFIG_PNP
 static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
+#endif
 static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
 static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */
 static long cs4232_mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
@@ -84,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)");
 
 #ifdef CONFIG_PNP
+static int isa_registered;
 static int pnp_registered;
 
 static struct pnp_card_device_id snd_wavefront_pnpids[] = {
@@ -704,14 +707,18 @@ static int __init alsa_card_wavefront_init(void)
        int err;
 
        err = isa_register_driver(&snd_wavefront_driver, SNDRV_CARDS);
-       if (err < 0)
-               return err;
 #ifdef CONFIG_PNP
+       if (!err)
+               isa_registered = 1;
+
        err = pnp_register_card_driver(&wavefront_pnpc_driver);
        if (!err)
                pnp_registered = 1;
+
+       if (isa_registered)
+               err = 0;
 #endif
-       return 0;
+       return err;
 }
 
 static void __exit alsa_card_wavefront_exit(void)
@@ -719,8 +726,9 @@ static void __exit alsa_card_wavefront_exit(void)
 #ifdef CONFIG_PNP
        if (pnp_registered)
                pnp_unregister_card_driver(&wavefront_pnpc_driver);
+       if (isa_registered)
 #endif
-       isa_unregister_driver(&snd_wavefront_driver);
+               isa_unregister_driver(&snd_wavefront_driver);
 }
 
 module_init(alsa_card_wavefront_init)