block: remove i_bdev
[linux-2.6-microblaze.git] / block / ioctl.c
index 04255dc..a6d8171 100644 (file)
@@ -35,15 +35,6 @@ static int blkpg_do_ioctl(struct block_device *bdev,
        start = p.start >> SECTOR_SHIFT;
        length = p.length >> SECTOR_SHIFT;
 
-       /* check for fit in a hd_struct */
-       if (sizeof(sector_t) < sizeof(long long)) {
-               long pstart = start, plength = length;
-
-               if (pstart != start || plength != length || pstart < 0 ||
-                   plength < 0 || p.pno > 65535)
-                       return -EINVAL;
-       }
-
        switch (op) {
        case BLKPG_ADD_PARTITION:
                /* check if partition is aligned to blocksize */
@@ -219,23 +210,6 @@ static int compat_put_ulong(compat_ulong_t __user *argp, compat_ulong_t val)
 }
 #endif
 
-int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
-                       unsigned cmd, unsigned long arg)
-{
-       struct gendisk *disk = bdev->bd_disk;
-
-       if (disk->fops->ioctl)
-               return disk->fops->ioctl(bdev, mode, cmd, arg);
-
-       return -ENOTTY;
-}
-/*
- * For the record: _GPL here is only because somebody decided to slap it
- * on the previous export.  Sheer idiocy, since it wasn't copyrightable
- * at all and could be open-coded without any exports by anybody who cares.
- */
-EXPORT_SYMBOL_GPL(__blkdev_driver_ioctl);
-
 #ifdef CONFIG_COMPAT
 /*
  * This is the equivalent of compat_ptr_ioctl(), to be used by block
@@ -594,10 +568,12 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
        }
 
        ret = blkdev_common_ioctl(bdev, mode, cmd, arg, argp);
-       if (ret == -ENOIOCTLCMD)
-               return __blkdev_driver_ioctl(bdev, mode, cmd, arg);
+       if (ret != -ENOIOCTLCMD)
+               return ret;
 
-       return ret;
+       if (!bdev->bd_disk->fops->ioctl)
+               return -ENOTTY;
+       return bdev->bd_disk->fops->ioctl(bdev, mode, cmd, arg);
 }
 EXPORT_SYMBOL_GPL(blkdev_ioctl); /* for /dev/raw */
 
@@ -614,8 +590,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 {
        int ret;
        void __user *argp = compat_ptr(arg);
-       struct inode *inode = file->f_mapping->host;
-       struct block_device *bdev = inode->i_bdev;
+       struct block_device *bdev = I_BDEV(file->f_mapping->host);
        struct gendisk *disk = bdev->bd_disk;
        fmode_t mode = file->f_mode;
        loff_t size;