mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
[PATCH] beginning of methods conversion
To keep the size of changesets sane we split the switch by drivers; to keep the damn thing bisectable we do the following: 1) rename the affected methods, add ones with correct prototypes, make (few) callers handle both. That's this changeset. 2) for each driver convert to new methods. *ALL* drivers are converted in this series. 3) kill the old (renamed) methods. Note that it _is_ a flagday; all in-tree drivers are converted and by the end of this series no trace of old methods remain. The only reason why we do that this way is to keep the damn thing bisectable and allow per-driver debugging if anything goes wrong. New methods: open(bdev, mode) release(disk, mode) ioctl(bdev, mode, cmd, arg) /* Called without BKL */ compat_ioctl(bdev, mode, cmd, arg) locked_ioctl(bdev, mode, cmd, arg) /* Called with BKL, legacy */ Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
badf8082c3
commit
d4430d62fa
45 changed files with 167 additions and 131 deletions
|
|
@ -708,17 +708,17 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
|||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
if (disk->fops->unlocked_ioctl)
|
||||
return disk->fops->unlocked_ioctl(file, cmd, arg);
|
||||
if (disk->fops->__unlocked_ioctl)
|
||||
return disk->fops->__unlocked_ioctl(file, cmd, arg);
|
||||
|
||||
if (disk->fops->ioctl) {
|
||||
if (disk->fops->__ioctl) {
|
||||
lock_kernel();
|
||||
ret = disk->fops->ioctl(inode, file, cmd, arg);
|
||||
ret = disk->fops->__ioctl(inode, file, cmd, arg);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -ENOTTY;
|
||||
return __blkdev_driver_ioctl(inode->i_bdev, file->f_mode, cmd, arg);
|
||||
}
|
||||
|
||||
static int compat_blkdev_locked_ioctl(struct inode *inode, struct file *file,
|
||||
|
|
@ -805,10 +805,11 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
|||
|
||||
lock_kernel();
|
||||
ret = compat_blkdev_locked_ioctl(inode, file, bdev, cmd, arg);
|
||||
/* FIXME: why do we assume -> compat_ioctl needs the BKL? */
|
||||
if (ret == -ENOIOCTLCMD && disk->fops->compat_ioctl)
|
||||
ret = disk->fops->compat_ioctl(file, cmd, arg);
|
||||
if (ret == -ENOIOCTLCMD && disk->fops->__compat_ioctl)
|
||||
ret = disk->fops->__compat_ioctl(file, cmd, arg);
|
||||
unlock_kernel();
|
||||
if (ret == -ENOIOCTLCMD && disk->fops->compat_ioctl)
|
||||
ret = disk->fops->compat_ioctl(bdev, file->f_mode, cmd, arg);
|
||||
|
||||
if (ret != -ENOIOCTLCMD)
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -269,17 +269,24 @@ int blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
|||
struct gendisk *disk, unsigned cmd, unsigned long arg)
|
||||
{
|
||||
int ret;
|
||||
if (disk->fops->unlocked_ioctl)
|
||||
return disk->fops->unlocked_ioctl(file, cmd, arg);
|
||||
fmode_t mode = 0;
|
||||
if (file) {
|
||||
mode = file->f_mode;
|
||||
if (file->f_flags & O_NDELAY)
|
||||
mode |= FMODE_NDELAY_NOW;
|
||||
}
|
||||
|
||||
if (disk->fops->ioctl) {
|
||||
if (disk->fops->__unlocked_ioctl)
|
||||
return disk->fops->__unlocked_ioctl(file, cmd, arg);
|
||||
|
||||
if (disk->fops->__ioctl) {
|
||||
lock_kernel();
|
||||
ret = disk->fops->ioctl(inode, file, cmd, arg);
|
||||
ret = disk->fops->__ioctl(inode, file, cmd, arg);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -ENOTTY;
|
||||
return __blkdev_driver_ioctl(inode->i_bdev, mode, cmd, arg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(blkdev_driver_ioctl);
|
||||
|
||||
|
|
@ -295,12 +302,22 @@ int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
|
|||
fake_file.f_path.dentry = &fake_dentry;
|
||||
fake_dentry.d_inode = bdev->bd_inode;
|
||||
|
||||
if (disk->fops->unlocked_ioctl)
|
||||
return disk->fops->unlocked_ioctl(&fake_file, cmd, arg);
|
||||
if (disk->fops->__unlocked_ioctl)
|
||||
return disk->fops->__unlocked_ioctl(&fake_file, cmd, arg);
|
||||
|
||||
if (disk->fops->ioctl) {
|
||||
if (disk->fops->__ioctl) {
|
||||
lock_kernel();
|
||||
ret = disk->fops->ioctl(bdev->bd_inode, &fake_file, cmd, arg);
|
||||
ret = disk->fops->__ioctl(bdev->bd_inode, &fake_file, cmd, arg);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (disk->fops->ioctl)
|
||||
return disk->fops->ioctl(bdev, mode, cmd, arg);
|
||||
|
||||
if (disk->fops->locked_ioctl) {
|
||||
lock_kernel();
|
||||
ret = disk->fops->locked_ioctl(bdev, mode, cmd, arg);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue