Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / sound / oss / soundcard.c
index 7e22896..0860d67 100644 (file)
@@ -22,7 +22,6 @@
  * Christoph Hellwig : Some cleanup work (2000/03/01)
  */
 
-#include <linux/config.h>
 
 #include "sound_config.h"
 #include <linux/init.h>
@@ -38,7 +37,6 @@
 #include <linux/wait.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/major.h>
 #include <linux/delay.h>
 #include <linux/proc_fs.h>
@@ -73,7 +71,7 @@ static char     dma_alloc_map[MAX_DMA_CHANNELS];
 
 
 unsigned long seq_time = 0;    /* Time for /dev/sequencer */
-extern struct class_simple *sound_class;
+extern struct class *sound_class;
 
 /*
  * Table for configurable mixer volume handling
@@ -127,7 +125,7 @@ static int get_mixer_levels(void __user * arg)
 {
        int n;
 
-       if (__get_user(n, (int __user *)(&(((mixer_vol_table *__user )arg)->num))))
+       if (__get_user(n, (int __user *)(&(((mixer_vol_table __user *)arg)->num))))
                return -EFAULT;
        if (n < 0 || n >= num_mixer_volumes)
                return -EINVAL;
@@ -329,7 +327,7 @@ static int sound_mixer_ioctl(int mixdev, unsigned int cmd, void __user *arg)
 static int sound_ioctl(struct inode *inode, struct file *file,
                       unsigned int cmd, unsigned long arg)
 {
-       int err, len = 0, dtype;
+       int len = 0, dtype;
        int dev = iminor(inode);
        void __user *p = (void __user *)arg;
 
@@ -341,11 +339,11 @@ static int sound_ioctl(struct inode *inode, struct file *file,
                if (len < 1 || len > 65536 || !p)
                        return -EFAULT;
                if (_SIOC_DIR(cmd) & _SIOC_WRITE)
-                       if ((err = verify_area(VERIFY_READ, p, len)) < 0)
-                               return err;
+                       if (!access_ok(VERIFY_READ, p, len))
+                               return -EFAULT;
                if (_SIOC_DIR(cmd) & _SIOC_READ)
-                       if ((err = verify_area(VERIFY_WRITE, p, len)) < 0)
-                               return err;
+                       if (!access_ok(VERIFY_WRITE, p, len))
+                               return -EFAULT;
        }
        DEB(printk("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg));
        if (cmd == OSS_GETVERSION)
@@ -463,9 +461,9 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma)
        if (size != dmap->bytes_in_use) {
                printk(KERN_WARNING "Sound: mmap() size = %ld. Should be %d\n", size, dmap->bytes_in_use);
        }
-       if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmap->raw_buf),
-               vma->vm_end - vma->vm_start,
-               vma->vm_page_prot)) {
+       if (remap_pfn_range(vma, vma->vm_start,
+                       virt_to_phys(dmap->raw_buf) >> PAGE_SHIFT,
+                       vma->vm_end - vma->vm_start, vma->vm_page_prot)) {
                unlock_kernel();
                return -EAGAIN;
        }
@@ -535,8 +533,8 @@ static const struct {
 static int dmabuf;
 static int dmabug;
 
-MODULE_PARM(dmabuf, "i");
-MODULE_PARM(dmabug, "i");
+module_param(dmabuf, int, 0444);
+module_param(dmabug, int, 0444);
 
 static int __init oss_init(void)
 {
@@ -564,26 +562,17 @@ static int __init oss_init(void)
        sound_dmap_flag = (dmabuf > 0 ? 1 : 0);
 
        for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
-               devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor),
-                               S_IFCHR | dev_list[i].mode,
-                               "sound/%s", dev_list[i].name);
-               class_simple_device_add(sound_class, 
-                                       MKDEV(SOUND_MAJOR, dev_list[i].minor),
-                                       NULL, "%s", dev_list[i].name);
+               class_device_create(sound_class, NULL,
+                                   MKDEV(SOUND_MAJOR, dev_list[i].minor),
+                                   NULL, "%s", dev_list[i].name);
 
                if (!dev_list[i].num)
                        continue;
 
-               for (j = 1; j < *dev_list[i].num; j++) {
-                       devfs_mk_cdev(MKDEV(SOUND_MAJOR,
-                                               dev_list[i].minor + (j*0x10)),
-                                       S_IFCHR | dev_list[i].mode,
-                                       "sound/%s%d", dev_list[i].name, j);
-                       class_simple_device_add(sound_class,
-                                       MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
-                                       NULL,
-                                       "%s%d", dev_list[i].name, j);
-               }
+               for (j = 1; j < *dev_list[i].num; j++)
+                       class_device_create(sound_class, NULL,
+                                           MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
+                                           NULL, "%s%d", dev_list[i].name, j);
        }
 
        if (sound_nblocks >= 1024)
@@ -597,14 +586,11 @@ static void __exit oss_cleanup(void)
        int i, j;
 
        for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
-               devfs_remove("sound/%s", dev_list[i].name);
-               class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor));
+               class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor));
                if (!dev_list[i].num)
                        continue;
-               for (j = 1; j < *dev_list[i].num; j++) {
-                       devfs_remove("sound/%s%d", dev_list[i].name, j);
-                       class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)));
-               }
+               for (j = 1; j < *dev_list[i].num; j++)
+                       class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)));
        }
        
        unregister_sound_special(1);
@@ -682,8 +668,7 @@ static void do_sequencer_timer(unsigned long dummy)
 }
 
 
-static struct timer_list seq_timer =
-               TIMER_INITIALIZER(do_sequencer_timer, 0, 0);
+static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
 
 void request_sound_timer(int count)
 {