static int __devinit snd_ad1889_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { int err; static int devno; struct snd_card *card; struct snd_ad1889 *chip; /* (1) */ if (devno >= SNDRV_CARDS) return -ENODEV; if (!enable[devno]) { devno++; return -ENOENT; } /* (2) */ card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); /* XXX REVISIT: we can probably allocate chip in this call */ if (card == NULL) return -ENOMEM; strcpy(card->driver, "AD1889"); strcpy(card->shortname, "Analog Devices AD1889"); /* (3) */ err = snd_ad1889_create(card, pci, &chip); if (err < 0) goto free_and_ret; /* (4) */ sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->bar, chip->irq); /* (5) */ /* register AC97 mixer */ err = snd_ad1889_ac97_init(chip, ac97_quirk[devno]); if (err < 0) goto free_and_ret; err = snd_ad1889_pcm_init(chip, 0, NULL); if (err < 0) goto free_and_ret; /* register proc interface */ snd_ad1889_proc_init(chip); /* (6) */ err = snd_card_register(card); if (err < 0) goto free_and_ret; /* (7) */ pci_set_drvdata(pci, card); devno++; return 0; free_and_ret: snd_card_free(card); return err; }
static int __devinit snd_ad1889_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { int err; static int devno; struct snd_card *card; struct snd_ad1889 *chip; if (devno >= SNDRV_CARDS) return -ENODEV; if (!enable[devno]) { devno++; return -ENOENT; } err = snd_card_create(index[devno], id[devno], THIS_MODULE, 0, &card); if (err < 0) return err; strcpy(card->driver, "AD1889"); strcpy(card->shortname, "Analog Devices AD1889"); err = snd_ad1889_create(card, pci, &chip); if (err < 0) goto free_and_ret; sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->bar, chip->irq); err = snd_ad1889_ac97_init(chip, ac97_quirk[devno]); if (err < 0) goto free_and_ret; err = snd_ad1889_pcm_init(chip, 0, NULL); if (err < 0) goto free_and_ret; snd_ad1889_proc_init(chip); err = snd_card_register(card); if (err < 0) goto free_and_ret; pci_set_drvdata(pci, card); devno++; return 0; free_and_ret: snd_card_free(card); return err; }