aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cdrom')
-rw-r--r--drivers/cdrom/cdrom.c23
-rw-r--r--drivers/cdrom/gdrom.c7
-rw-r--r--drivers/cdrom/viocd.c8
3 files changed, 20 insertions, 18 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index e286eb5d1f6a..d16b02423d61 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -973,7 +973,7 @@ static int cdrom_close_write(struct cdrom_device_info *cdi)
973 * is in their own interest: device control becomes a lot easier 973 * is in their own interest: device control becomes a lot easier
974 * this way. 974 * this way.
975 */ 975 */
976int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp) 976int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t mode)
977{ 977{
978 int ret; 978 int ret;
979 979
@@ -982,14 +982,14 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
982 /* if this was a O_NONBLOCK open and we should honor the flags, 982 /* if this was a O_NONBLOCK open and we should honor the flags,
983 * do a quick open without drive/disc integrity checks. */ 983 * do a quick open without drive/disc integrity checks. */
984 cdi->use_count++; 984 cdi->use_count++;
985 if ((fp->f_mode & FMODE_NDELAY) && (cdi->options & CDO_USE_FFLAGS)) { 985 if ((mode & FMODE_NDELAY) && (cdi->options & CDO_USE_FFLAGS)) {
986 ret = cdi->ops->open(cdi, 1); 986 ret = cdi->ops->open(cdi, 1);
987 } else { 987 } else {
988 ret = open_for_data(cdi); 988 ret = open_for_data(cdi);
989 if (ret) 989 if (ret)
990 goto err; 990 goto err;
991 cdrom_mmc3_profile(cdi); 991 cdrom_mmc3_profile(cdi);
992 if (fp->f_mode & FMODE_WRITE) { 992 if (mode & FMODE_WRITE) {
993 ret = -EROFS; 993 ret = -EROFS;
994 if (cdrom_open_write(cdi)) 994 if (cdrom_open_write(cdi))
995 goto err_release; 995 goto err_release;
@@ -1007,7 +1007,7 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
1007 cdi->name, cdi->use_count); 1007 cdi->name, cdi->use_count);
1008 /* Do this on open. Don't wait for mount, because they might 1008 /* Do this on open. Don't wait for mount, because they might
1009 not be mounting, but opening with O_NONBLOCK */ 1009 not be mounting, but opening with O_NONBLOCK */
1010 check_disk_change(ip->i_bdev); 1010 check_disk_change(bdev);
1011 return 0; 1011 return 0;
1012err_release: 1012err_release:
1013 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) { 1013 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
@@ -1184,7 +1184,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
1184 return 0; 1184 return 0;
1185} 1185}
1186 1186
1187int cdrom_release(struct cdrom_device_info *cdi, struct file *fp) 1187void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode)
1188{ 1188{
1189 struct cdrom_device_ops *cdo = cdi->ops; 1189 struct cdrom_device_ops *cdo = cdi->ops;
1190 int opened_for_data; 1190 int opened_for_data;
@@ -1205,7 +1205,7 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
1205 } 1205 }
1206 1206
1207 opened_for_data = !(cdi->options & CDO_USE_FFLAGS) || 1207 opened_for_data = !(cdi->options & CDO_USE_FFLAGS) ||
1208 !(fp && fp->f_mode & FMODE_NDELAY); 1208 !(mode & FMODE_NDELAY);
1209 1209
1210 /* 1210 /*
1211 * flush cache on last write release 1211 * flush cache on last write release
@@ -1219,7 +1219,6 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
1219 cdi->options & CDO_AUTO_EJECT && CDROM_CAN(CDC_OPEN_TRAY)) 1219 cdi->options & CDO_AUTO_EJECT && CDROM_CAN(CDC_OPEN_TRAY))
1220 cdo->tray_move(cdi, 1); 1220 cdo->tray_move(cdi, 1);
1221 } 1221 }
1222 return 0;
1223} 1222}
1224 1223
1225static int cdrom_read_mech_status(struct cdrom_device_info *cdi, 1224static int cdrom_read_mech_status(struct cdrom_device_info *cdi,
@@ -2662,17 +2661,17 @@ static int cdrom_ioctl_audioctl(struct cdrom_device_info *cdi,
2662 * these days. 2661 * these days.
2663 * ATAPI / SCSI specific code now mainly resides in mmc_ioctl(). 2662 * ATAPI / SCSI specific code now mainly resides in mmc_ioctl().
2664 */ 2663 */
2665int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi, 2664int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,
2666 struct inode *ip, unsigned int cmd, unsigned long arg) 2665 fmode_t mode, unsigned int cmd, unsigned long arg)
2667{ 2666{
2668 void __user *argp = (void __user *)arg; 2667 void __user *argp = (void __user *)arg;
2669 int ret; 2668 int ret;
2670 struct gendisk *disk = ip->i_bdev->bd_disk; 2669 struct gendisk *disk = bdev->bd_disk;
2671 2670
2672 /* 2671 /*
2673 * Try the generic SCSI command ioctl's first. 2672 * Try the generic SCSI command ioctl's first.
2674 */ 2673 */
2675 ret = scsi_cmd_ioctl(disk->queue, disk, file ? file->f_mode : 0, cmd, argp); 2674 ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
2676 if (ret != -ENOTTY) 2675 if (ret != -ENOTTY)
2677 return ret; 2676 return ret;
2678 2677
@@ -2696,7 +2695,7 @@ int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
2696 case CDROM_SELECT_DISC: 2695 case CDROM_SELECT_DISC:
2697 return cdrom_ioctl_select_disc(cdi, arg); 2696 return cdrom_ioctl_select_disc(cdi, arg);
2698 case CDROMRESET: 2697 case CDROMRESET:
2699 return cdrom_ioctl_reset(cdi, ip->i_bdev); 2698 return cdrom_ioctl_reset(cdi, bdev);
2700 case CDROM_LOCKDOOR: 2699 case CDROM_LOCKDOOR:
2701 return cdrom_ioctl_lock_door(cdi, arg); 2700 return cdrom_ioctl_lock_door(cdi, arg);
2702 case CDROM_DEBUG: 2701 case CDROM_DEBUG:
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index d6ba77a2dd7b..0959edf2afdb 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -492,12 +492,12 @@ static struct cdrom_device_ops gdrom_ops = {
492 492
493static int gdrom_bdops_open(struct inode *inode, struct file *file) 493static int gdrom_bdops_open(struct inode *inode, struct file *file)
494{ 494{
495 return cdrom_open(gd.cd_info, inode, file); 495 return cdrom_open(gd.cd_info, inode->i_bdev, file->f_mode);
496} 496}
497 497
498static int gdrom_bdops_release(struct inode *inode, struct file *file) 498static int gdrom_bdops_release(struct inode *inode, struct file *file)
499{ 499{
500 return cdrom_release(gd.cd_info, file); 500 return cdrom_release(gd.cd_info, file ? file->f_mode : 0);
501} 501}
502 502
503static int gdrom_bdops_mediachanged(struct gendisk *disk) 503static int gdrom_bdops_mediachanged(struct gendisk *disk)
@@ -508,7 +508,8 @@ static int gdrom_bdops_mediachanged(struct gendisk *disk)
508static int gdrom_bdops_ioctl(struct inode *inode, struct file *file, 508static int gdrom_bdops_ioctl(struct inode *inode, struct file *file,
509 unsigned cmd, unsigned long arg) 509 unsigned cmd, unsigned long arg)
510{ 510{
511 return cdrom_ioctl(file, gd.cd_info, inode, cmd, arg); 511 return cdrom_ioctl(gd.cd_info, inode->i_bdev,
512 file ? file->f_mode : 0, cmd, arg);
512} 513}
513 514
514static struct block_device_operations gdrom_bdops = { 515static struct block_device_operations gdrom_bdops = {
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 031e0e1a1a3b..abc4079c3f41 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -154,20 +154,22 @@ static const struct file_operations proc_viocd_operations = {
154static int viocd_blk_open(struct inode *inode, struct file *file) 154static int viocd_blk_open(struct inode *inode, struct file *file)
155{ 155{
156 struct disk_info *di = inode->i_bdev->bd_disk->private_data; 156 struct disk_info *di = inode->i_bdev->bd_disk->private_data;
157 return cdrom_open(&di->viocd_info, inode, file); 157 return cdrom_open(&di->viocd_info, inode->i_bdev, file->f_mode);
158} 158}
159 159
160static int viocd_blk_release(struct inode *inode, struct file *file) 160static int viocd_blk_release(struct inode *inode, struct file *file)
161{ 161{
162 struct disk_info *di = inode->i_bdev->bd_disk->private_data; 162 struct disk_info *di = inode->i_bdev->bd_disk->private_data;
163 return cdrom_release(&di->viocd_info, file); 163 cdrom_release(&di->viocd_info, file ? file->f_mode : 0);
164 return 0;
164} 165}
165 166
166static int viocd_blk_ioctl(struct inode *inode, struct file *file, 167static int viocd_blk_ioctl(struct inode *inode, struct file *file,
167 unsigned cmd, unsigned long arg) 168 unsigned cmd, unsigned long arg)
168{ 169{
169 struct disk_info *di = inode->i_bdev->bd_disk->private_data; 170 struct disk_info *di = inode->i_bdev->bd_disk->private_data;
170 return cdrom_ioctl(file, &di->viocd_info, inode, cmd, arg); 171 return cdrom_ioctl(&di->viocd_info, inode->i_bdev,
172 file ? file->f_mode : 0, cmd, arg);
171} 173}
172 174
173static int viocd_blk_media_changed(struct gendisk *disk) 175static int viocd_blk_media_changed(struct gendisk *disk)