aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-06-28 10:41:43 -0400
committerChristoph Hellwig <hch@lst.de>2014-07-17 16:11:41 -0400
commit5158a899d8f24f74cad29b6aaad2b0f86499e5d5 (patch)
treef5faad5530e2e0e38dcd0bc75777da075976fe29 /drivers/scsi/scsi_lib.c
parent3868cf8ea70a57fc3f927872d8296f287ce4b96a (diff)
scsi: set sc_data_direction in common code
The data direction fiel in the SCSI command is derived only from the block request structure. Move setting it up into common code instead of duplicating it in the ULDs. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2afb96b801cb..4e15a3a5ad29 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1068,13 +1068,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
1068 } 1068 }
1069 1069
1070 cmd->cmd_len = req->cmd_len; 1070 cmd->cmd_len = req->cmd_len;
1071 if (!blk_rq_bytes(req))
1072 cmd->sc_data_direction = DMA_NONE;
1073 else if (rq_data_dir(req) == WRITE)
1074 cmd->sc_data_direction = DMA_TO_DEVICE;
1075 else
1076 cmd->sc_data_direction = DMA_FROM_DEVICE;
1077
1078 cmd->transfersize = blk_rq_bytes(req); 1071 cmd->transfersize = blk_rq_bytes(req);
1079 cmd->allowed = req->retries; 1072 cmd->allowed = req->retries;
1080 return BLKPREP_OK; 1073 return BLKPREP_OK;
@@ -1203,6 +1196,13 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1203 goto out; 1196 goto out;
1204 } 1197 }
1205 1198
1199 if (!blk_rq_bytes(req))
1200 cmd->sc_data_direction = DMA_NONE;
1201 else if (rq_data_dir(req) == WRITE)
1202 cmd->sc_data_direction = DMA_TO_DEVICE;
1203 else
1204 cmd->sc_data_direction = DMA_FROM_DEVICE;
1205
1206 switch (req->cmd_type) { 1206 switch (req->cmd_type) {
1207 case REQ_TYPE_FS: 1207 case REQ_TYPE_FS:
1208 ret = scsi_setup_fs_cmnd(sdev, req); 1208 ret = scsi_setup_fs_cmnd(sdev, req);