diff options
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index f9c1192dc15e..7c80711e18ed 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -71,7 +71,7 @@ MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR); | |||
71 | #define SR_CAPABILITIES \ | 71 | #define SR_CAPABILITIES \ |
72 | (CDC_CLOSE_TRAY|CDC_OPEN_TRAY|CDC_LOCK|CDC_SELECT_SPEED| \ | 72 | (CDC_CLOSE_TRAY|CDC_OPEN_TRAY|CDC_LOCK|CDC_SELECT_SPEED| \ |
73 | CDC_SELECT_DISC|CDC_MULTI_SESSION|CDC_MCN|CDC_MEDIA_CHANGED| \ | 73 | CDC_SELECT_DISC|CDC_MULTI_SESSION|CDC_MCN|CDC_MEDIA_CHANGED| \ |
74 | CDC_PLAY_AUDIO|CDC_RESET|CDC_IOCTLS|CDC_DRIVE_STATUS| \ | 74 | CDC_PLAY_AUDIO|CDC_RESET|CDC_DRIVE_STATUS| \ |
75 | CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_DVD_RAM|CDC_GENERIC_PACKET| \ | 75 | CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_DVD_RAM|CDC_GENERIC_PACKET| \ |
76 | CDC_MRW|CDC_MRW_W|CDC_RAM) | 76 | CDC_MRW|CDC_MRW_W|CDC_RAM) |
77 | 77 | ||
@@ -118,7 +118,6 @@ static struct cdrom_device_ops sr_dops = { | |||
118 | .get_mcn = sr_get_mcn, | 118 | .get_mcn = sr_get_mcn, |
119 | .reset = sr_reset, | 119 | .reset = sr_reset, |
120 | .audio_ioctl = sr_audio_ioctl, | 120 | .audio_ioctl = sr_audio_ioctl, |
121 | .dev_ioctl = sr_dev_ioctl, | ||
122 | .capability = SR_CAPABILITIES, | 121 | .capability = SR_CAPABILITIES, |
123 | .generic_packet = sr_packet, | 122 | .generic_packet = sr_packet, |
124 | }; | 123 | }; |
@@ -456,17 +455,33 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, | |||
456 | { | 455 | { |
457 | struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk); | 456 | struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk); |
458 | struct scsi_device *sdev = cd->device; | 457 | struct scsi_device *sdev = cd->device; |
458 | void __user *argp = (void __user *)arg; | ||
459 | int ret; | ||
459 | 460 | ||
460 | /* | 461 | /* |
461 | * Send SCSI addressing ioctls directly to mid level, send other | 462 | * Send SCSI addressing ioctls directly to mid level, send other |
462 | * ioctls to cdrom/block level. | 463 | * ioctls to cdrom/block level. |
463 | */ | 464 | */ |
464 | switch (cmd) { | 465 | switch (cmd) { |
465 | case SCSI_IOCTL_GET_IDLUN: | 466 | case SCSI_IOCTL_GET_IDLUN: |
466 | case SCSI_IOCTL_GET_BUS_NUMBER: | 467 | case SCSI_IOCTL_GET_BUS_NUMBER: |
467 | return scsi_ioctl(sdev, cmd, (void __user *)arg); | 468 | return scsi_ioctl(sdev, cmd, argp); |
468 | } | 469 | } |
469 | return cdrom_ioctl(file, &cd->cdi, inode, cmd, arg); | 470 | |
471 | ret = cdrom_ioctl(file, &cd->cdi, inode, cmd, arg); | ||
472 | if (ret != ENOSYS) | ||
473 | return ret; | ||
474 | |||
475 | /* | ||
476 | * ENODEV means that we didn't recognise the ioctl, or that we | ||
477 | * cannot execute it in the current device state. In either | ||
478 | * case fall through to scsi_ioctl, which will return ENDOEV again | ||
479 | * if it doesn't recognise the ioctl | ||
480 | */ | ||
481 | ret = scsi_nonblockable_ioctl(sdev, cmd, argp, NULL); | ||
482 | if (ret != -ENODEV) | ||
483 | return ret; | ||
484 | return scsi_ioctl(sdev, cmd, argp); | ||
470 | } | 485 | } |
471 | 486 | ||
472 | static int sr_block_media_changed(struct gendisk *disk) | 487 | static int sr_block_media_changed(struct gendisk *disk) |