From: Andy P. <at...@us...> - 2002-04-11 14:30:54
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/sound/cs4281 In directory usw-pr-cvs1:/tmp/cvs-serv12946/sound/cs4281 Modified Files: cs4281_wrapper-24.c cs4281m.c Log Message: synch 2.4.15 commit 54 Index: cs4281_wrapper-24.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/sound/cs4281/cs4281_wrapper-24.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cs4281_wrapper-24.c 25 Feb 2001 23:15:09 -0000 1.1.1.1 +++ cs4281_wrapper-24.c 11 Apr 2002 13:26:50 -0000 1.2 @@ -40,12 +40,3 @@ (state)->tmpbuff, (state)->dmaaddr_tmpbuff); #define cs4x_pgoff(vma) ((vma)->vm_pgoff) -#define RSRCISIOREGION(dev,num) ((dev)->resource[(num)].start != 0 && \ - ((dev)->resource[(num)].flags & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) -#define RSRCISMEMORYREGION(dev,num) ((dev)->resource[(num)].start != 0 && \ - ((dev)->resource[(num)].flags & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) -#define RSRCADDRESS(dev,num) ((dev)->resource[(num)].start) -#define PCI_GET_DRIVER_DATA pci_get_drvdata -#define PCI_SET_DRIVER_DATA pci_set_drvdata -#define PCI_SET_DMA_MASK(pcidev,mask) pcidev->dma_mask = mask - Index: cs4281m.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/sound/cs4281/cs4281m.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cs4281m.c 25 Feb 2001 23:15:09 -0000 1.1.1.1 +++ cs4281m.c 11 Apr 2002 13:26:50 -0000 1.2 @@ -65,7 +65,7 @@ #include <linux/sched.h> #include <linux/delay.h> #include <linux/sound.h> -#include <linux/malloc.h> +#include <linux/slab.h> #include <linux/soundcard.h> #include <linux/pci.h> #include <linux/bitops.h> @@ -194,9 +194,6 @@ } \ }) -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - //LIST_HEAD(cs4281_devs); struct list_head cs4281_devs = { &cs4281_devs, &cs4281_devs }; @@ -661,7 +658,7 @@ card->pBA0 + BA0_ACCTL); // Wait for the write to occur. - for (count = 0; count < 10; count++) { + for (count = 0; count < 100; count++) { // First, we want to wait for a short time. udelay(25); // Now, check to see if the write has completed. @@ -949,7 +946,7 @@ } #ifndef NOT_CS4281_PM -void printpm(struct cs4281_state *s) +static void printpm(struct cs4281_state *s) { CS_DBGOUT(CS_PM, 9, printk("pm struct:\n")); CS_DBGOUT(CS_PM, 9, printk("flags:0x%x u32CLKCR1_SAVE: 0%x u32SSPMValue: 0x%x\n", @@ -970,7 +967,7 @@ s->pm.u32MIDCR_Save)); } -void printpipe(struct cs4281_pipeline *pl) +static void printpipe(struct cs4281_pipeline *pl) { CS_DBGOUT(CS_PM, 9, printk("pm struct:\n")); @@ -1003,7 +1000,7 @@ CS_DBGOUT(CS_PM, 9, printk("u32FPDRnValue: 0x%x u32FPDRnAddress: 0x%x\n", pl->u32FPDRnValue,pl->u32FPDRnAddress)); } -void printpipelines(struct cs4281_state *s) +static void printpipelines(struct cs4281_state *s) { int i; for(i=0;i<CS4281_NUMBER_OF_PIPELINES;i++) @@ -2570,14 +2567,6 @@ // --------------------------------------------------------------------- -static loff_t cs4281_llseek(struct file *file, loff_t offset, int origin) -{ - return -ESPIPE; -} - - -// --------------------------------------------------------------------- - static int cs4281_open_mixdev(struct inode *inode, struct file *file) { int minor = MINOR(inode->i_rdev); @@ -2633,7 +2622,7 @@ // Mixer file operations struct. // ****************************************************************************************** static /*const */ struct file_operations cs4281_mixer_fops = { - llseek:cs4281_llseek, + llseek:no_llseek, ioctl:cs4281_ioctl_mixdev, open:cs4281_open_mixdev, release:cs4281_release_mixdev, @@ -3750,7 +3739,7 @@ // Wave (audio) file operations struct. // ****************************************************************************************** static /*const */ struct file_operations cs4281_audio_fops = { - llseek:cs4281_llseek, + llseek:no_llseek, read:cs4281_read, write:cs4281_write, poll:cs4281_poll, @@ -4099,7 +4088,7 @@ // Midi file operations struct. // ****************************************************************************************** static /*const */ struct file_operations cs4281_midi_fops = { - llseek:cs4281_llseek, + llseek:no_llseek, read:cs4281_midi_read, write:cs4281_midi_write, poll:cs4281_midi_poll, @@ -4289,23 +4278,29 @@ CS_DBGOUT(CS_FUNCTION | CS_INIT, 2, printk(KERN_INFO "cs4281: probe()+\n")); - if (!RSRCISMEMORYREGION(pcidev, 0) || - !RSRCISMEMORYREGION(pcidev, 1)) { + if (pci_enable_device(pcidev)) { + CS_DBGOUT(CS_INIT | CS_ERROR, 1, printk(KERN_ERR + "cs4281: pci_enable_device() failed\n")); + return -1; + } + if (!(pci_resource_flags(pcidev, 0) & IORESOURCE_MEM) || + !(pci_resource_flags(pcidev, 1) & IORESOURCE_MEM)) { CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR "cs4281: probe()- Memory region not assigned\n")); - return -1; + return -ENODEV; } if (pcidev->irq == 0) { CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR "cs4281: probe() IRQ not assigned\n")); - return -1; + return -ENODEV; } - if (!pci_dma_supported(pcidev, 0xffffffff)) { + dma_mask = 0xffffffff; /* this enables playback and recording */ + i = pci_set_dma_mask(pcidev, dma_mask); + if (i) { CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR "cs4281: probe() architecture does not support 32bit PCI busmaster DMA\n")); - return -1; + return i; } - dma_mask = 0xffffffff; /* this enables playback and recording */ if (!(s = kmalloc(sizeof(struct cs4281_state), GFP_KERNEL))) { CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR "cs4281: probe() no memory for state struct.\n")); @@ -4323,8 +4318,8 @@ init_MUTEX(&s->open_sem_adc); init_MUTEX(&s->open_sem_dac); spin_lock_init(&s->lock); - s->pBA0phys = RSRCADDRESS(pcidev, 0); - s->pBA1phys = RSRCADDRESS(pcidev, 1); + s->pBA0phys = pci_resource_start(pcidev, 0); + s->pBA1phys = pci_resource_start(pcidev, 1); /* Convert phys to linear. */ s->pBA0 = ioremap_nocache(s->pBA0phys, 4096); @@ -4366,11 +4361,6 @@ s->magic = CS4281_MAGIC; s->pcidev = pcidev; s->irq = pcidev->irq; - if (pci_enable_device(pcidev)) { - CS_DBGOUT(CS_INIT | CS_ERROR, 1, printk(KERN_ERR - "cs4281: pci_enable_device() failed\n")); - goto err_irq; - } if (request_irq (s->irq, cs4281_interrupt, SA_SHIRQ, "Crystal CS4281", s)) { CS_DBGOUT(CS_INIT | CS_ERROR, 1, @@ -4427,8 +4417,7 @@ mixer_ioctl(s, SOUND_MIXER_PRIVATE1, (unsigned long) &val); set_fs(fs); - PCI_SET_DRIVER_DATA(pcidev, s); - PCI_SET_DMA_MASK(pcidev, dma_mask); + pci_set_drvdata(pcidev, s); list_add(&s->list, &cs4281_devs); CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, printk(KERN_INFO "cs4281: probe()- device allocated successfully\n")); @@ -4457,7 +4446,7 @@ static void __devinit cs4281_remove(struct pci_dev *pci_dev) { - struct cs4281_state *s = PCI_GET_DRIVER_DATA(pci_dev); + struct cs4281_state *s = pci_get_drvdata(pci_dev); // stop DMA controller synchronize_irq(); free_irq(s->irq, s); @@ -4466,9 +4455,9 @@ unregister_sound_midi(s->dev_midi); iounmap(s->pBA1); iounmap(s->pBA0); - kfree(s); - PCI_SET_DRIVER_DATA(pci_dev,NULL); + pci_set_drvdata(pci_dev,NULL); list_del(&s->list); + kfree(s); CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, printk(KERN_INFO "cs4281: cs4281_remove()-: remove successful\n")); } @@ -4523,6 +4512,7 @@ MODULE_AUTHOR("gw boynton, au...@cr..."); MODULE_DESCRIPTION("Cirrus Logic CS4281 Driver"); +MODULE_LICENSE("GPL"); // --------------------------------------------------------------------- |