[PATCH] switch ide-cd

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2008-03-02 10:26:23 -05:00
parent 4e379ae6a6
commit 488ca606f1

View File

@ -2089,17 +2089,15 @@ static ide_driver_t ide_cdrom_driver = {
#endif #endif
}; };
static int idecd_open(struct inode *inode, struct file *file) static int idecd_open(struct block_device *bdev, fmode_t mode)
{ {
struct gendisk *disk = inode->i_bdev->bd_disk; struct cdrom_info *info = ide_cd_get(bdev->bd_disk);
struct cdrom_info *info;
int rc = -ENOMEM; int rc = -ENOMEM;
info = ide_cd_get(disk);
if (!info) if (!info)
return -ENXIO; return -ENXIO;
rc = cdrom_open(&info->devinfo, inode->i_bdev, file->f_mode); rc = cdrom_open(&info->devinfo, bdev, mode);
if (rc < 0) if (rc < 0)
ide_cd_put(info); ide_cd_put(info);
@ -2107,12 +2105,11 @@ static int idecd_open(struct inode *inode, struct file *file)
return rc; return rc;
} }
static int idecd_release(struct inode *inode, struct file *file) static int idecd_release(struct gendisk *disk, fmode_t mode)
{ {
struct gendisk *disk = inode->i_bdev->bd_disk;
struct cdrom_info *info = ide_drv_g(disk, cdrom_info); struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
cdrom_release(&info->devinfo, file ? file->f_mode : 0); cdrom_release(&info->devinfo, mode);
ide_cd_put(info); ide_cd_put(info);
@ -2158,10 +2155,9 @@ static int idecd_get_spindown(struct cdrom_device_info *cdi, unsigned long arg)
return 0; return 0;
} }
static int idecd_ioctl(struct inode *inode, struct file *file, static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct block_device *bdev = inode->i_bdev;
struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info); struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
int err; int err;
@ -2176,8 +2172,7 @@ static int idecd_ioctl(struct inode *inode, struct file *file,
err = generic_ide_ioctl(info->drive, bdev, cmd, arg); err = generic_ide_ioctl(info->drive, bdev, cmd, arg);
if (err == -EINVAL) if (err == -EINVAL)
err = cdrom_ioctl(&info->devinfo, bdev, err = cdrom_ioctl(&info->devinfo, bdev, mode, cmd, arg);
file ? file->f_mode : 0, cmd, arg);
return err; return err;
} }
@ -2200,9 +2195,9 @@ static int idecd_revalidate_disk(struct gendisk *disk)
static struct block_device_operations idecd_ops = { static struct block_device_operations idecd_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.__open = idecd_open, .open = idecd_open,
.__release = idecd_release, .release = idecd_release,
.__ioctl = idecd_ioctl, .locked_ioctl = idecd_ioctl,
.media_changed = idecd_media_changed, .media_changed = idecd_media_changed,
.revalidate_disk = idecd_revalidate_disk .revalidate_disk = idecd_revalidate_disk
}; };