]> err.no Git - linux-2.6/blobdiff - sound/isa/opl3sa2.c
[PATCH] libata: indent and whitespace change
[linux-2.6] / sound / isa / opl3sa2.c
index bb5406cf0a19fa2d47aa445b36e578e60e71e458..e2d2babcd20b47421ce034afcbda41837cb66a89 100644 (file)
@@ -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));
@@ -607,7 +609,7 @@ static int __init snd_opl3sa2_pnp(int dev, opl3sa2_t *chip,
        if (irq[dev] != SNDRV_AUTO_IRQ)
                pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
        err = pnp_manual_config_dev(pdev, cfg, 0);
-       if (err < 0)
+       if (err < 0 && isapnp)
                snd_printk(KERN_ERR "PnP manual resources are invalid, using auto config\n");
        err = pnp_activate_dev(pdev);
        if (err < 0) {
@@ -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,34 +691,31 @@ 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;
        strcpy(card->driver, "OPL3SA2");
        strcpy(card->shortname, "Yamaha OPL3-SA2");
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                err = -ENOMEM;
                goto __error;
@@ -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;
 
@@ -839,7 +847,7 @@ static void __devexit snd_opl3sa2_pnp_remove(struct pnp_dev * pdev)
 }
 
 static struct pnp_driver opl3sa2_pnp_driver = {
-       .name = "opl3sa2",
+       .name = "opl3sa2-pnpbios",
        .id_table = snd_opl3sa2_pnpbiosids,
        .probe = snd_opl3sa2_pnp_detect,
        .remove = __devexit_p(snd_opl3sa2_pnp_remove),
@@ -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;