X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Foss%2Frme96xx.c;h=a1ec9d131ab38f1ad8f356f096b24204fb3dbbca;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=c770137f788065fdcb4826924cd5c7cd2e5ab6f2;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c index c770137f7..a1ec9d131 100644 --- a/sound/oss/rme96xx.c +++ b/sound/oss/rme96xx.c @@ -44,7 +44,6 @@ TODO: #define RMEVERSION "0.8" #endif -#include #include #include #include @@ -59,6 +58,7 @@ TODO: #include #include #include +#include #include #include @@ -68,7 +68,7 @@ TODO: #define NR_DEVICE 2 static int devices = 1; -MODULE_PARM(devices, "1-" __MODULE_STRING(NR_DEVICE) "i"); +module_param(devices, int, 0); MODULE_PARM_DESC(devices, "number of dsp devices allocated by the driver"); @@ -273,7 +273,7 @@ typedef struct _rme96xx_info { /* hardware settings */ int magic; struct pci_dev * pcidev; /* pci_dev structure */ - unsigned long *iobase; + unsigned long __iomem *iobase; unsigned int irq; /* list of rme96xx devices */ @@ -327,7 +327,7 @@ typedef struct _rme96xx_info { /* waiting and locking */ wait_queue_head_t wait; - struct semaphore open_sem; + struct mutex open_mutex; wait_queue_head_t open_wait; } dma[RME96xx_MAX_DEVS]; @@ -339,7 +339,7 @@ typedef struct _rme96xx_info { /* fiddling with the card (first level hardware control) */ -inline void rme96xx_set_ctrl(rme96xx_info* s,int mask) +static inline void rme96xx_set_ctrl(rme96xx_info* s,int mask) { s->control_register|=mask; @@ -347,7 +347,7 @@ inline void rme96xx_set_ctrl(rme96xx_info* s,int mask) } -inline void rme96xx_unset_ctrl(rme96xx_info* s,int mask) +static inline void rme96xx_unset_ctrl(rme96xx_info* s,int mask) { s->control_register&=(~mask); @@ -355,7 +355,7 @@ inline void rme96xx_unset_ctrl(rme96xx_info* s,int mask) } -inline int rme96xx_get_sample_rate_status(rme96xx_info* s) +static inline int rme96xx_get_sample_rate_status(rme96xx_info* s) { int val; u32 status; @@ -366,7 +366,7 @@ inline int rme96xx_get_sample_rate_status(rme96xx_info* s) return val; } -inline int rme96xx_get_sample_rate_ctrl(rme96xx_info* s) +static inline int rme96xx_get_sample_rate_ctrl(rme96xx_info* s) { int val; val = (s->control_register & RME96xx_freq) ? 48000 : 44100; @@ -539,7 +539,7 @@ static inline int rme96xx_spdif_sample_rate (rme96xx_info *s, int *spdifrate) /* the function returns the hardware pointer in bytes */ #define RME96xx_BURSTBYTES -64 /* bytes by which hwptr could be off */ -inline int rme96xx_gethwptr(rme96xx_info* s,int exact) +static inline int rme96xx_gethwptr(rme96xx_info* s,int exact) { unsigned long flags; if (exact) { @@ -557,7 +557,7 @@ inline int rme96xx_gethwptr(rme96xx_info* s,int exact) return (s->hwbufid ? s->fragsize : 0); } -inline void rme96xx_setlatency(rme96xx_info* s,int l) +static inline void rme96xx_setlatency(rme96xx_info* s,int l) { s->latency = l; s->fragsize = 1<<(8+l); @@ -626,7 +626,7 @@ static int rme96xx_startcard(rme96xx_info *s,int stop) } -inline int rme96xx_getospace(struct dmabuf * dma, unsigned int hwp) +static inline int rme96xx_getospace(struct dmabuf * dma, unsigned int hwp) { int cnt; int swptr; @@ -643,7 +643,7 @@ inline int rme96xx_getospace(struct dmabuf * dma, unsigned int hwp) return cnt; } -inline int rme96xx_getispace(struct dmabuf * dma, unsigned int hwp) +static inline int rme96xx_getispace(struct dmabuf * dma, unsigned int hwp) { int cnt; int swptr; @@ -661,7 +661,7 @@ inline int rme96xx_getispace(struct dmabuf * dma, unsigned int hwp) } -inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,int count,int hop) +static inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,int count,int hop) { int swptr = dma->writeptr; switch (dma->format) { @@ -710,7 +710,7 @@ inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,in } /* The count argument is the number of bytes */ -inline int rme96xx_copytouser(struct dmabuf* dma,const char __user* buffer,int count,int hop) +static inline int rme96xx_copytouser(struct dmabuf* dma,const char __user* buffer,int count,int hop) { int swptr = dma->readptr; switch (dma->format) { @@ -793,7 +793,7 @@ static irqreturn_t rme96xx_interrupt(int irq, void *dev_id, struct pt_regs *regs PCI detection and module initialization stuff ----------------------------------------------------------------------------*/ -void* busmaster_malloc(int size) { +static void* busmaster_malloc(int size) { int pg; /* 2 s exponent of memory size */ char *buf; @@ -807,7 +807,7 @@ void* busmaster_malloc(int size) { struct page* page, *last_page; page = virt_to_page(buf); - last_page = virt_to_page(buf + (1 << pg)); + last_page = page + (1 << pg); DBG(printk("setting reserved bit\n")); while (page < last_page) { SetPageReserved(page); @@ -819,7 +819,7 @@ void* busmaster_malloc(int size) { return NULL; } -void busmaster_free(void* ptr,int size) { +static void busmaster_free(void* ptr,int size) { int pg; struct page* page, *last_page; @@ -843,7 +843,7 @@ void busmaster_free(void* ptr,int size) { static int rme96xx_dmabuf_init(rme96xx_info * s,struct dmabuf* dma,int ioffset,int ooffset) { - init_MUTEX(&dma->open_sem); + mutex_init(&dma->open_mutex); init_waitqueue_head(&dma->open_wait); init_waitqueue_head(&dma->wait); dma->s = s; @@ -866,7 +866,7 @@ static int rme96xx_dmabuf_init(rme96xx_info * s,struct dmabuf* dma,int ioffset,i } -int rme96xx_init(rme96xx_info* s) +static int rme96xx_init(rme96xx_info* s) { int i; int status; @@ -1096,7 +1096,7 @@ static int __init init_rme96xx(void) devices = ((devices-1) & RME96xx_MASK_DEVS) + 1; printk(KERN_INFO RME_MESS" reserving %d dsp device(s)\n",devices); numcards = 0; - return pci_module_init(&rme96xx_driver); + return pci_register_driver(&rme96xx_driver); } static void __exit cleanup_rme96xx(void) @@ -1470,21 +1470,21 @@ static int rme96xx_open(struct inode *in, struct file *f) dma = &s->dma[devnum]; f->private_data = dma; /* wait for device to become free */ - down(&dma->open_sem); + mutex_lock(&dma->open_mutex); while (dma->open_mode & f->f_mode) { if (f->f_flags & O_NONBLOCK) { - up(&dma->open_sem); + mutex_unlock(&dma->open_mutex); return -EBUSY; } add_wait_queue(&dma->open_wait, &wait); __set_current_state(TASK_INTERRUPTIBLE); - up(&dma->open_sem); + mutex_unlock(&dma->open_mutex); schedule(); remove_wait_queue(&dma->open_wait, &wait); set_current_state(TASK_RUNNING); if (signal_pending(current)) return -ERESTARTSYS; - down(&dma->open_sem); + mutex_lock(&dma->open_mutex); } COMM ("hardware open") @@ -1493,7 +1493,7 @@ static int rme96xx_open(struct inode *in, struct file *f) dma->open_mode |= (f->f_mode & (FMODE_READ | FMODE_WRITE)); dma->opened = 1; - up(&dma->open_sem); + mutex_unlock(&dma->open_mutex); DBG(printk("device num %d open finished\n",devnum)); return 0; @@ -1525,7 +1525,7 @@ static int rme96xx_release(struct inode *in, struct file *file) } wake_up(&dma->open_wait); - up(&dma->open_sem); + mutex_unlock(&dma->open_mutex); return 0; } @@ -1685,14 +1685,14 @@ static int rm96xx_mmap(struct file *file, struct vm_area_struct *vma) { if (vma->vm_flags & VM_WRITE) { if (!s->started) rme96xx_startcard(s,1); - if (remap_page_range(vma, vma->vm_start, virt_to_phys(s->playbuf + dma->outoffset*RME96xx_DMA_MAX_SIZE), size, vma->vm_page_prot)) { + if (remap_pfn_range(vma, vma->vm_start, virt_to_phys(s->playbuf + dma->outoffset*RME96xx_DMA_MAX_SIZE) >> PAGE_SHIFT, size, vma->vm_page_prot)) { unlock_kernel(); return -EAGAIN; } } else if (vma->vm_flags & VM_READ) { if (!s->started) rme96xx_startcard(s,1); - if (remap_page_range(vma, vma->vm_start, virt_to_phys(s->playbuf + dma->inoffset*RME96xx_DMA_MAX_SIZE), size, vma->vm_page_prot)) { + if (remap_pfn_range(vma, vma->vm_start, virt_to_phys(s->playbuf + dma->inoffset*RME96xx_DMA_MAX_SIZE) >> PAGE_SHIFT, size, vma->vm_page_prot)) { unlock_kernel(); return -EAGAIN; } @@ -1750,9 +1750,7 @@ static unsigned int rme96xx_poll(struct file *file, struct poll_table_struct *wa static struct file_operations rme96xx_audio_fops = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) .owner = THIS_MODULE, -#endif .read = rme96xx_read, .write = rme96xx_write, .poll = rme96xx_poll, @@ -1852,9 +1850,7 @@ static int rme96xx_mixer_release(struct inode *inode, struct file *file) } static /*const*/ struct file_operations rme96xx_mixer_fops = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) .owner = THIS_MODULE, -#endif .ioctl = rme96xx_mixer_ioctl, .open = rme96xx_mixer_open, .release = rme96xx_mixer_release,