aboutsummaryrefslogtreecommitdiff
path: root/sound/isa/opl3sa2.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-09-05 17:19:20 +0200
committerJaroslav Kysela <perex@suse.cz>2005-09-12 10:42:01 +0200
commit43bcd973d6d05d16b876e09dcc49a09d3e48e88d (patch)
tree8c8493b66c417402f6188051c57e55099bbd156d /sound/isa/opl3sa2.c
parent16dab54b8cbac39bd3f639db5d7d0fd8300a6cb0 (diff)
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver Wavefront drivers - Added snd_card_set_generic_dev() call. - Added SND_GENERIC_DRIVER to Kconfig. - Clean up the error path in probe if necessary. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/opl3sa2.c')
-rw-r--r--sound/isa/opl3sa2.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 75bd6eca63e..e2d615bbb2f 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -143,6 +143,8 @@ struct snd_opl3sa2 {
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[] = {
@@ -231,7 +233,7 @@ static int __init snd_opl3sa2_detect(opl3sa2_t *chip)
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));
@@ -668,6 +670,12 @@ static int snd_opl3sa2_dev_free(snd_device_t *device)
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,
@@ -683,28 +691,25 @@ static int __devinit snd_opl3sa2_probe(int dev,
};
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;
@@ -742,7 +747,7 @@ static int __devinit snd_opl3sa2_probe(int dev,
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;
}
@@ -795,6 +800,9 @@ static int __devinit snd_opl3sa2_probe(int dev,
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;
@@ -852,8 +860,10 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *card,
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;