diff options
author | Christoph Hellwig <hch@lst.de> | 2006-03-23 06:00:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:09 -0500 |
commit | 6a2900b67652421b51fe25e4b86ecfec742b1f30 (patch) | |
tree | 57fd1f624d9e3fdc4b3e0dd637357cc451204250 /drivers/scsi/sr.c | |
parent | d2c5d4fc07a41a6048b01d3b2930aeff1235fda5 (diff) |
[PATCH] kill cdrom ->dev_ioctl method
Since early 2.4.x all cdrom drivers implement the block_device methods
themselves, so they can handle additional ioctls directly instead of going
through the cdrom layer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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) |