aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/mtd_blkdevs.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index b00d07c53753..1409f01406f6 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -133,15 +133,12 @@ static void mtd_blktrans_request(struct request_queue *rq)
133} 133}
134 134
135 135
136static int blktrans_open(struct inode *i, struct file *f) 136static int blktrans_open(struct block_device *bdev, fmode_t mode)
137{ 137{
138 struct mtd_blktrans_dev *dev; 138 struct mtd_blktrans_dev *dev = bdev->bd_disk->private_data;
139 struct mtd_blktrans_ops *tr; 139 struct mtd_blktrans_ops *tr = dev->tr;
140 int ret = -ENODEV; 140 int ret = -ENODEV;
141 141
142 dev = i->i_bdev->bd_disk->private_data;
143 tr = dev->tr;
144
145 if (!try_module_get(dev->mtd->owner)) 142 if (!try_module_get(dev->mtd->owner))
146 goto out; 143 goto out;
147 144
@@ -164,15 +161,12 @@ static int blktrans_open(struct inode *i, struct file *f)
164 return ret; 161 return ret;
165} 162}
166 163
167static int blktrans_release(struct inode *i, struct file *f) 164static int blktrans_release(struct gendisk *disk, fmode_t mode)
168{ 165{
169 struct mtd_blktrans_dev *dev; 166 struct mtd_blktrans_dev *dev = disk->private_data;
170 struct mtd_blktrans_ops *tr; 167 struct mtd_blktrans_ops *tr = dev->tr;
171 int ret = 0; 168 int ret = 0;
172 169
173 dev = i->i_bdev->bd_disk->private_data;
174 tr = dev->tr;
175
176 if (tr->release) 170 if (tr->release)
177 ret = tr->release(dev); 171 ret = tr->release(dev);
178 172
@@ -194,10 +188,10 @@ static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo)
194 return -ENOTTY; 188 return -ENOTTY;
195} 189}
196 190
197static int blktrans_ioctl(struct inode *inode, struct file *file, 191static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
198 unsigned int cmd, unsigned long arg) 192 unsigned int cmd, unsigned long arg)
199{ 193{
200 struct mtd_blktrans_dev *dev = inode->i_bdev->bd_disk->private_data; 194 struct mtd_blktrans_dev *dev = bdev->bd_disk->private_data;
201 struct mtd_blktrans_ops *tr = dev->tr; 195 struct mtd_blktrans_ops *tr = dev->tr;
202 196
203 switch (cmd) { 197 switch (cmd) {
@@ -213,9 +207,9 @@ static int blktrans_ioctl(struct inode *inode, struct file *file,
213 207
214static struct block_device_operations mtd_blktrans_ops = { 208static struct block_device_operations mtd_blktrans_ops = {
215 .owner = THIS_MODULE, 209 .owner = THIS_MODULE,
216 .__open = blktrans_open, 210 .open = blktrans_open,
217 .__release = blktrans_release, 211 .release = blktrans_release,
218 .__ioctl = blktrans_ioctl, 212 .locked_ioctl = blktrans_ioctl,
219 .getgeo = blktrans_getgeo, 213 .getgeo = blktrans_getgeo,
220}; 214};
221 215