diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-16 10:34:00 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-21 07:48:25 -0400 |
commit | b2f21e057dfbaa12acca1e79d9aeb3d9169d2e2e (patch) | |
tree | 4041cfafeb6ec5976bbdff375813ad1826d9d7e6 | |
parent | 488ca606f1277ae183c9c6a328adaecae54e1930 (diff) |
[PATCH] switch ide-gd
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/ide/ide-gd.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index d118bbed7cd3..7b6662854374 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -169,9 +169,9 @@ static ide_driver_t ide_gd_driver = { | |||
169 | #endif | 169 | #endif |
170 | }; | 170 | }; |
171 | 171 | ||
172 | static int ide_gd_open(struct inode *inode, struct file *filp) | 172 | static int ide_gd_open(struct block_device *bdev, fmode_t mode) |
173 | { | 173 | { |
174 | struct gendisk *disk = inode->i_bdev->bd_disk; | 174 | struct gendisk *disk = bdev->bd_disk; |
175 | struct ide_disk_obj *idkp; | 175 | struct ide_disk_obj *idkp; |
176 | ide_drive_t *drive; | 176 | ide_drive_t *drive; |
177 | int ret = 0; | 177 | int ret = 0; |
@@ -197,12 +197,12 @@ static int ide_gd_open(struct inode *inode, struct file *filp) | |||
197 | * unreadable disk, so that we can get the format capacity | 197 | * unreadable disk, so that we can get the format capacity |
198 | * of the drive or begin the format - Sam | 198 | * of the drive or begin the format - Sam |
199 | */ | 199 | */ |
200 | if (ret && (filp->f_mode & FMODE_NDELAY) == 0) { | 200 | if (ret && (mode & FMODE_NDELAY) == 0) { |
201 | ret = -EIO; | 201 | ret = -EIO; |
202 | goto out_put_idkp; | 202 | goto out_put_idkp; |
203 | } | 203 | } |
204 | 204 | ||
205 | if ((drive->dev_flags & IDE_DFLAG_WP) && (filp->f_mode & FMODE_WRITE)) { | 205 | if ((drive->dev_flags & IDE_DFLAG_WP) && (mode & FMODE_WRITE)) { |
206 | ret = -EROFS; | 206 | ret = -EROFS; |
207 | goto out_put_idkp; | 207 | goto out_put_idkp; |
208 | } | 208 | } |
@@ -214,7 +214,7 @@ static int ide_gd_open(struct inode *inode, struct file *filp) | |||
214 | */ | 214 | */ |
215 | drive->disk_ops->set_doorlock(drive, disk, 1); | 215 | drive->disk_ops->set_doorlock(drive, disk, 1); |
216 | drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED; | 216 | drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED; |
217 | check_disk_change(inode->i_bdev); | 217 | check_disk_change(bdev); |
218 | } else if (drive->dev_flags & IDE_DFLAG_FORMAT_IN_PROGRESS) { | 218 | } else if (drive->dev_flags & IDE_DFLAG_FORMAT_IN_PROGRESS) { |
219 | ret = -EBUSY; | 219 | ret = -EBUSY; |
220 | goto out_put_idkp; | 220 | goto out_put_idkp; |
@@ -227,9 +227,8 @@ out_put_idkp: | |||
227 | return ret; | 227 | return ret; |
228 | } | 228 | } |
229 | 229 | ||
230 | static int ide_gd_release(struct inode *inode, struct file *filp) | 230 | static int ide_gd_release(struct gendisk *disk, fmode_t mode) |
231 | { | 231 | { |
232 | struct gendisk *disk = inode->i_bdev->bd_disk; | ||
233 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 232 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
234 | ide_drive_t *drive = idkp->drive; | 233 | ide_drive_t *drive = idkp->drive; |
235 | 234 | ||
@@ -286,21 +285,20 @@ static int ide_gd_revalidate_disk(struct gendisk *disk) | |||
286 | return 0; | 285 | return 0; |
287 | } | 286 | } |
288 | 287 | ||
289 | static int ide_gd_ioctl(struct inode *inode, struct file *file, | 288 | static int ide_gd_ioctl(struct block_device *bdev, fmode_t mode, |
290 | unsigned int cmd, unsigned long arg) | 289 | unsigned int cmd, unsigned long arg) |
291 | { | 290 | { |
292 | struct block_device *bdev = inode->i_bdev; | ||
293 | struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj); | 291 | struct ide_disk_obj *idkp = ide_drv_g(bdev->bd_disk, ide_disk_obj); |
294 | ide_drive_t *drive = idkp->drive; | 292 | ide_drive_t *drive = idkp->drive; |
295 | 293 | ||
296 | return drive->disk_ops->ioctl(drive, bdev, file ? file->f_mode : 0, cmd, arg); | 294 | return drive->disk_ops->ioctl(drive, bdev, mode, cmd, arg); |
297 | } | 295 | } |
298 | 296 | ||
299 | static struct block_device_operations ide_gd_ops = { | 297 | static struct block_device_operations ide_gd_ops = { |
300 | .owner = THIS_MODULE, | 298 | .owner = THIS_MODULE, |
301 | .__open = ide_gd_open, | 299 | .open = ide_gd_open, |
302 | .__release = ide_gd_release, | 300 | .release = ide_gd_release, |
303 | .__ioctl = ide_gd_ioctl, | 301 | .locked_ioctl = ide_gd_ioctl, |
304 | .getgeo = ide_gd_getgeo, | 302 | .getgeo = ide_gd_getgeo, |
305 | .media_changed = ide_gd_media_changed, | 303 | .media_changed = ide_gd_media_changed, |
306 | .revalidate_disk = ide_gd_revalidate_disk | 304 | .revalidate_disk = ide_gd_revalidate_disk |