diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2007-11-05 04:23:35 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-11 19:22:39 -0500 |
commit | 9e0fe44ddb9ed037188ac711af1e981ac32d3c32 (patch) | |
tree | 830f97b6e359696fd7a939d3b4a5689bbda01b54 /drivers/scsi | |
parent | 9a3dd65bafcfa3338cfb4b6b7e12ff59aca0ac28 (diff) |
[SCSI] NCR5380 family: convert to accessors & !use_sg cleanup
- This patch depends on:
NCR5380: Use scsi_eh API for REQUEST_SENSE invocation
- convert to accessors and !use_sg cleanup
- FIXME: Not sg-chain ready look for ++cmd->SCp.buffer
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/NCR5380.c | 14 | ||||
-rw-r--r-- | drivers/scsi/atari_NCR5380.c | 22 | ||||
-rw-r--r-- | drivers/scsi/sun3_NCR5380.c | 22 |
3 files changed, 29 insertions, 29 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 2597209183d0..1e9f82884f70 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -295,16 +295,16 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd) | |||
295 | * various queues are valid. | 295 | * various queues are valid. |
296 | */ | 296 | */ |
297 | 297 | ||
298 | if (cmd->use_sg) { | 298 | if (scsi_bufflen(cmd)) { |
299 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; | 299 | cmd->SCp.buffer = scsi_sglist(cmd); |
300 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 300 | cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; |
301 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); | 301 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
302 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 302 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
303 | } else { | 303 | } else { |
304 | cmd->SCp.buffer = NULL; | 304 | cmd->SCp.buffer = NULL; |
305 | cmd->SCp.buffers_residual = 0; | 305 | cmd->SCp.buffers_residual = 0; |
306 | cmd->SCp.ptr = (char *) cmd->request_buffer; | 306 | cmd->SCp.ptr = NULL; |
307 | cmd->SCp.this_residual = cmd->request_bufflen; | 307 | cmd->SCp.this_residual = 0; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
@@ -975,14 +975,14 @@ static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
975 | case WRITE_6: | 975 | case WRITE_6: |
976 | case WRITE_10: | 976 | case WRITE_10: |
977 | hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); | 977 | hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); |
978 | hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; | 978 | hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd); |
979 | hostdata->pendingw++; | 979 | hostdata->pendingw++; |
980 | break; | 980 | break; |
981 | case READ: | 981 | case READ: |
982 | case READ_6: | 982 | case READ_6: |
983 | case READ_10: | 983 | case READ_10: |
984 | hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); | 984 | hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); |
985 | hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; | 985 | hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd); |
986 | hostdata->pendingr++; | 986 | hostdata->pendingr++; |
987 | break; | 987 | break; |
988 | } | 988 | } |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index a9680b5e8ac6..d2ca3fa4fcf5 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -511,9 +511,9 @@ static inline void initialize_SCp(Scsi_Cmnd *cmd) | |||
511 | * various queues are valid. | 511 | * various queues are valid. |
512 | */ | 512 | */ |
513 | 513 | ||
514 | if (cmd->use_sg) { | 514 | if (scsi_bufflen(cmd)) { |
515 | cmd->SCp.buffer = (struct scatterlist *)cmd->request_buffer; | 515 | cmd->SCp.buffer = scsi_sglist(cmd); |
516 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 516 | cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; |
517 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); | 517 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
518 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 518 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
519 | /* ++roman: Try to merge some scatter-buffers if they are at | 519 | /* ++roman: Try to merge some scatter-buffers if they are at |
@@ -523,8 +523,8 @@ static inline void initialize_SCp(Scsi_Cmnd *cmd) | |||
523 | } else { | 523 | } else { |
524 | cmd->SCp.buffer = NULL; | 524 | cmd->SCp.buffer = NULL; |
525 | cmd->SCp.buffers_residual = 0; | 525 | cmd->SCp.buffers_residual = 0; |
526 | cmd->SCp.ptr = (char *)cmd->request_buffer; | 526 | cmd->SCp.ptr = NULL; |
527 | cmd->SCp.this_residual = cmd->request_bufflen; | 527 | cmd->SCp.this_residual = 0; |
528 | } | 528 | } |
529 | } | 529 | } |
530 | 530 | ||
@@ -936,21 +936,21 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) | |||
936 | } | 936 | } |
937 | # endif | 937 | # endif |
938 | # ifdef NCR5380_STAT_LIMIT | 938 | # ifdef NCR5380_STAT_LIMIT |
939 | if (cmd->request_bufflen > NCR5380_STAT_LIMIT) | 939 | if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT) |
940 | # endif | 940 | # endif |
941 | switch (cmd->cmnd[0]) { | 941 | switch (cmd->cmnd[0]) { |
942 | case WRITE: | 942 | case WRITE: |
943 | case WRITE_6: | 943 | case WRITE_6: |
944 | case WRITE_10: | 944 | case WRITE_10: |
945 | hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); | 945 | hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); |
946 | hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; | 946 | hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd); |
947 | hostdata->pendingw++; | 947 | hostdata->pendingw++; |
948 | break; | 948 | break; |
949 | case READ: | 949 | case READ: |
950 | case READ_6: | 950 | case READ_6: |
951 | case READ_10: | 951 | case READ_10: |
952 | hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); | 952 | hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); |
953 | hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; | 953 | hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd); |
954 | hostdata->pendingr++; | 954 | hostdata->pendingr++; |
955 | break; | 955 | break; |
956 | } | 956 | } |
@@ -1352,21 +1352,21 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id) | |||
1352 | static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd *cmd) | 1352 | static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd *cmd) |
1353 | { | 1353 | { |
1354 | # ifdef NCR5380_STAT_LIMIT | 1354 | # ifdef NCR5380_STAT_LIMIT |
1355 | if (cmd->request_bufflen > NCR5380_STAT_LIMIT) | 1355 | if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT) |
1356 | # endif | 1356 | # endif |
1357 | switch (cmd->cmnd[0]) { | 1357 | switch (cmd->cmnd[0]) { |
1358 | case WRITE: | 1358 | case WRITE: |
1359 | case WRITE_6: | 1359 | case WRITE_6: |
1360 | case WRITE_10: | 1360 | case WRITE_10: |
1361 | hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); | 1361 | hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); |
1362 | /*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/ | 1362 | /*hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);*/ |
1363 | hostdata->pendingw--; | 1363 | hostdata->pendingw--; |
1364 | break; | 1364 | break; |
1365 | case READ: | 1365 | case READ: |
1366 | case READ_6: | 1366 | case READ_6: |
1367 | case READ_10: | 1367 | case READ_10: |
1368 | hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); | 1368 | hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); |
1369 | /*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/ | 1369 | /*hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);*/ |
1370 | hostdata->pendingr--; | 1370 | hostdata->pendingr--; |
1371 | break; | 1371 | break; |
1372 | } | 1372 | } |
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index 2dcde373b20e..264f14ab5a61 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -515,9 +515,9 @@ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd) | |||
515 | * various queues are valid. | 515 | * various queues are valid. |
516 | */ | 516 | */ |
517 | 517 | ||
518 | if (cmd->use_sg) { | 518 | if (scsi_bufflen(cmd)) { |
519 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; | 519 | cmd->SCp.buffer = scsi_sglist(cmd); |
520 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 520 | cmd->SCp.buffers_residual = scsi_sg_count(cmd) - 1; |
521 | cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer); | 521 | cmd->SCp.ptr = (char *) SGADDR(cmd->SCp.buffer); |
522 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 522 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
523 | 523 | ||
@@ -528,8 +528,8 @@ static __inline__ void initialize_SCp(struct scsi_cmnd *cmd) | |||
528 | } else { | 528 | } else { |
529 | cmd->SCp.buffer = NULL; | 529 | cmd->SCp.buffer = NULL; |
530 | cmd->SCp.buffers_residual = 0; | 530 | cmd->SCp.buffers_residual = 0; |
531 | cmd->SCp.ptr = (char *) cmd->request_buffer; | 531 | cmd->SCp.ptr = NULL; |
532 | cmd->SCp.this_residual = cmd->request_bufflen; | 532 | cmd->SCp.this_residual = 0; |
533 | } | 533 | } |
534 | 534 | ||
535 | } | 535 | } |
@@ -935,7 +935,7 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd, | |||
935 | } | 935 | } |
936 | # endif | 936 | # endif |
937 | # ifdef NCR5380_STAT_LIMIT | 937 | # ifdef NCR5380_STAT_LIMIT |
938 | if (cmd->request_bufflen > NCR5380_STAT_LIMIT) | 938 | if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT) |
939 | # endif | 939 | # endif |
940 | switch (cmd->cmnd[0]) | 940 | switch (cmd->cmnd[0]) |
941 | { | 941 | { |
@@ -943,14 +943,14 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd, | |||
943 | case WRITE_6: | 943 | case WRITE_6: |
944 | case WRITE_10: | 944 | case WRITE_10: |
945 | hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); | 945 | hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); |
946 | hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; | 946 | hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd); |
947 | hostdata->pendingw++; | 947 | hostdata->pendingw++; |
948 | break; | 948 | break; |
949 | case READ: | 949 | case READ: |
950 | case READ_6: | 950 | case READ_6: |
951 | case READ_10: | 951 | case READ_10: |
952 | hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); | 952 | hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); |
953 | hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; | 953 | hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd); |
954 | hostdata->pendingr++; | 954 | hostdata->pendingr++; |
955 | break; | 955 | break; |
956 | } | 956 | } |
@@ -1345,7 +1345,7 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, | |||
1345 | struct scsi_cmnd *cmd) | 1345 | struct scsi_cmnd *cmd) |
1346 | { | 1346 | { |
1347 | # ifdef NCR5380_STAT_LIMIT | 1347 | # ifdef NCR5380_STAT_LIMIT |
1348 | if (cmd->request_bufflen > NCR5380_STAT_LIMIT) | 1348 | if (scsi_bufflen(cmd) > NCR5380_STAT_LIMIT) |
1349 | # endif | 1349 | # endif |
1350 | switch (cmd->cmnd[0]) | 1350 | switch (cmd->cmnd[0]) |
1351 | { | 1351 | { |
@@ -1353,14 +1353,14 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, | |||
1353 | case WRITE_6: | 1353 | case WRITE_6: |
1354 | case WRITE_10: | 1354 | case WRITE_10: |
1355 | hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); | 1355 | hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); |
1356 | /*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/ | 1356 | /*hostdata->bytes_write[cmd->device->id] += scsi_bufflen(cmd);*/ |
1357 | hostdata->pendingw--; | 1357 | hostdata->pendingw--; |
1358 | break; | 1358 | break; |
1359 | case READ: | 1359 | case READ: |
1360 | case READ_6: | 1360 | case READ_6: |
1361 | case READ_10: | 1361 | case READ_10: |
1362 | hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); | 1362 | hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); |
1363 | /*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/ | 1363 | /*hostdata->bytes_read[cmd->device->id] += scsi_bufflen(cmd);*/ |
1364 | hostdata->pendingr--; | 1364 | hostdata->pendingr--; |
1365 | break; | 1365 | break; |
1366 | } | 1366 | } |