diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 339cb1218eaa..7f3ff500b68e 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -194,6 +194,14 @@ static int blktrans_release(struct inode *i, struct file *f) | |||
194 | return ret; | 194 | return ret; |
195 | } | 195 | } |
196 | 196 | ||
197 | static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo) | ||
198 | { | ||
199 | struct mtd_blktrans_dev *dev = bdev->bd_disk->private_data; | ||
200 | |||
201 | if (dev->tr->getgeo) | ||
202 | return dev->tr->getgeo(dev, geo); | ||
203 | return -ENOTTY; | ||
204 | } | ||
197 | 205 | ||
198 | static int blktrans_ioctl(struct inode *inode, struct file *file, | 206 | static int blktrans_ioctl(struct inode *inode, struct file *file, |
199 | unsigned int cmd, unsigned long arg) | 207 | unsigned int cmd, unsigned long arg) |
@@ -207,22 +215,6 @@ static int blktrans_ioctl(struct inode *inode, struct file *file, | |||
207 | return tr->flush(dev); | 215 | return tr->flush(dev); |
208 | /* The core code did the work, we had nothing to do. */ | 216 | /* The core code did the work, we had nothing to do. */ |
209 | return 0; | 217 | return 0; |
210 | |||
211 | case HDIO_GETGEO: | ||
212 | if (tr->getgeo) { | ||
213 | struct hd_geometry g; | ||
214 | int ret; | ||
215 | |||
216 | memset(&g, 0, sizeof(g)); | ||
217 | ret = tr->getgeo(dev, &g); | ||
218 | if (ret) | ||
219 | return ret; | ||
220 | |||
221 | g.start = get_start_sect(inode->i_bdev); | ||
222 | if (copy_to_user((void __user *)arg, &g, sizeof(g))) | ||
223 | return -EFAULT; | ||
224 | return 0; | ||
225 | } /* else */ | ||
226 | default: | 218 | default: |
227 | return -ENOTTY; | 219 | return -ENOTTY; |
228 | } | 220 | } |
@@ -233,6 +225,7 @@ struct block_device_operations mtd_blktrans_ops = { | |||
233 | .open = blktrans_open, | 225 | .open = blktrans_open, |
234 | .release = blktrans_release, | 226 | .release = blktrans_release, |
235 | .ioctl = blktrans_ioctl, | 227 | .ioctl = blktrans_ioctl, |
228 | .getgeo = blktrans_getgeo, | ||
236 | }; | 229 | }; |
237 | 230 | ||
238 | int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) | 231 | int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) |