]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/es1968.c
[ALSA] Remove xxx_t typedefs: PCI AD1889
[linux-2.6-omap-h63xx.git] / sound / pci / es1968.c
index 327a341e276b1017e2a60cb03d6adf0310e25751..50079dc90743cd70b57cc0feb3422a51ff3d640c 100644 (file)
@@ -160,25 +160,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
 #endif
 
 
-/* PCI Dev ID's */
-
-#ifndef PCI_VENDOR_ID_ESS
-#define PCI_VENDOR_ID_ESS      0x125D
-#endif
-
-#define PCI_VENDOR_ID_ESS_OLD  0x1285  /* Platform Tech, the people the ESS
-                                          was bought form */
-
-#ifndef PCI_DEVICE_ID_ESS_M2E
-#define PCI_DEVICE_ID_ESS_M2E  0x1978
-#endif
-#ifndef PCI_DEVICE_ID_ESS_M2
-#define PCI_DEVICE_ID_ESS_M2   0x1968
-#endif
-#ifndef PCI_DEVICE_ID_ESS_M1
-#define PCI_DEVICE_ID_ESS_M1   0x0100
-#endif
-
 #define NR_APUS                        64
 #define NR_APU_REGS            16
 
@@ -664,11 +645,6 @@ static inline u16 maestro_read(es1968_t *chip, u16 reg)
        return result;
 }
 
-#define big_mdelay(msec) do {\
-       set_current_state(TASK_UNINTERRUPTIBLE);\
-       schedule_timeout(((msec) * HZ + 999) / 1000);\
-} while (0)
-       
 /* Wait for the codec bus to be free */
 static int snd_es1968_ac97_wait(es1968_t *chip)
 {
@@ -1486,13 +1462,13 @@ snd_es1968_init_dmabuf(es1968_t *chip)
                                                   snd_dma_pci_data(chip->pci),
                                                   chip->total_bufsize, &chip->dma);
                if (err < 0 || ! chip->dma.area) {
-                       snd_printk("es1968: can't allocate dma pages for size %d\n",
+                       snd_printk(KERN_ERR "es1968: can't allocate dma pages for size %d\n",
                                   chip->total_bufsize);
                        return -ENOMEM;
                }
                if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) {
                        snd_dma_free_pages(&chip->dma);
-                       snd_printk("es1968: DMA buffer beyond 256MB.\n");
+                       snd_printk(KERN_ERR "es1968: DMA buffer beyond 256MB.\n");
                        return -ENOMEM;
                }
        }
@@ -1601,7 +1577,7 @@ static int snd_es1968_playback_open(snd_pcm_substream_t *substream)
        if (apu1 < 0)
                return apu1;
 
-       es = kcalloc(1, sizeof(*es), GFP_KERNEL);
+       es = kzalloc(sizeof(*es), GFP_KERNEL);
        if (!es) {
                snd_es1968_free_apu_pair(chip, apu1);
                return -ENOMEM;
@@ -1646,7 +1622,7 @@ static int snd_es1968_capture_open(snd_pcm_substream_t *substream)
                return apu2;
        }
        
-       es = kcalloc(1, sizeof(*es), GFP_KERNEL);
+       es = kzalloc(sizeof(*es), GFP_KERNEL);
        if (!es) {
                snd_es1968_free_apu_pair(chip, apu1);
                snd_es1968_free_apu_pair(chip, apu2);
@@ -1765,11 +1741,11 @@ static void __devinit es1968_measure_clock(es1968_t *chip)
 
        /* search 2 APUs (although one apu is enough) */
        if ((apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY)) < 0) {
-               snd_printk("Hmm, cannot find empty APU pair!?\n");
+               snd_printk(KERN_ERR "Hmm, cannot find empty APU pair!?\n");
                return;
        }
        if ((memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE)) == NULL) {
-               snd_printk("cannot allocate dma buffer - using default clock %d\n", chip->clock);
+               snd_printk(KERN_ERR "cannot allocate dma buffer - using default clock %d\n", chip->clock);
                snd_es1968_free_apu_pair(chip, apu);
                return;
        }
@@ -1809,8 +1785,7 @@ static void __devinit es1968_measure_clock(es1968_t *chip)
        snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR);
        do_gettimeofday(&start_time);
        spin_unlock_irq(&chip->reg_lock);
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(HZ / 20); /* 50 msec */
+       msleep(50);
        spin_lock_irq(&chip->reg_lock);
        offset = __apu_get_register(chip, apu, 5);
        do_gettimeofday(&stop_time);
@@ -1831,7 +1806,7 @@ static void __devinit es1968_measure_clock(es1968_t *chip)
        else
                t += stop_time.tv_usec - start_time.tv_usec;
        if (t == 0) {
-               snd_printk("?? calculation error..\n");
+               snd_printk(KERN_ERR "?? calculation error..\n");
        } else {
                offset *= 1000;
                offset = (offset / t) * 1000 + ((offset % t) * 1000) / t;
@@ -2093,7 +2068,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip)
        outw(0x0000, ioaddr + 0x60);    /* write 0 to gpio 0 */
        udelay(20);
        outw(0x0001, ioaddr + 0x60);    /* write 1 to gpio 1 */
-       big_mdelay(20);
+       msleep(20);
 
        outw(save_68 | 0x1, ioaddr + 0x68);     /* now restore .. */
        outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38);
@@ -2109,13 +2084,13 @@ static void snd_es1968_ac97_reset(es1968_t *chip)
        outw(0x0001, ioaddr + 0x60);    /* write 1 to gpio */
        udelay(20);
        outw(0x0009, ioaddr + 0x60);    /* write 9 to gpio */
-       big_mdelay(500);
+       msleep(500);
        //outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38);
        outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a);
        outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c);
 
 #if 0                          /* the loop here needs to be much better if we want it.. */
-       snd_printk("trying software reset\n");
+       snd_printk(KERN_INFO "trying software reset\n");
        /* try and do a software reset */
        outb(0x80 | 0x7c, ioaddr + 0x30);
        for (w = 0;; w++) {
@@ -2135,7 +2110,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip)
 
                if (w > 10000) {
                        outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */
-                       big_mdelay(500);        /* oh my.. */
+                       msleep(500);    /* oh my.. */
                        outb(inb(ioaddr + 0x37) & ~0x08,
                                ioaddr + 0x37);
                        udelay(1);
@@ -2486,8 +2461,7 @@ static int __devinit snd_es1968_create_gameport(es1968_t *chip, int dev)
        chip->gameport = gp = gameport_allocate_port();
        if (!gp) {
                printk(KERN_ERR "es1968: cannot allocate memory for gameport\n");
-               release_resource(r);
-               kfree_nocheck(r);
+               release_and_free_resource(r);
                return -ENOMEM;
        }
 
@@ -2513,8 +2487,7 @@ static void snd_es1968_free_gameport(es1968_t *chip)
                gameport_unregister_port(chip->gameport);
                chip->gameport = NULL;
 
-               release_resource(r);
-               kfree_nocheck(r);
+               release_and_free_resource(r);
        }
 }
 #else
@@ -2589,12 +2562,12 @@ static int __devinit snd_es1968_create(snd_card_t * card,
        /* check, if we can restrict PCI DMA transfers to 28 bits */
        if (pci_set_dma_mask(pci, 0x0fffffff) < 0 ||
            pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) {
-               snd_printk("architecture does not support 28bit PCI busmaster DMA\n");
+               snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n");
                pci_disable_device(pci);
                return -ENXIO;
        }
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (! chip) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2624,7 +2597,7 @@ static int __devinit snd_es1968_create(snd_card_t * card,
        chip->io_port = pci_resource_start(pci, 0);
        if (request_irq(pci->irq, snd_es1968_interrupt, SA_INTERRUPT|SA_SHIRQ,
                        "ESS Maestro", (void*)chip)) {
-               snd_printk("unable to grab IRQ %d\n", pci->irq);
+               snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_es1968_free(chip);
                return -EBUSY;
        }