include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / char / raw.c
index 47b8cf2..d331c59 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/device.h>
 #include <linux/mutex.h>
 #include <linux/smp_lock.h>
+#include <linux/gfp.h>
 
 #include <asm/uaccess.h>
 
@@ -65,13 +66,13 @@ static int raw_open(struct inode *inode, struct file *filp)
        if (!bdev)
                goto out;
        igrab(bdev->bd_inode);
-       err = blkdev_get(bdev, filp->f_mode, 0);
+       err = blkdev_get(bdev, filp->f_mode);
        if (err)
                goto out;
        err = bd_claim(bdev, raw_open);
        if (err)
                goto out1;
-       err = set_blocksize(bdev, bdev_hardsect_size(bdev));
+       err = set_blocksize(bdev, bdev_logical_block_size(bdev));
        if (err)
                goto out2;
        filp->f_flags |= O_DIRECT;
@@ -87,9 +88,10 @@ static int raw_open(struct inode *inode, struct file *filp)
 out2:
        bd_release(bdev);
 out1:
-       blkdev_put(bdev);
+       blkdev_put(bdev, filp->f_mode);
 out:
        mutex_unlock(&raw_mutex);
+       unlock_kernel();
        return err;
 }
 
@@ -112,7 +114,7 @@ static int raw_release(struct inode *inode, struct file *filp)
        mutex_unlock(&raw_mutex);
 
        bd_release(bdev);
-       blkdev_put(bdev);
+       blkdev_put(bdev, filp->f_mode);
        return 0;
 }
 
@@ -125,14 +127,14 @@ raw_ioctl(struct inode *inode, struct file *filp,
 {
        struct block_device *bdev = filp->private_data;
 
-       return blkdev_ioctl(bdev->bd_inode, NULL, command, arg);
+       return blkdev_ioctl(bdev, 0, command, arg);
 }
 
 static void bind_device(struct raw_config_request *rq)
 {
        device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor));
-       device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor),
-                             NULL, "raw%d", rq->raw_minor);
+       device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), NULL,
+                     "raw%d", rq->raw_minor);
 }
 
 /*
@@ -245,7 +247,7 @@ static const struct file_operations raw_fops = {
        .read   =       do_sync_read,
        .aio_read =     generic_file_aio_read,
        .write  =       do_sync_write,
-       .aio_write =    generic_file_aio_write_nolock,
+       .aio_write =    blkdev_aio_write,
        .open   =       raw_open,
        .release=       raw_release,
        .ioctl  =       raw_ioctl,
@@ -260,6 +262,11 @@ static const struct file_operations raw_ctl_fops = {
 
 static struct cdev raw_cdev;
 
+static char *raw_devnode(struct device *dev, mode_t *mode)
+{
+       return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev));
+}
+
 static int __init raw_init(void)
 {
        dev_t dev = MKDEV(RAW_MAJOR, 0);
@@ -283,8 +290,8 @@ static int __init raw_init(void)
                ret = PTR_ERR(raw_class);
                goto error_region;
        }
-       device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL,
-                             "rawctl");
+       raw_class->devnode = raw_devnode;
+       device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
 
        return 0;