config SND_AD1848_LIB
         tristate
         select SND_PCM
-       select SND_GENERIC_PM
+       select SND_GENERIC_DRIVER
 
 config SND_CS4231_LIB
         tristate
         select SND_PCM
-       select SND_GENERIC_PM
+       select SND_GENERIC_DRIVER
 
 config SND_AD1816A
        tristate "Analog Devices SoundPort AD1816A"
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for ESS AudioDrive ES688 or
          ES1688 chips.
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
-       select SND_GENERIC_PM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for ESS AudioDrive ES18xx chips.
 
        select SND_RAWMIDI
        select SND_PCM
        select SND_GUS_SYNTH
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Gravis UltraSound Classic
          soundcards.
        select SND_MPU401_UART
        select SND_PCM
        select SND_GUS_SYNTH
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Gravis UltraSound Extreme
          soundcards.
        select SND_RAWMIDI
        select SND_CS4231_LIB
        select SND_GUS_SYNTH
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Gravis UltraSound MAX
          soundcards.
        select SND_RAWMIDI
        select SND_CS4231_LIB
        select SND_GUS_SYNTH
-       select ISAPNP
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for AMD InterWave based
          soundcards (Gravis UltraSound Plug & Play, STB SoundRage32,
        select SND_RAWMIDI
        select SND_CS4231_LIB
        select SND_GUS_SYNTH
-       select ISAPNP
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for AMD InterWave based
          soundcards with a TEA6330T bass and treble regulator
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for soundcards based on Opti
          82C93x chips.
        select SND_OPL3_LIB
        select SND_RAWMIDI
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Creative Sound Blaster 1.0/
          2.0/Pro (8-bit) or 100% compatible soundcards.
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Sound Blaster 16 soundcards
          (including the Plug and Play version).
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Sound Blaster AWE soundcards
          (including the Plug and Play version).
 
                                     irq[dev],
                                     dma1[dev],
                                     thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT,
-                                    &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_ad1848_mixer(chip)) < 0)
+               goto _err;
 
-       if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_ad1848_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
        strcpy(card->driver, "AD1848");
        strcpy(card->shortname, pcm->name);
 
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
                pcm->name, chip->port, irq[dev], dma1[dev]);
 
-       if (thinkpad[dev]) {
+       if (thinkpad[dev])
                strcat(card->longname, " [Thinkpad]");
-       }
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_ad1848_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_ad1848_init(void)
 
 /*
  */
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
+#define PFX    "cmi8330: "
+
 static int __devinit snd_cmi8330_probe(int dev,
                                       struct pnp_card_link *pcard,
                                       const struct pnp_card_device_id *pid)
 {
        snd_card_t *card;
        struct snd_cmi8330 *acard;
-       unsigned long flags;
        int i, err;
 
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
+       if (! is_isapnp_selected(dev)) {
                if (wssport[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify wssport\n");
+                       snd_printk(KERN_ERR PFX "specify wssport\n");
                        return -EINVAL;
                }
                if (sbport[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify sbport\n");
+                       snd_printk(KERN_ERR PFX "specify sbport\n");
                        return -EINVAL;
                }
-#ifdef CONFIG_PNP
        }
-#endif
+
        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
                            sizeof(struct snd_cmi8330));
        if (card == NULL) {
-               snd_printk("could not get a new card\n");
+               snd_printk(KERN_ERR PFX "could not get a new card\n");
                return -ENOMEM;
        }
        acard = (struct snd_cmi8330 *)card->private_data;
 #ifdef CONFIG_PNP
        if (isapnp[dev]) {
                if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) {
-                       snd_printk("PnP detection failed\n");
-                       snd_card_free(card);
-                       return err;
+                       snd_printk(KERN_ERR PFX "PnP detection failed\n");
+                       goto _err;
                }
                snd_card_set_dev(card, &pcard->card->dev);
        }
                                     wssdma[dev],
                                     AD1848_HW_DETECT,
                                     &acard->wss)) < 0) {
-               snd_printk("(AD1848) device busy??\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
+               goto _err;
        }
        if (acard->wss->hardware != AD1848_HW_CMI8330) {
-               snd_printk("(AD1848) not found during probe\n");
-               snd_card_free(card);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
+               err = -ENODEV;
+               goto _err;
        }
 
        if ((err = snd_sbdsp_create(card, sbport[dev],
                                    sbdma8[dev],
                                    sbdma16[dev],
                                    SB_HW_AUTO, &acard->sb)) < 0) {
-               snd_printk("(SB16) device busy??\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "(SB16) device busy??\n");
+               goto _err;
        }
        if (acard->sb->hardware != SB_HW_16) {
-               snd_printk("(SB16) not found during probe\n");
-               snd_card_free(card);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "(SB16) not found during probe\n");
+               goto _err;
        }
 
-       spin_lock_irqsave(&acard->wss->reg_lock, flags);
        snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */
        for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++)
                snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]);
-       spin_unlock_irqrestore(&acard->wss->reg_lock, flags);
 
        if ((err = snd_cmi8330_mixer(card, acard)) < 0) {
-               snd_printk("failed to create mixers\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "failed to create mixers\n");
+               goto _err;
        }
 
        if ((err = snd_cmi8330_pcm(card, acard)) < 0) {
-               snd_printk("failed to create pcms\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "failed to create pcms\n");
+               goto _err;
        }
 
        strcpy(card->driver, "CMI8330/C3D");
                wssirq[dev],
                wssdma[dev]);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
 
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_cmi8330_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 #ifdef CONFIG_PNP
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev])
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (snd_cmi8330_probe(dev, NULL, NULL) >= 0)
                        cards++;
        }
 
        int err;
 
        if (port[dev] == SNDRV_AUTO_PORT) {
-               snd_printk("specify port\n");
+               snd_printk(KERN_ERR "specify port\n");
                return -EINVAL;
        }
        if (irq[dev] == SNDRV_AUTO_IRQ) {
-               snd_printk("specify irq\n");
+               snd_printk(KERN_ERR "specify irq\n");
                return -EINVAL;
        }
        if (dma1[dev] == SNDRV_AUTO_DMA) {
-               snd_printk("specify dma1\n");
+               snd_printk(KERN_ERR "specify dma1\n");
                return -EINVAL;
        }
        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
                                     dma1[dev],
                                     dma2[dev],
                                     CS4231_HW_DETECT,
-                                    0, &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    0, &chip)) < 0)
+               goto _err;
 
-       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
 
        strcpy(card->driver, "CS4231");
        strcpy(card->shortname, pcm->name);
        if (dma2[dev] >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
 
-       if ((err = snd_cs4231_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_cs4231_mixer(chip)) < 0)
+               goto _err;
+       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
+               goto _err;
 
        if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
                if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
                                        mpu_irq[dev],
                                        mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0,
                                        NULL) < 0)
-                       printk(KERN_ERR "cs4231: MPU401 not detected\n");
-       }
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
+                       printk(KERN_WARNING "cs4231: MPU401 not detected\n");
        }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
        snd_cs4231_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_cs4231_init(void)
 
        }
 }
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
                                           const struct pnp_card_device_id *pid)
 {
        opl3_t *opl3;
        int err;
 
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
+       if (! is_isapnp_selected(dev)) {
                if (port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify port\n");
+                       snd_printk(KERN_ERR "specify port\n");
                        return -EINVAL;
                }
                if (cport[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify cport\n");
+                       snd_printk(KERN_ERR "specify cport\n");
                        return -EINVAL;
                }
-#ifdef CONFIG_PNP
        }
-#endif
        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
                            sizeof(struct snd_card_cs4236));
        if (card == NULL)
        if (isapnp[dev]) {
                if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) {
                        printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n");
-                       snd_card_free(card);
-                       return -ENXIO;
+                       goto _err;
                }
                snd_card_set_dev(card, &pcard->card->dev);
        }
        if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT)
                if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) {
                        printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]);
-                       snd_card_free(card);
-                       return -ENOMEM;
+                       err = -EBUSY;
+                       goto _err;
                }
 
 #ifdef CS4232
                                     dma2[dev],
                                     CS4231_HW_DETECT,
                                     0,
-                                    &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_mixer(chip)) < 0)
+               goto _err;
 
 #else /* CS4236 */
        if ((err = snd_cs4236_create(card,
                                     dma2[dev],
                                     CS4231_HW_DETECT,
                                     0,
-                                    &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4236_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4236_mixer(chip)) < 0)
+               goto _err;
 #endif
        strcpy(card->driver, pcm->name);
        strcpy(card->shortname, pcm->name);
        if (dma2[dev] >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
 
-       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
+               goto _err;
 
        if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
                if (snd_opl3_create(card,
                                    fm_port[dev], fm_port[dev] + 2,
                                    OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
-                       printk(KERN_ERR IDENT ": OPL3 not detected\n");
+                       printk(KERN_WARNING IDENT ": OPL3 not detected\n");
                } else {
-                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                               snd_card_free(card);
-                               return err;
-                       }
+                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                               goto _err;
                }
        }
 
                                        mpu_port[dev], 0,
                                        mpu_irq[dev],
                                        mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0)
-                       printk(KERN_ERR IDENT ": MPU401 not detected\n");
-       }
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
+                       printk(KERN_WARNING IDENT ": MPU401 not detected\n");
        }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_cs4236_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 #ifdef CONFIG_PNP
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev])
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0)
                        cards++;
        }
 
 
 static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "es1688: "
 
 static int __init snd_audiodrive_probe(int dev)
 {
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xmpu_irq = mpu_irq[dev];
        xdma = dma8[dev];
        if (xdma == SNDRV_AUTO_DMA) {
                if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
        if ((err = snd_es1688_create(card, port[dev], mpu_port[dev],
                                     xirq, xmpu_irq, xdma,
-                                    ES1688_HW_AUTO, &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_es1688_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    ES1688_HW_AUTO, &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_es1688_mixer(chip)) < 0)
+               goto _err;
 
        strcpy(card->driver, "ES1688");
        strcpy(card->shortname, pcm->name);
        sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma);
 
        if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) {
-               printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port);
+               printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->port);
        } else {
-               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                       goto _err;
        }
 
        if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) {
                                               chip->mpu_port, 0,
                                               xmpu_irq,
                                               SA_INTERRUPT,
-                                              NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-       }
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
+                                              NULL)) < 0)
+                       goto _err;
        }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_audiodrive_cards[dev] = card;
        return 0;
 
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport)
 
 }
 #endif /* CONFIG_PNP */
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
                                          const struct pnp_card_device_id *pid)
 {
        int xirq, xdma1, xdma2;
        snd_card_t *card;
        struct snd_audiodrive *acard;
-       snd_rawmidi_t *rmidi = NULL;
        es18xx_t *chip;
        opl3_t *opl3;
        int err;
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
         if (xdma1 == SNDRV_AUTO_DMA) {
                 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                        snd_card_free(card);
-                        snd_printk("unable to find a free DMA1\n");
-                        return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                 }
         }
        xdma2 = dma2[dev];
         if (xdma2 == SNDRV_AUTO_DMA) {
                 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                        snd_card_free(card);
-                        snd_printk("unable to find a free DMA2\n");
-                        return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                 }
         }
 
                                         mpu_port[dev],
                                         fm_port[dev],
                                         xirq, xdma1, xdma2,
-                                        &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                        &chip)) < 0)
+               goto _err;
 
        sprintf(card->driver, "ES%x", chip->version);
        sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
                        chip->port,
                        xirq, xdma1);
 
-       if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_es18xx_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_es18xx_mixer(chip)) < 0)
+               goto _err;
 
        if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
                if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) {
-                       snd_printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->fm_port);
+                       snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port);
                } else {
-                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                               snd_card_free(card);
-                               return err;
-                       }
+                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                               goto _err;
                }
        }
 
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
                                               chip->mpu_port, 0,
                                               xirq, 0,
-                                              &rmidi)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-               chip->rmidi = rmidi;
+                                              &chip->rmidi)) < 0)
+                       goto _err;
        }
 
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
        /* Power Management */
        snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_audiodrive_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport)
        for ( ; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                port[dev] = xport;
                res = snd_audiodrive_probe(dev, NULL, NULL);
                if (res < 0)
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (snd_audiodrive_probe(dev, NULL, NULL) >= 0)
                        cards++;
        }
 
 
 static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "gusclassic: "
 
 static int __init snd_gusclassic_detect(snd_gus_card_t * gus)
 {
-       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
+       unsigned char d;
 
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
-
+       }
        return 0;
 }
 
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
        if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA1\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma2 = dma2[dev];
        if (xdma2 == SNDRV_AUTO_DMA) {
                if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA2\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
                                  port[dev],
                                  xirq, xdma1, xdma2,
                                  0, channels[dev], pcm_channels[dev],
-                                 0, &gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_gusclassic_detect(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                 0, &gus)) < 0)
+               goto _err;
+
+       if ((err = snd_gusclassic_detect(gus)) < 0)
+               goto _err;
+
        snd_gusclassic_init(dev, gus);
-       if ((err = snd_gus_initialize(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gus_initialize(gus)) < 0)
+               goto _err;
+
        if (gus->max_flag || gus->ess_flag) {
-               snd_printdd("GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port);
-               snd_card_free(card);
-               return -ENODEV;
-       }
-       if ((err = snd_gf1_new_mixer(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port);
+               err = -ENODEV;
+               goto _err;
        }
+
+       if ((err = snd_gf1_new_mixer(gus)) < 0)
+               goto _err;
+
+       if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0)
+               goto _err;
+
        if (!gus->ace_flag) {
-               if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
+                       goto _err;
        }
        sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1);
        if (dma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_gusclassic_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport)
 
 
 static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "gusextreme: "
 
 static int __init snd_gusextreme_detect(int dev,
                                        snd_card_t * card,
                                        es1688_t *es1688)
 {
        unsigned long flags;
+       unsigned char d;
 
        /*
         * This is main stuff - enable access to GF1 chip...
        udelay(100);
 
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -EIO;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -EIO;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -EIO;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -EIO;
-#endif
-
+       }
        return 0;
 }
 
        xgf1_irq = gf1_irq[dev];
        if (xgf1_irq == SNDRV_AUTO_IRQ) {
                if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) {
-                       snd_printk("unable to find a free IRQ for GF1\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ for GF1\n");
                        err = -EBUSY;
                        goto out;
                }
        xess_irq = irq[dev];
        if (xess_irq == SNDRV_AUTO_IRQ) {
                if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) {
-                       snd_printk("unable to find a free IRQ for ES1688\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ for ES1688\n");
                        err = -EBUSY;
                        goto out;
                }
        xgf1_dma = dma1[dev];
        if (xgf1_dma == SNDRV_AUTO_DMA) {
                if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) {
-                       snd_printk("unable to find a free DMA for GF1\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA for GF1\n");
                        err = -EBUSY;
                        goto out;
                }
        xess_dma = dma8[dev];
        if (xess_dma == SNDRV_AUTO_DMA) {
                if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) {
-                       snd_printk("unable to find a free DMA for ES1688\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA for ES1688\n");
                        err = -EBUSY;
                        goto out;
                }
                goto out;
 
        if (!gus->ess_flag) {
-               snd_printdd("GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port);
+               snd_printk(KERN_ERR PFX "GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port);
                err = -ENODEV;
                goto out;
        }
 
        if (snd_opl3_create(card, es1688->port, es1688->port + 2,
                            OPL3_HW_OPL3, 0, &opl3) < 0) {
-               printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
+               printk(KERN_ERR PFX "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
        } else {
                if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0)
                        goto out;
 
        sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i",
                es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma);
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto out;
+
        if ((err = snd_card_register(card)) < 0)
                goto out;
 
 
 
 static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "gusmax: "
 
 static int __init snd_gusmax_detect(snd_gus_card_t * gus)
 {
-       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
+       unsigned char d;
 
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
+
        return 0;
 }
 
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
        if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA1\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma2 = dma2[dev];
        if (xdma2 == SNDRV_AUTO_DMA) {
                if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA2\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
                                  -xirq, xdma1, xdma2,
                                  0, channels[dev],
                                  pcm_channels[dev],
-                                 0, &gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_gusmax_detect(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                 0, &gus)) < 0)
+               goto _err;
+
+       if ((err = snd_gusmax_detect(gus)) < 0)
+               goto _err;
+
        maxcard->gus_status_reg = gus->gf1.reg_irqstat;
        maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
        snd_gusmax_init(dev, card, gus);
-       if ((err = snd_gus_initialize(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gus_initialize(gus)) < 0)
+               goto _err;
+
        if (!gus->max_flag) {
-               printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
-               snd_card_free(card);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
+               err = -ENODEV;
+               goto _err;
        }
 
        if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) {
-               snd_card_free(card);
-               printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", xirq);
-               return -EBUSY;
+               snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
+               err = -EBUSY;
+               goto _err;
        }
        maxcard->irq = xirq;
        
                                     CS4231_HWSHARE_IRQ |
                                     CS4231_HWSHARE_DMA1 |
                                     CS4231_HWSHARE_DMA2,
-                                    &cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &cs4231)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_mixer(cs4231)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
+               goto _err;
+
        if (pcm_channels[dev] > 0) {
-               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-       }
-       if ((err = snd_gusmax_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
+               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
+                       goto _err;
        }
+       if ((err = snd_gusmax_mixer(cs4231)) < 0)
+               goto _err;
 
-       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
+               goto _err;
 
        sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1);
        if (xdma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%i", xdma2);
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
                
        maxcard->gus = gus;
        maxcard->cs4231 = cs4231;
        snd_gusmax_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_gusmax_legacy_auto_probe(unsigned long xport)
 
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
 static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 
+#ifdef SNDRV_STB
+#define PFX "interwave-stb: "
+#else
+#define PFX "interwave: "
+#endif
+
 module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for InterWave soundcard.");
 module_param_array(id, charp, NULL, 0444);
 {
        unsigned long flags;
        unsigned char rev1, rev2;
+       int d;
 
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               int d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               int d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
-
+       }
        spin_lock_irqsave(&gus->reg_lock, flags);
        rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER);
        snd_gf1_write8(gus, SNDRV_GF1_GB_VERSION_NUMBER, ~rev1);
        card->private_free = snd_interwave_free;
 #ifdef CONFIG_PNP
        if (isapnp[dev]) {
-               if (snd_interwave_pnp(dev, iwcard, pcard, pid)) {
-                       snd_card_free(card);
-                       return -ENODEV;
-               }
+               if ((err = snd_interwave_pnp(dev, iwcard, pcard, pid)) < 0)
+                       goto _err;
                snd_card_set_dev(card, &pcard->card->dev);
        }
 #endif
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
        if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA1\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma2 = dma2[dev];
        if (xdma2 == SNDRV_AUTO_DMA) {
                if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA2\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
                                  port[dev],
                                  -xirq, xdma1, xdma2,
                                  0, 32,
-                                 pcm_channels[dev], effect[dev], &gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                 pcm_channels[dev], effect[dev], &gus)) < 0)
+               goto _err;
+
        if ((err = snd_interwave_detect(iwcard, gus, dev
 #ifdef SNDRV_STB
             , &i2c_bus
 #endif
-           )) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+           )) < 0)
+               goto _err;
+
        iwcard->gus_status_reg = gus->gf1.reg_irqstat;
        iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
 
        snd_interwave_init(dev, gus);
        snd_interwave_detect_memory(gus);
-       if ((err = snd_gus_initialize(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gus_initialize(gus)) < 0)
+               goto _err;
 
        if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) {
-               snd_card_free(card);
-               snd_printk("unable to grab IRQ %d\n", xirq);
-               return -EBUSY;
+               snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
+               err = -EBUSY;
+               goto _err;
        }
        iwcard->irq = xirq;
 
                                     CS4231_HWSHARE_IRQ |
                                     CS4231_HWSHARE_DMA1 |
                                     CS4231_HWSHARE_DMA2,
-                                    &cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &cs4231)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0)
+               goto _err;
+
        sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
        strcat(pcm->name, " (codec)");
-       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_mixer(cs4231)) < 0)
+               goto _err;
+
        if (pcm_channels[dev] > 0) {
-               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-       }
-       if ((err = snd_interwave_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
+               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
+                       goto _err;
        }
+       if ((err = snd_interwave_mixer(cs4231)) < 0)
+               goto _err;
+
 #ifdef SNDRV_STB
        {
                snd_ctl_elem_id_t id1, id2;
                strcpy(id1.name, "Master Playback Switch");
                strcpy(id2.name, id1.name);
                id2.index = 1;
-               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
+                       goto _err;
                strcpy(id1.name, "Master Playback Volume");
                strcpy(id2.name, id1.name);
-               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-               if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
+                       goto _err;
+               if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0)
+                       goto _err;
        }
 #endif
 
        gus->uart_enable = midi[dev];
-       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
+               goto _err;
 
 #ifndef SNDRV_STB
        str = "AMD InterWave";
        if (xdma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
        
        iwcard->cs4231 = cs4231;
        iwcard->gus = gus;
        else
                snd_interwave_legacy[dev++] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __devinit snd_interwave_probe_legacy_port(unsigned long xport)
 
 
 static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "opl3sa2: "
+
 #ifdef CONFIG_PNP
 
 static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
        card = chip->card;
        port = chip->port;
        if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) {
-               snd_printk(KERN_ERR "opl3sa2: can't grab port 0x%lx\n", port);
+               snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port);
                return -EBUSY;
        }
        // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a));
        return snd_opl3sa2_free(chip);
 }
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __devinit snd_opl3sa2_probe(int dev,
                                       struct pnp_dev *pdev,
                                       struct pnp_card_link *pcard,
        };
        int err;
 
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
+       if (! is_isapnp_selected(dev)) {
                if (port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify port\n");
+                       snd_printk(KERN_ERR PFX "specify port\n");
                        return -EINVAL;
                }
                if (wss_port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify wss_port\n");
+                       snd_printk(KERN_ERR PFX "specify wss_port\n");
                        return -EINVAL;
                }
                if (fm_port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify fm_port\n");
+                       snd_printk(KERN_ERR PFX "specify fm_port\n");
                        return -EINVAL;
                }
                if (midi_port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify midi_port\n");
+                       snd_printk(KERN_ERR PFX "specify midi_port\n");
                        return -EINVAL;
                }
-#ifdef CONFIG_PNP
        }
-#endif
+
        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
        if (card == NULL)
                return -ENOMEM;
        if ((err = snd_opl3sa2_detect(chip)) < 0)
                goto __error;
        if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) {
-               snd_printk(KERN_ERR "opl3sa2: can't grab IRQ %d\n", xirq);
+               snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq);
                err = -ENODEV;
                goto __error;
        }
        if (dma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
 
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto __error;
+
        if ((err = snd_card_register(card)) < 0)
                goto __error;
 
         int res;
 
         for ( ; dev < SNDRV_CARDS; dev++) {
-                if (!enable[dev] || !isapnp[dev])
-                        continue;
+               if (!enable[dev])
+                       continue;
+               if (is_isapnp_selected(dev))
+                       continue;
                 res = snd_opl3sa2_probe(dev, NULL, card, id);
                 if (res < 0)
                         return res;
 
        }
 }
 
-static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard,
-                                           const struct pnp_card_device_id *pid)
+static int snd_card_opti9xx_probe(struct pnp_card_link *pcard,
+                                 const struct pnp_card_device_id *pid)
 {
        static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
        static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1};
                        snd_card_free(card);
                        return error;
                }
+               if ((error = snd_card_set_generic_dev(card)) < 0) {
+                       snd_card_free(card);
+                       return error;
+               }
 #ifdef CONFIG_PNP
        }
 #endif /* CONFIG_PNP */
 
        }
 }
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __init snd_sb16_probe(int dev,
                                 struct pnp_card_link *pcard,
                                 const struct pnp_card_device_id *pid)
        card->private_free = snd_sb16_free;
 #ifdef CONFIG_PNP
        if (isapnp[dev]) {
-               if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid)))
+                       goto _err;
                snd_card_set_dev(card, &pcard->card->dev);
        }
 #endif
        xirq = irq[dev];
        xdma8 = dma8[dev];
        xdma16 = dma16[dev];
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
-       if (xirq == SNDRV_AUTO_IRQ) {
-               if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
-                       return -EBUSY;
+       if (! is_isapnp_selected(dev)) {
+               if (xirq == SNDRV_AUTO_IRQ) {
+                       if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
+                               snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                               err = -EBUSY;
+                               goto _err;
+                       }
                }
-       }
-       if (xdma8 == SNDRV_AUTO_DMA) {
-               if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) {
-                       snd_card_free(card);
-                       snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n");
-                       return -EBUSY;
+               if (xdma8 == SNDRV_AUTO_DMA) {
+                       if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) {
+                               snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n");
+                               err = -EBUSY;
+                               goto _err;
+                       }
                }
-       }
-       if (xdma16 == SNDRV_AUTO_DMA) {
-               if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) {
-                       snd_card_free(card);
-                       snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n");
-                       return -EBUSY;
+               if (xdma16 == SNDRV_AUTO_DMA) {
+                       if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) {
+                               snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n");
+                               err = -EBUSY;
+                               goto _err;
+                       }
                }
-       }
-       /* non-PnP FM port address is hardwired with base port address */
-       fm_port[dev] = port[dev];
-       /* block the 0x388 port to avoid PnP conflicts */
-       acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
+               /* non-PnP FM port address is hardwired with base port address */
+               fm_port[dev] = port[dev];
+               /* block the 0x388 port to avoid PnP conflicts */
+               acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
 #ifdef SNDRV_SBAWE_EMU8000
-       /* non-PnP AWE port address is hardwired with base port address */
-       awe_port[dev] = port[dev] + 0x400;
+               /* non-PnP AWE port address is hardwired with base port address */
+               awe_port[dev] = port[dev] + 0x400;
 #endif
-#ifdef CONFIG_PNP
        }
-#endif
 
        if ((err = snd_sbdsp_create(card,
                                    port[dev],
                                    xdma8,
                                    xdma16,
                                    SB_HW_AUTO,
-                                   &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                   &chip)) < 0)
+               goto _err;
+
        if (chip->hardware != SB_HW_16) {
-               snd_card_free(card);
-               snd_printdd("SB 16 chip was not detected at 0x%lx\n", port[dev]);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "SB 16 chip was not detected at 0x%lx\n", port[dev]);
+               err = -ENODEV;
+               goto _err;
        }
        chip->mpu_port = mpu_port[dev];
-#ifdef CONFIG_PNP
-       if (!isapnp[dev] && (err = snd_sb16dsp_configure(chip)) < 0) {
-#else
-       if ((err = snd_sb16dsp_configure(chip)) < 0) {
-#endif
-               snd_card_free(card);
-               return -ENXIO;
-       }
-       if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return -ENXIO;
-       }
+       if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0)
+               goto _err;
+
+       if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0)
+               goto _err;
 
        strcpy(card->driver,
 #ifdef SNDRV_SBAWE_EMU8000
        if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB,
                                               chip->mpu_port, 0,
-                                              xirq, 0, &chip->rmidi)) < 0) {
-                       snd_card_free(card);
-                       return -ENXIO;
-               }
+                                              xirq, 0, &chip->rmidi)) < 0)
+                       goto _err;
                chip->rmidi_callback = snd_mpu401_uart_interrupt;
        }
 
 #else
                        int seqdev = 1;
 #endif
-                       if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0) {
-                               snd_card_free(card);
-                               return -ENXIO;
-                       }
+                       if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0)
+                               goto _err;
                }
        }
 
-       if ((err = snd_sbmixer_new(chip)) < 0) {
-               snd_card_free(card);
-               return -ENXIO;
-       }
+       if ((err = snd_sbmixer_new(chip)) < 0)
+               goto _err;
 
 #ifdef CONFIG_SND_SB16_CSP
        /* CSP chip on SB16ASP/AWE32 */
 #endif
 #ifdef SNDRV_SBAWE_EMU8000
        if (awe_port[dev] > 0) {
-               if (snd_emu8000_new(card, 1, awe_port[dev],
-                                   seq_ports[dev], NULL) < 0) {
+               if ((err = snd_emu8000_new(card, 1, awe_port[dev],
+                                          seq_ports[dev], NULL)) < 0) {
                        snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]);
-                       snd_card_free(card);
-                       return -ENXIO;
+
+                       goto _err;
                }
        }
 #endif
                (mic_agc[dev] ? 0x00 : 0x01));
        spin_unlock_irqrestore(&chip->mixer_lock, flags);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_sb16_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_sb16_probe_legacy_port(unsigned long xport)
        for ( ; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                port[dev] = xport;
                res = snd_sb16_probe(dev, NULL, NULL);
                if (res < 0)
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (!snd_sb16_probe(dev, NULL, NULL)) {
                        cards++;
                        continue;
 
                                    dma8[dev],
                                    -1,
                                    SB_HW_AUTO,
-                                   &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                   &chip)) < 0)
+               goto _err;
+
        if (chip->hardware >= SB_HW_16) {
-               snd_card_free(card);
                if (chip->hardware == SB_HW_ALS100)
-                       snd_printdd("ALS100 chip detected at 0x%lx, try snd-als100 module\n",
+                       snd_printk(KERN_WARNING "ALS100 chip detected at 0x%lx, try snd-als100 module\n",
                                    port[dev]);
                else
-                       snd_printdd("SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
-                                   port[dev]);
-               return -ENODEV;
+                       snd_printk(KERN_WARNING "SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
+                                  port[dev]);
+               err = -ENODEV;
+               goto _err;
        }
 
-       if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_sbmixer_new(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_sbmixer_new(chip)) < 0)
+               goto _err;
+
        if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) {
                if ((err = snd_opl3_create(card, chip->port + 8, 0,
                                           OPL3_HW_AUTO, 1,
                                           &opl3)) < 0) {
-                       snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx\n", chip->port + 8);
+                       snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx\n", chip->port + 8);
                }
        } else {
                if ((err = snd_opl3_create(card, chip->port, chip->port + 2,
                                           OPL3_HW_AUTO, 1,
                                           &opl3)) < 0) {
-                       snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx-0x%lx\n",
+                       snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx-0x%lx\n",
                                   chip->port, chip->port + 2);
                }
        }
        if (err >= 0) {
-               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                       goto _err;
        }
 
-       if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0)
+               goto _err;
 
        strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
        strcpy(card->shortname, chip->name);
                chip->name,
                chip->port,
                irq[dev], dma8[dev]);
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_sb8_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport)
 
 
 static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "sgalaxy: "
+
 /*
 
  */
        }
 
 #if 0
-       snd_printdd("sgalaxy - setting up IRQ/DMA for WSS\n");
+       snd_printdd(PFX "setting up IRQ/DMA for WSS\n");
 #endif
 
         /* initialize IRQ for WSS codec */
 static int __init snd_sgalaxy_detect(int dev, int irq, int dma)
 {
 #if 0
-       snd_printdd("sgalaxy - switching to WSS mode\n");
+       snd_printdd(PFX "switching to WSS mode\n");
 #endif
 
        /* switch to WSS mode */
        ad1848_t *chip;
 
        if (sbport[dev] == SNDRV_AUTO_PORT) {
-               snd_printk("specify SB port\n");
+               snd_printk(KERN_ERR PFX "specify SB port\n");
                return -EINVAL;
        }
        if (wssport[dev] == SNDRV_AUTO_PORT) {
-               snd_printk("specify WSS port\n");
+               snd_printk(KERN_ERR PFX "specify WSS port\n");
                return -EINVAL;
        }
        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
         if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
-       if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0)
+               goto _err;
 
        if ((err = snd_ad1848_create(card, wssport[dev] + 4,
                                     xirq, xdma1,
-                                    AD1848_HW_DETECT, &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    AD1848_HW_DETECT, &chip)) < 0)
+               goto _err;
 
        if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) {
-               snd_printdd("sgalaxy - error creating new ad1848 PCM device\n");
-               snd_card_free(card);
-               return err;
+               snd_printdd(PFX "error creating new ad1848 PCM device\n");
+               goto _err;
        }
        if ((err = snd_ad1848_mixer(chip)) < 0) {
-               snd_printdd("sgalaxy - error creating new ad1848 mixer\n");
-               snd_card_free(card);
-               return err;
+               snd_printdd(PFX "error creating new ad1848 mixer\n");
+               goto _err;
        }
-       if (snd_sgalaxy_mixer(chip) < 0) {
-               snd_printdd("sgalaxy - the mixer rewrite failed\n");
-               snd_card_free(card);
-               return err;
+       if ((err = snd_sgalaxy_mixer(chip)) < 0) {
+               snd_printdd(PFX "the mixer rewrite failed\n");
+               goto _err;
        }
 
        strcpy(card->driver, "Sound Galaxy");
        sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d",
                wssport[dev], xirq, xdma1);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_sgalaxy_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_sgalaxy_init(void)
 
         */
        sscape_write(sscape, GA_INTENA_REG, 0x80);
 
-       if ((err = snd_card_register(card)) < 0) {
-               printk(KERN_ERR "sscape: Failed to register sound card\n");
-               goto _release_card;
-       }
-
        /*
         * Initialize mixer
         */
                        if (ret < 0)
                                return ret;
                        snd_card_set_dev(card, &pcard->card->dev);
+
+                       if ((ret = snd_card_register(card)) < 0) {
+                               printk(KERN_ERR "sscape: Failed to register sound card\n");
+                               snd_card_free(card);
+                               return ret;
+                       }
+
                        pnp_set_card_drvdata(pcard, card);
                        ++sscape_cards;
                        ++idx;
                if (ret < 0)
                        return ret;
 
+               if ((ret = snd_card_set_generic_dev(card)) < 0) {
+                       snd_card_free(card);
+                       return ret;
+               }
+               if ((ret = snd_card_register(card)) < 0) {
+                       printk(KERN_ERR "sscape: Failed to register sound card\n");
+                       snd_card_free(card);
+                       return ret;
+               }
+
                sscape_card[sscape_cards] = card;
                params++;
                sscape_cards++;
 
                 ics2115_port[dev],
                 ics2115_irq[dev]);
 
+       if ((err = snd_card_set_generic_dev(card)) < 0) {
+               snd_card_free(card);
+               return err;
+       }
+
        if ((err = snd_card_register(card)) < 0) {
                snd_card_free(card);
                return err;