[ALSA] Fix __devinit and __devexit issues with sound drivers
[sfrench/cifs-2.6.git] / sound / isa / sb / sb8.c
index 3efa23d303c3be07d96f16d60faefa79eba8c0ea..be1e83e6dea32b7132e252416c83fa2dae7872b1 100644 (file)
@@ -63,7 +63,7 @@ struct snd_sb8 {
        struct snd_sb *chip;
 };
 
-static irqreturn_t snd_sb8_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t snd_sb8_interrupt(int irq, void *dev_id)
 {
        struct snd_sb *chip = dev_id;
 
@@ -83,7 +83,7 @@ static void snd_sb8_free(struct snd_card *card)
        release_and_free_resource(acard->fm_res);
 }
 
-static int __init snd_sb8_probe(struct platform_device *pdev)
+static int __devinit snd_sb8_probe(struct platform_device *pdev)
 {
        int dev = pdev->id;
        struct snd_sb *chip;
@@ -193,7 +193,7 @@ static int __init snd_sb8_probe(struct platform_device *pdev)
        return err;
 }
 
-static int snd_sb8_remove(struct platform_device *pdev)
+static int __devexit snd_sb8_remove(struct platform_device *pdev)
 {
        snd_card_free(platform_get_drvdata(pdev));
        platform_set_drvdata(pdev, NULL);
@@ -230,7 +230,7 @@ static int snd_sb8_resume(struct platform_device *dev)
 
 static struct platform_driver snd_sb8_driver = {
        .probe          = snd_sb8_probe,
-       .remove         = snd_sb8_remove,
+       .remove         = __devexit_p(snd_sb8_remove),
 #ifdef CONFIG_PM
        .suspend        = snd_sb8_suspend,
        .resume         = snd_sb8_resume,
@@ -264,9 +264,11 @@ static int __init alsa_card_sb8_init(void)
                        continue;
                device = platform_device_register_simple(SND_SB8_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;
                }
                devices[i] = device;
                cards++;
@@ -275,14 +277,10 @@ static int __init alsa_card_sb8_init(void)
 #ifdef MODULE
                snd_printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n");
 #endif
-               err = -ENODEV;
-               goto errout;
+               snd_sb8_unregister_all();
+               return -ENODEV;
        }
        return 0;
-
- errout:
-       snd_sb8_unregister_all();
-       return err;
 }
 
 static void __exit alsa_card_sb8_exit(void)