diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ide-scsi.c | 11 | ||||
-rw-r--r-- | drivers/scsi/sr.c | 37 | ||||
-rw-r--r-- | drivers/scsi/sr.h | 1 | ||||
-rw-r--r-- | drivers/scsi/sr_ioctl.c | 19 |
4 files changed, 32 insertions, 36 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 0cf0e4c7ac0c..39b760a24241 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/ide.h> | 47 | #include <linux/ide.h> |
48 | #include <linux/scatterlist.h> | 48 | #include <linux/scatterlist.h> |
49 | #include <linux/delay.h> | 49 | #include <linux/delay.h> |
50 | #include <linux/mutex.h> | ||
50 | 51 | ||
51 | #include <asm/io.h> | 52 | #include <asm/io.h> |
52 | #include <asm/bitops.h> | 53 | #include <asm/bitops.h> |
@@ -109,7 +110,7 @@ typedef struct ide_scsi_obj { | |||
109 | unsigned long log; /* log flags */ | 110 | unsigned long log; /* log flags */ |
110 | } idescsi_scsi_t; | 111 | } idescsi_scsi_t; |
111 | 112 | ||
112 | static DECLARE_MUTEX(idescsi_ref_sem); | 113 | static DEFINE_MUTEX(idescsi_ref_mutex); |
113 | 114 | ||
114 | #define ide_scsi_g(disk) \ | 115 | #define ide_scsi_g(disk) \ |
115 | container_of((disk)->private_data, struct ide_scsi_obj, driver) | 116 | container_of((disk)->private_data, struct ide_scsi_obj, driver) |
@@ -118,19 +119,19 @@ static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk) | |||
118 | { | 119 | { |
119 | struct ide_scsi_obj *scsi = NULL; | 120 | struct ide_scsi_obj *scsi = NULL; |
120 | 121 | ||
121 | down(&idescsi_ref_sem); | 122 | mutex_lock(&idescsi_ref_mutex); |
122 | scsi = ide_scsi_g(disk); | 123 | scsi = ide_scsi_g(disk); |
123 | if (scsi) | 124 | if (scsi) |
124 | scsi_host_get(scsi->host); | 125 | scsi_host_get(scsi->host); |
125 | up(&idescsi_ref_sem); | 126 | mutex_unlock(&idescsi_ref_mutex); |
126 | return scsi; | 127 | return scsi; |
127 | } | 128 | } |
128 | 129 | ||
129 | static void ide_scsi_put(struct ide_scsi_obj *scsi) | 130 | static void ide_scsi_put(struct ide_scsi_obj *scsi) |
130 | { | 131 | { |
131 | down(&idescsi_ref_sem); | 132 | mutex_lock(&idescsi_ref_mutex); |
132 | scsi_host_put(scsi->host); | 133 | scsi_host_put(scsi->host); |
133 | up(&idescsi_ref_sem); | 134 | mutex_unlock(&idescsi_ref_mutex); |
134 | } | 135 | } |
135 | 136 | ||
136 | static inline idescsi_scsi_t *scsihost_to_idescsi(struct Scsi_Host *host) | 137 | static inline idescsi_scsi_t *scsihost_to_idescsi(struct Scsi_Host *host) |
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) |
diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h index d2bcd99c272f..d65de9621b27 100644 --- a/drivers/scsi/sr.h +++ b/drivers/scsi/sr.h | |||
@@ -55,7 +55,6 @@ int sr_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *); | |||
55 | int sr_reset(struct cdrom_device_info *); | 55 | int sr_reset(struct cdrom_device_info *); |
56 | int sr_select_speed(struct cdrom_device_info *cdi, int speed); | 56 | int sr_select_speed(struct cdrom_device_info *cdi, int speed); |
57 | int sr_audio_ioctl(struct cdrom_device_info *, unsigned int, void *); | 57 | int sr_audio_ioctl(struct cdrom_device_info *, unsigned int, void *); |
58 | int sr_dev_ioctl(struct cdrom_device_info *, unsigned int, unsigned long); | ||
59 | 58 | ||
60 | int sr_is_xa(Scsi_CD *); | 59 | int sr_is_xa(Scsi_CD *); |
61 | 60 | ||
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index b65462f76484..d1268cb46837 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c | |||
@@ -562,22 +562,3 @@ int sr_is_xa(Scsi_CD *cd) | |||
562 | #endif | 562 | #endif |
563 | return is_xa; | 563 | return is_xa; |
564 | } | 564 | } |
565 | |||
566 | int sr_dev_ioctl(struct cdrom_device_info *cdi, | ||
567 | unsigned int cmd, unsigned long arg) | ||
568 | { | ||
569 | Scsi_CD *cd = cdi->handle; | ||
570 | int ret; | ||
571 | |||
572 | ret = scsi_nonblockable_ioctl(cd->device, cmd, | ||
573 | (void __user *)arg, NULL); | ||
574 | /* | ||
575 | * ENODEV means that we didn't recognise the ioctl, or that we | ||
576 | * cannot execute it in the current device state. In either | ||
577 | * case fall through to scsi_ioctl, which will return ENDOEV again | ||
578 | * if it doesn't recognise the ioctl | ||
579 | */ | ||
580 | if (ret != -ENODEV) | ||
581 | return ret; | ||
582 | return scsi_ioctl(cd->device, cmd, (void __user *)arg); | ||
583 | } | ||