Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[firefly-linux-kernel-4.4.55.git] / sound / pci / sonicvibes.c
index 60ecb2bdb65e79231e6bc888d7d51a98734c4f20..e92ef3ae2ca121f92d83b3a465f59ee12c9c3650 100644 (file)
@@ -50,13 +50,6 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
 #define SUPPORT_JOYSTICK 1
 #endif
 
-#ifndef PCI_VENDOR_ID_S3
-#define PCI_VENDOR_ID_S3             0x5333
-#endif
-#ifndef PCI_DEVICE_ID_S3_SONICVIBES
-#define PCI_DEVICE_ID_S3_SONICVIBES  0xca00
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;      /* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
@@ -598,7 +591,7 @@ static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_reg
                return IRQ_NONE;
        if (status == 0xff) {   /* failure */
                outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK));
-               snd_printk("IRQ failure - interrupts disabled!!\n");
+               snd_printk(KERN_ERR "IRQ failure - interrupts disabled!!\n");
                return IRQ_HANDLED;
        }
        if (sonic->pcm) {
@@ -1212,14 +1205,8 @@ static int snd_sonicvibes_free(sonicvibes_t *sonic)
        pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
        if (sonic->irq >= 0)
                free_irq(sonic->irq, (void *)sonic);
-       if (sonic->res_dmaa) {
-               release_resource(sonic->res_dmaa);
-               kfree_nocheck(sonic->res_dmaa);
-       }
-       if (sonic->res_dmac) {
-               release_resource(sonic->res_dmac);
-               kfree_nocheck(sonic->res_dmac);
-       }
+       release_and_free_resource(sonic->res_dmaa);
+       release_and_free_resource(sonic->res_dmac);
        pci_release_regions(sonic->pci);
        pci_disable_device(sonic->pci);
        kfree(sonic);
@@ -1252,12 +1239,12 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
        /* check, if we can restrict PCI DMA transfers to 24 bits */
         if (pci_set_dma_mask(pci, 0x00ffffff) < 0 ||
            pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) {
-                snd_printk("architecture does not support 24bit PCI busmaster DMA\n");
+               snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
                pci_disable_device(pci);
                 return -ENXIO;
         }
 
-       sonic = kcalloc(1, sizeof(*sonic), GFP_KERNEL);
+       sonic = kzalloc(sizeof(*sonic), GFP_KERNEL);
        if (sonic == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1280,7 +1267,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
        sonic->game_port = pci_resource_start(pci, 4);
 
        if (request_irq(pci->irq, snd_sonicvibes_interrupt, SA_INTERRUPT|SA_SHIRQ, "S3 SonicVibes", (void *)sonic)) {
-               snd_printk("unable to grab IRQ %d\n", pci->irq);
+               snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_sonicvibes_free(sonic);
                return -EBUSY;
        }
@@ -1294,24 +1281,24 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
        if (!dmaa) {
                dmaa = dmaio;
                dmaio += 0x10;
-               snd_printk("BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa);
+               snd_printk(KERN_INFO "BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa);
        }
        if (!dmac) {
                dmac = dmaio;
                dmaio += 0x10;
-               snd_printk("BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac);
+               snd_printk(KERN_INFO "BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac);
        }
        pci_write_config_dword(pci, 0x40, dmaa);
        pci_write_config_dword(pci, 0x48, dmac);
 
        if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) {
                snd_sonicvibes_free(sonic);
-               snd_printk("unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1);
+               snd_printk(KERN_ERR "unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1);
                return -EBUSY;
        }
        if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) {
                snd_sonicvibes_free(sonic);
-               snd_printk("unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1);
+               snd_printk(KERN_ERR "unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1);
                return -EBUSY;
        }