- 2.6.17 port work build breaks, but the patch set is relativly stable
[linux-flexiantxendom0-3.2.10.git] / sound / isa / gus / interwave.c
index 2cacd0f..4298d33 100644 (file)
@@ -791,7 +791,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
        return 0;
 }
 
-static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr)
+static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr)
 {
        struct snd_card *card;
        int err;
@@ -809,7 +809,7 @@ static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *d
        return 0;
 }
 
-static int __init snd_interwave_nonpnp_probe(struct platform_device *pdev)
+static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev)
 {
        int dev = pdev->id;
        int err;
@@ -867,6 +867,7 @@ static struct platform_driver snd_interwave_driver = {
 };
 
 #ifdef CONFIG_PNP
+static unsigned int __devinitdata interwave_pnp_devices;
 
 static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
                                              const struct pnp_card_device_id *pid)
@@ -897,6 +898,7 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
        }
        pnp_set_card_drvdata(pcard, card);
        dev++;
+       interwave_pnp_devices++;
        return 0;
 }
 
@@ -945,33 +947,31 @@ static int __init alsa_card_interwave_init(void)
 #endif
                device = platform_device_register_simple(INTERWAVE_DRIVER,
                                                         i, NULL, 0);
-               if (IS_ERR(device)) {
-                       err = PTR_ERR(device);
-                       goto errout;
+               if (IS_ERR(device))
+                       continue;
+               if (!platform_get_drvdata(device)) {
+                       platform_device_unregister(device);
+                       continue;
                }
                platform_devices[i] = device;
                cards++;
        }
 
        /* ISA PnP cards */
-       i = pnp_register_card_driver(&interwave_pnpc_driver);
-       if (i >= 0) {
+       err = pnp_register_card_driver(&interwave_pnpc_driver);
+       if (!err) {
                pnp_registered = 1;
-               cards += i;
+               cards += interwave_pnp_devices;;
        }
 
        if (!cards) {
 #ifdef MODULE
                printk(KERN_ERR "InterWave soundcard not found or device busy\n");
 #endif
-               err = -ENODEV;
-               goto errout;
+               snd_interwave_unregister_all();
+               return -ENODEV;
        }
        return 0;
-
- errout:
-       snd_interwave_unregister_all();
-       return err;
 }
 
 static void __exit alsa_card_interwave_exit(void)