提交 af0e2a0a 编写于 作者: A Al Viro

[PATCH] switch mtd_blkdevs

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 a5a1561f
...@@ -133,15 +133,12 @@ static void mtd_blktrans_request(struct request_queue *rq) ...@@ -133,15 +133,12 @@ static void mtd_blktrans_request(struct request_queue *rq)
} }
static int blktrans_open(struct inode *i, struct file *f) static int blktrans_open(struct block_device *bdev, fmode_t mode)
{ {
struct mtd_blktrans_dev *dev; struct mtd_blktrans_dev *dev = bdev->bd_disk->private_data;
struct mtd_blktrans_ops *tr; struct mtd_blktrans_ops *tr = dev->tr;
int ret = -ENODEV; int ret = -ENODEV;
dev = i->i_bdev->bd_disk->private_data;
tr = dev->tr;
if (!try_module_get(dev->mtd->owner)) if (!try_module_get(dev->mtd->owner))
goto out; goto out;
...@@ -164,15 +161,12 @@ static int blktrans_open(struct inode *i, struct file *f) ...@@ -164,15 +161,12 @@ static int blktrans_open(struct inode *i, struct file *f)
return ret; return ret;
} }
static int blktrans_release(struct inode *i, struct file *f) static int blktrans_release(struct gendisk *disk, fmode_t mode)
{ {
struct mtd_blktrans_dev *dev; struct mtd_blktrans_dev *dev = disk->private_data;
struct mtd_blktrans_ops *tr; struct mtd_blktrans_ops *tr = dev->tr;
int ret = 0; int ret = 0;
dev = i->i_bdev->bd_disk->private_data;
tr = dev->tr;
if (tr->release) if (tr->release)
ret = tr->release(dev); ret = tr->release(dev);
...@@ -194,10 +188,10 @@ static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo) ...@@ -194,10 +188,10 @@ static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return -ENOTTY; return -ENOTTY;
} }
static int blktrans_ioctl(struct inode *inode, struct file *file, static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct mtd_blktrans_dev *dev = inode->i_bdev->bd_disk->private_data; struct mtd_blktrans_dev *dev = bdev->bd_disk->private_data;
struct mtd_blktrans_ops *tr = dev->tr; struct mtd_blktrans_ops *tr = dev->tr;
switch (cmd) { switch (cmd) {
...@@ -213,9 +207,9 @@ static int blktrans_ioctl(struct inode *inode, struct file *file, ...@@ -213,9 +207,9 @@ static int blktrans_ioctl(struct inode *inode, struct file *file,
static struct block_device_operations mtd_blktrans_ops = { static struct block_device_operations mtd_blktrans_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.__open = blktrans_open, .open = blktrans_open,
.__release = blktrans_release, .release = blktrans_release,
.__ioctl = blktrans_ioctl, .locked_ioctl = blktrans_ioctl,
.getgeo = blktrans_getgeo, .getgeo = blktrans_getgeo,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册