]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/block/xd.c
block: autoconvert trivial BKL users to private mutex
[net-next-2.6.git] / drivers / block / xd.c
index 18a80ff57ce89f821fd3f5910a09207b7f5db605..4abd2bcd20fb8b069362e2684c8eed2dcd6a0620 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/init.h>
 #include <linux/wait.h>
 #include <linux/blkdev.h>
+#include <linux/mutex.h>
 #include <linux/blkpg.h>
 #include <linux/delay.h>
 #include <linux/io.h>
@@ -57,6 +58,7 @@
 
 #include "xd.h"
 
+static DEFINE_MUTEX(xd_mutex);
 static void __init do_xd_setup (int *integers);
 #ifdef MODULE
 static int xd[5] = { -1,-1,-1,-1, };
@@ -133,7 +135,7 @@ static int xd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
 
 static const struct block_device_operations xd_fops = {
        .owner  = THIS_MODULE,
-       .locked_ioctl   = xd_ioctl,
+       .ioctl  = xd_ioctl,
        .getgeo = xd_getgeo,
 };
 static DECLARE_WAIT_QUEUE_HEAD(xd_wait_int);
@@ -322,7 +324,7 @@ static void do_xd_request (struct request_queue * q)
                int res = -EIO;
                int retry;
 
-               if (!blk_fs_request(req))
+               if (req->cmd_type != REQ_TYPE_FS)
                        goto done;
                if (block + count > get_capacity(req->rq_disk))
                        goto done;
@@ -347,7 +349,7 @@ static int xd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 }
 
 /* xd_ioctl: handle device ioctl's */
-static int xd_ioctl(struct block_device *bdev, fmode_t mode, u_int cmd, u_long arg)
+static int xd_locked_ioctl(struct block_device *bdev, fmode_t mode, u_int cmd, u_long arg)
 {
        switch (cmd) {
                case HDIO_SET_DMA:
@@ -375,6 +377,18 @@ static int xd_ioctl(struct block_device *bdev, fmode_t mode, u_int cmd, u_long a
        }
 }
 
+static int xd_ioctl(struct block_device *bdev, fmode_t mode,
+                            unsigned int cmd, unsigned long param)
+{
+       int ret;
+
+       mutex_lock(&xd_mutex);
+       ret = xd_locked_ioctl(bdev, mode, cmd, param);
+       mutex_unlock(&xd_mutex);
+
+       return ret;
+}
+
 /* xd_readwrite: handle a read/write request */
 static int xd_readwrite (u_char operation,XD_INFO *p,char *buffer,u_int block,u_int count)
 {