Merge master.kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[pandora-kernel.git] / drivers / char / raw.c
index c596a08..1f0d7c6 100644 (file)
@@ -75,7 +75,7 @@ static int raw_open(struct inode *inode, struct file *filp)
        filp->f_flags |= O_DIRECT;
        filp->f_mapping = bdev->bd_inode->i_mapping;
        if (++raw_devices[minor].inuse == 1)
-               filp->f_dentry->d_inode->i_mapping =
+               filp->f_path.dentry->d_inode->i_mapping =
                        bdev->bd_inode->i_mapping;
        filp->private_data = bdev;
        mutex_unlock(&raw_mutex);
@@ -127,9 +127,9 @@ raw_ioctl(struct inode *inode, struct file *filp,
 
 static void bind_device(struct raw_config_request *rq)
 {
-       class_device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor));
-       class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor),
-                                     NULL, "raw%d", rq->raw_minor);
+       device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor));
+       device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor),
+                     "raw%d", rq->raw_minor);
 }
 
 /*
@@ -154,7 +154,7 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp,
                        goto out;
                }
 
-               if (rq.raw_minor < 0 || rq.raw_minor >= MAX_RAW_MINORS) {
+               if (rq.raw_minor <= 0 || rq.raw_minor >= MAX_RAW_MINORS) {
                        err = -EINVAL;
                        goto out;
                }
@@ -200,7 +200,7 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp,
                        if (rq.block_major == 0 && rq.block_minor == 0) {
                                /* unbind */
                                rawdev->binding = NULL;
-                               class_device_destroy(raw_class,
+                               device_destroy(raw_class,
                                                MKDEV(RAW_MAJOR, rq.raw_minor));
                        } else {
                                rawdev->binding = bdget(dev);
@@ -238,39 +238,14 @@ out:
        return err;
 }
 
-static ssize_t raw_file_write(struct file *file, const char __user *buf,
-                                  size_t count, loff_t *ppos)
-{
-       struct iovec local_iov = {
-               .iov_base = (char __user *)buf,
-               .iov_len = count
-       };
-
-       return generic_file_write_nolock(file, &local_iov, 1, ppos);
-}
-
-static ssize_t raw_file_aio_write(struct kiocb *iocb, const char __user *buf,
-                                       size_t count, loff_t pos)
-{
-       struct iovec local_iov = {
-               .iov_base = (char __user *)buf,
-               .iov_len = count
-       };
-
-       return generic_file_aio_write_nolock(iocb, &local_iov, 1, &iocb->ki_pos);
-}
-
-
 static const struct file_operations raw_fops = {
-       .read   =       generic_file_read,
+       .read   =       do_sync_read,
        .aio_read =     generic_file_aio_read,
-       .write  =       raw_file_write,
-       .aio_write =    raw_file_aio_write,
+       .write  =       do_sync_write,
+       .aio_write =    generic_file_aio_write_nolock,
        .open   =       raw_open,
        .release=       raw_release,
        .ioctl  =       raw_ioctl,
-       .readv  =       generic_file_readv,
-       .writev =       generic_file_writev,
        .owner  =       THIS_MODULE,
 };
 
@@ -308,7 +283,7 @@ static int __init raw_init(void)
                ret = PTR_ERR(raw_class);
                goto error_region;
        }
-       class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
+       device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), "rawctl");
 
        return 0;
 
@@ -320,7 +295,7 @@ error:
 
 static void __exit raw_exit(void)
 {
-       class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0));
+       device_destroy(raw_class, MKDEV(RAW_MAJOR, 0));
        class_destroy(raw_class);
        cdev_del(&raw_cdev);
        unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS);