aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/u14-34f.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-15 19:51:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-15 19:51:54 -0400
commitbc06cffdec85d487c77109dffcd2f285bdc502d3 (patch)
treeadc6e6398243da87e66c56102840597a329183a0 /drivers/scsi/u14-34f.c
parentd3502d7f25b22cfc9762bf1781faa9db1bb3be2e (diff)
parent9413d7b8aa777dd1fc7db9563ce5e80d769fe7b5 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (166 commits) [SCSI] ibmvscsi: convert to use the data buffer accessors [SCSI] dc395x: convert to use the data buffer accessors [SCSI] ncr53c8xx: convert to use the data buffer accessors [SCSI] sym53c8xx: convert to use the data buffer accessors [SCSI] ppa: coding police and printk levels [SCSI] aic7xxx_old: remove redundant GFP_ATOMIC from kmalloc [SCSI] i2o: remove redundant GFP_ATOMIC from kmalloc from device.c [SCSI] remove the dead CYBERSTORMIII_SCSI option [SCSI] don't build scsi_dma_{map,unmap} for !HAS_DMA [SCSI] Clean up scsi_add_lun a bit [SCSI] 53c700: Remove printk, which triggers because of low scsi clock on SNI RMs [SCSI] sni_53c710: Cleanup [SCSI] qla4xxx: Fix underrun/overrun conditions [SCSI] megaraid_mbox: use mutex instead of semaphore [SCSI] aacraid: add 51245, 51645 and 52245 adapters to documentation. [SCSI] qla2xxx: update version to 8.02.00-k1. [SCSI] qla2xxx: add support for NPIV [SCSI] stex: use resid for xfer len information [SCSI] Add Brownie 1200U3P to blacklist [SCSI] scsi.c: convert to use the data buffer accessors ...
Diffstat (limited to 'drivers/scsi/u14-34f.c')
-rw-r--r--drivers/scsi/u14-34f.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 3de08a15de40..9e8232a1f169 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1111,7 +1111,7 @@ static int u14_34f_detect(struct scsi_host_template *tpnt) {
1111static void map_dma(unsigned int i, unsigned int j) { 1111static void map_dma(unsigned int i, unsigned int j) {
1112 unsigned int data_len = 0; 1112 unsigned int data_len = 0;
1113 unsigned int k, count, pci_dir; 1113 unsigned int k, count, pci_dir;
1114 struct scatterlist *sgpnt; 1114 struct scatterlist *sg;
1115 struct mscp *cpp; 1115 struct mscp *cpp;
1116 struct scsi_cmnd *SCpnt; 1116 struct scsi_cmnd *SCpnt;
1117 1117
@@ -1124,33 +1124,28 @@ static void map_dma(unsigned int i, unsigned int j) {
1124 1124
1125 cpp->sense_len = sizeof SCpnt->sense_buffer; 1125 cpp->sense_len = sizeof SCpnt->sense_buffer;
1126 1126
1127 if (!SCpnt->use_sg) { 1127 if (scsi_bufflen(SCpnt)) {
1128 1128 count = scsi_dma_map(SCpnt);
1129 /* If we get here with PCI_DMA_NONE, pci_map_single triggers a BUG() */ 1129 BUG_ON(count < 0);
1130 if (!SCpnt->request_bufflen) pci_dir = PCI_DMA_BIDIRECTIONAL; 1130
1131 1131 scsi_for_each_sg(SCpnt, sg, count, k) {
1132 if (SCpnt->request_buffer) 1132 cpp->sglist[k].address = H2DEV(sg_dma_address(sg));
1133 cpp->data_address = H2DEV(pci_map_single(HD(j)->pdev, 1133 cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg));
1134 SCpnt->request_buffer, SCpnt->request_bufflen, pci_dir)); 1134 data_len += sg->length;
1135 1135 }
1136 cpp->data_len = H2DEV(SCpnt->request_bufflen); 1136
1137 return; 1137 cpp->sg = TRUE;
1138 } 1138 cpp->use_sg = scsi_sg_count(SCpnt);
1139 1139 cpp->data_address =
1140 sgpnt = (struct scatterlist *) SCpnt->request_buffer; 1140 H2DEV(pci_map_single(HD(j)->pdev, cpp->sglist,
1141 count = pci_map_sg(HD(j)->pdev, sgpnt, SCpnt->use_sg, pci_dir); 1141 cpp->use_sg * sizeof(struct sg_list),
1142 1142 pci_dir));
1143 for (k = 0; k < count; k++) { 1143 cpp->data_len = H2DEV(data_len);
1144 cpp->sglist[k].address = H2DEV(sg_dma_address(&sgpnt[k])); 1144
1145 cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(&sgpnt[k])); 1145 } else {
1146 data_len += sgpnt[k].length; 1146 pci_dir = PCI_DMA_BIDIRECTIONAL;
1147 } 1147 cpp->data_len = H2DEV(scsi_bufflen(SCpnt));
1148 1148 }
1149 cpp->sg = TRUE;
1150 cpp->use_sg = SCpnt->use_sg;
1151 cpp->data_address = H2DEV(pci_map_single(HD(j)->pdev, cpp->sglist,
1152 SCpnt->use_sg * sizeof(struct sg_list), pci_dir));
1153 cpp->data_len = H2DEV(data_len);
1154} 1149}
1155 1150
1156static void unmap_dma(unsigned int i, unsigned int j) { 1151static void unmap_dma(unsigned int i, unsigned int j) {
@@ -1165,8 +1160,7 @@ static void unmap_dma(unsigned int i, unsigned int j) {
1165 pci_unmap_single(HD(j)->pdev, DEV2H(cpp->sense_addr), 1160 pci_unmap_single(HD(j)->pdev, DEV2H(cpp->sense_addr),
1166 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE); 1161 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
1167 1162
1168 if (SCpnt->use_sg) 1163 scsi_dma_unmap(SCpnt);
1169 pci_unmap_sg(HD(j)->pdev, SCpnt->request_buffer, SCpnt->use_sg, pci_dir);
1170 1164
1171 if (!DEV2H(cpp->data_len)) pci_dir = PCI_DMA_BIDIRECTIONAL; 1165 if (!DEV2H(cpp->data_len)) pci_dir = PCI_DMA_BIDIRECTIONAL;
1172 1166
@@ -1187,9 +1181,9 @@ static void sync_dma(unsigned int i, unsigned int j) {
1187 pci_dma_sync_single_for_cpu(HD(j)->pdev, DEV2H(cpp->sense_addr), 1181 pci_dma_sync_single_for_cpu(HD(j)->pdev, DEV2H(cpp->sense_addr),
1188 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE); 1182 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
1189 1183
1190 if (SCpnt->use_sg) 1184 if (scsi_sg_count(SCpnt))
1191 pci_dma_sync_sg_for_cpu(HD(j)->pdev, SCpnt->request_buffer, 1185 pci_dma_sync_sg_for_cpu(HD(j)->pdev, scsi_sglist(SCpnt),
1192 SCpnt->use_sg, pci_dir); 1186 scsi_sg_count(SCpnt), pci_dir);
1193 1187
1194 if (!DEV2H(cpp->data_len)) pci_dir = PCI_DMA_BIDIRECTIONAL; 1188 if (!DEV2H(cpp->data_len)) pci_dir = PCI_DMA_BIDIRECTIONAL;
1195 1189