* Christoph Hellwig : Some cleanup work (2000/03/01)
*/
-#include <linux/config.h>
#include "sound_config.h"
#include <linux/init.h>
#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>
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
{
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;
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;
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)
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;
}
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)
{
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)
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);
}
-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)
{