aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-09 21:54:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-09 21:54:06 -0400
commit1c54fc1efe6922b4e7ffd591739d72050976ccd6 (patch)
tree0f7f0eaa91fa06bba11da240915eb6a4040b482a /drivers/scsi/sr.c
parentf4f9b8fc73f9aa93744f0e91e18f367d7766f523 (diff)
parentb4c43993f448d0e25fe40690d9e9c81a8ebda623 (diff)
Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "This patch consists of the usual driver updates (qla2xxx, qla4xxx, lpfc, be2iscsi, fnic, ufs, NCR5380) The NCR5380 is the addition to maintained status of a long neglected driver for older hardware. In addition there are a lot of minor fixes and cleanups and some more updates to make scsi mq ready" * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (130 commits) include/scsi/osd_protocol.h: remove unnecessary __constant mvsas: Recognise device/subsystem 9485/9485 as 88SE9485 Revert "be2iscsi: Fix processing cqe for cxn whose endpoint is freed" mptfusion: fix msgContext in mptctl_hp_hostinfo acornscsi: remove linked command support scsi/NCR5380: dprintk macro fusion: Remove use of DEF_SCSI_QCMD fusion: Add free msg frames to the head, not tail of list mpt2sas: Add free smids to the head, not tail of list mpt2sas: Remove use of DEF_SCSI_QCMD mpt2sas: Remove uses of serial_number mpt3sas: Remove use of DEF_SCSI_QCMD mpt3sas: Remove uses of serial_number qla2xxx: Use kmemdup instead of kmalloc + memcpy qla4xxx: Use kmemdup instead of kmalloc + memcpy qla2xxx: fix incorrect debug printk be2iscsi: Bump the driver version be2iscsi: Fix processing cqe for cxn whose endpoint is freed be2iscsi: Fix destroy MCC-CQ before MCC-EQ is destroyed be2iscsi: Fix memory corruption in MBX path ...
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 40d85929aefe..93cbd36c990b 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -79,6 +79,7 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
79static DEFINE_MUTEX(sr_mutex); 79static DEFINE_MUTEX(sr_mutex);
80static int sr_probe(struct device *); 80static int sr_probe(struct device *);
81static int sr_remove(struct device *); 81static int sr_remove(struct device *);
82static int sr_init_command(struct scsi_cmnd *SCpnt);
82static int sr_done(struct scsi_cmnd *); 83static int sr_done(struct scsi_cmnd *);
83static int sr_runtime_suspend(struct device *dev); 84static int sr_runtime_suspend(struct device *dev);
84 85
@@ -94,6 +95,7 @@ static struct scsi_driver sr_template = {
94 .remove = sr_remove, 95 .remove = sr_remove,
95 .pm = &sr_pm_ops, 96 .pm = &sr_pm_ops,
96 }, 97 },
98 .init_command = sr_init_command,
97 .done = sr_done, 99 .done = sr_done,
98}; 100};
99 101
@@ -378,21 +380,14 @@ static int sr_done(struct scsi_cmnd *SCpnt)
378 return good_bytes; 380 return good_bytes;
379} 381}
380 382
381static int sr_prep_fn(struct request_queue *q, struct request *rq) 383static int sr_init_command(struct scsi_cmnd *SCpnt)
382{ 384{
383 int block = 0, this_count, s_size; 385 int block = 0, this_count, s_size;
384 struct scsi_cd *cd; 386 struct scsi_cd *cd;
385 struct scsi_cmnd *SCpnt; 387 struct request *rq = SCpnt->request;
386 struct scsi_device *sdp = q->queuedata; 388 struct scsi_device *sdp = SCpnt->device;
387 int ret; 389 int ret;
388 390
389 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
390 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
391 goto out;
392 } else if (rq->cmd_type != REQ_TYPE_FS) {
393 ret = BLKPREP_KILL;
394 goto out;
395 }
396 ret = scsi_setup_fs_cmnd(sdp, rq); 391 ret = scsi_setup_fs_cmnd(sdp, rq);
397 if (ret != BLKPREP_OK) 392 if (ret != BLKPREP_OK)
398 goto out; 393 goto out;
@@ -517,7 +512,7 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
517 */ 512 */
518 ret = BLKPREP_OK; 513 ret = BLKPREP_OK;
519 out: 514 out:
520 return scsi_prep_return(q, rq, ret); 515 return ret;
521} 516}
522 517
523static int sr_block_open(struct block_device *bdev, fmode_t mode) 518static int sr_block_open(struct block_device *bdev, fmode_t mode)
@@ -718,7 +713,6 @@ static int sr_probe(struct device *dev)
718 713
719 /* FIXME: need to handle a get_capabilities failure properly ?? */ 714 /* FIXME: need to handle a get_capabilities failure properly ?? */
720 get_capabilities(cd); 715 get_capabilities(cd);
721 blk_queue_prep_rq(sdev->request_queue, sr_prep_fn);
722 sr_vendor_init(cd); 716 sr_vendor_init(cd);
723 717
724 disk->driverfs_dev = &sdev->sdev_gendev; 718 disk->driverfs_dev = &sdev->sdev_gendev;
@@ -993,7 +987,6 @@ static int sr_remove(struct device *dev)
993 987
994 scsi_autopm_get_device(cd->device); 988 scsi_autopm_get_device(cd->device);
995 989
996 blk_queue_prep_rq(cd->device->request_queue, scsi_prep_fn);
997 del_gendisk(cd->disk); 990 del_gendisk(cd->disk);
998 991
999 mutex_lock(&sr_ref_mutex); 992 mutex_lock(&sr_ref_mutex);