diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2008-02-27 18:31:20 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-07 13:15:39 -0400 |
commit | d35055a0f2637f29f95001a67b464fe833b09ebc (patch) | |
tree | e0da638057c2ef7bb794b5eaa031425c07e8118b /drivers/scsi/gdth.c | |
parent | 68066c3ed14b529331bc2ff12470e9ca1cae5c3f (diff) |
[SCSI] gdth: remove command accessors
These are no longer necessary.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Tested-by: Joerg Dorchain: <joerg@dorchain.net>
Tested-by: Stefan Priebe <s.priebe@allied-internet.ag>
Tested-by: Jon Chelton <jchelton@ffpglobal.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/gdth.c')
-rw-r--r-- | drivers/scsi/gdth.c | 73 |
1 files changed, 14 insertions, 59 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 4941997c484e..c6d6e7c6559a 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -85,10 +85,10 @@ | |||
85 | 85 | ||
86 | /* The meaning of the Scsi_Pointer members in this driver is as follows: | 86 | /* The meaning of the Scsi_Pointer members in this driver is as follows: |
87 | * ptr: Chaining | 87 | * ptr: Chaining |
88 | * this_residual: gdth_bufflen | 88 | * this_residual: unused |
89 | * buffer: gdth_sglist | 89 | * buffer: unused |
90 | * dma_handle: unused | 90 | * dma_handle: unused |
91 | * buffers_residual: gdth_sg_count | 91 | * buffers_residual: unused |
92 | * Status: unused | 92 | * Status: unused |
93 | * Message: unused | 93 | * Message: unused |
94 | * have_data_in: unused | 94 | * have_data_in: unused |
@@ -372,47 +372,6 @@ static const struct file_operations gdth_fops = { | |||
372 | .release = gdth_close, | 372 | .release = gdth_close, |
373 | }; | 373 | }; |
374 | 374 | ||
375 | /* | ||
376 | * gdth scsi_command access wrappers. | ||
377 | * below 6 functions are used throughout the driver to access scsi_command's | ||
378 | * io parameters. The reason we do not use the regular accessors from | ||
379 | * scsi_cmnd.h is because of gdth_execute(). Since it is unrecommended for | ||
380 | * llds to directly set scsi_cmnd's IO members. This driver will use SCp | ||
381 | * members for IO parameters, and will copy scsi_cmnd's members to Scp | ||
382 | * members in queuecommand. For internal commands through gdth_execute() | ||
383 | * SCp's members will be set directly. | ||
384 | */ | ||
385 | static inline unsigned gdth_bufflen(struct scsi_cmnd *cmd) | ||
386 | { | ||
387 | return (unsigned)cmd->SCp.this_residual; | ||
388 | } | ||
389 | |||
390 | static inline void gdth_set_bufflen(struct scsi_cmnd *cmd, unsigned bufflen) | ||
391 | { | ||
392 | cmd->SCp.this_residual = bufflen; | ||
393 | } | ||
394 | |||
395 | static inline unsigned gdth_sg_count(struct scsi_cmnd *cmd) | ||
396 | { | ||
397 | return (unsigned)cmd->SCp.buffers_residual; | ||
398 | } | ||
399 | |||
400 | static inline void gdth_set_sg_count(struct scsi_cmnd *cmd, unsigned sg_count) | ||
401 | { | ||
402 | cmd->SCp.buffers_residual = sg_count; | ||
403 | } | ||
404 | |||
405 | static inline struct scatterlist *gdth_sglist(struct scsi_cmnd *cmd) | ||
406 | { | ||
407 | return cmd->SCp.buffer; | ||
408 | } | ||
409 | |||
410 | static inline void gdth_set_sglist(struct scsi_cmnd *cmd, | ||
411 | struct scatterlist *sglist) | ||
412 | { | ||
413 | cmd->SCp.buffer = sglist; | ||
414 | } | ||
415 | |||
416 | #include "gdth_proc.h" | 375 | #include "gdth_proc.h" |
417 | #include "gdth_proc.c" | 376 | #include "gdth_proc.c" |
418 | 377 | ||
@@ -2337,12 +2296,12 @@ static void gdth_next(gdth_ha_str *ha) | |||
2337 | static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, | 2296 | static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, |
2338 | char *buffer, ushort count) | 2297 | char *buffer, ushort count) |
2339 | { | 2298 | { |
2340 | ushort cpcount,i, max_sg = gdth_sg_count(scp); | 2299 | ushort cpcount,i, max_sg = scsi_sg_count(scp); |
2341 | ushort cpsum,cpnow; | 2300 | ushort cpsum,cpnow; |
2342 | struct scatterlist *sl; | 2301 | struct scatterlist *sl; |
2343 | char *address; | 2302 | char *address; |
2344 | 2303 | ||
2345 | cpcount = min_t(ushort, count, gdth_bufflen(scp)); | 2304 | cpcount = min_t(ushort, count, scsi_bufflen(scp)); |
2346 | 2305 | ||
2347 | if (cpcount) { | 2306 | if (cpcount) { |
2348 | cpsum=0; | 2307 | cpsum=0; |
@@ -2350,7 +2309,7 @@ static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, | |||
2350 | unsigned long flags; | 2309 | unsigned long flags; |
2351 | cpnow = (ushort)sl->length; | 2310 | cpnow = (ushort)sl->length; |
2352 | TRACE(("copy_internal() now %d sum %d count %d %d\n", | 2311 | TRACE(("copy_internal() now %d sum %d count %d %d\n", |
2353 | cpnow, cpsum, cpcount, gdth_bufflen(scp))); | 2312 | cpnow, cpsum, cpcount, scsi_bufflen(scp))); |
2354 | if (cpsum+cpnow > cpcount) | 2313 | if (cpsum+cpnow > cpcount) |
2355 | cpnow = cpcount - cpsum; | 2314 | cpnow = cpcount - cpsum; |
2356 | cpsum += cpnow; | 2315 | cpsum += cpnow; |
@@ -2573,10 +2532,10 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive) | |||
2573 | cmdp->u.cache.BlockCnt = blockcnt; | 2532 | cmdp->u.cache.BlockCnt = blockcnt; |
2574 | } | 2533 | } |
2575 | 2534 | ||
2576 | if (gdth_bufflen(scp)) { | 2535 | if (scsi_bufflen(scp)) { |
2577 | cmndinfo->dma_dir = (read_write == 1 ? | 2536 | cmndinfo->dma_dir = (read_write == 1 ? |
2578 | PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); | 2537 | PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); |
2579 | sgcnt = pci_map_sg(ha->pdev, gdth_sglist(scp), gdth_sg_count(scp), | 2538 | sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), |
2580 | cmndinfo->dma_dir); | 2539 | cmndinfo->dma_dir); |
2581 | if (mode64) { | 2540 | if (mode64) { |
2582 | struct scatterlist *sl; | 2541 | struct scatterlist *sl; |
@@ -2723,7 +2682,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b) | |||
2723 | cmdp->u.raw64.lun = l; | 2682 | cmdp->u.raw64.lun = l; |
2724 | cmdp->u.raw64.bus = b; | 2683 | cmdp->u.raw64.bus = b; |
2725 | cmdp->u.raw64.priority = 0; | 2684 | cmdp->u.raw64.priority = 0; |
2726 | cmdp->u.raw64.sdlen = gdth_bufflen(scp); | 2685 | cmdp->u.raw64.sdlen = scsi_bufflen(scp); |
2727 | cmdp->u.raw64.sense_len = 16; | 2686 | cmdp->u.raw64.sense_len = 16; |
2728 | cmdp->u.raw64.sense_data = sense_paddr; | 2687 | cmdp->u.raw64.sense_data = sense_paddr; |
2729 | cmdp->u.raw64.direction = | 2688 | cmdp->u.raw64.direction = |
@@ -2740,7 +2699,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b) | |||
2740 | cmdp->u.raw.bus = b; | 2699 | cmdp->u.raw.bus = b; |
2741 | cmdp->u.raw.priority = 0; | 2700 | cmdp->u.raw.priority = 0; |
2742 | cmdp->u.raw.link_p = 0; | 2701 | cmdp->u.raw.link_p = 0; |
2743 | cmdp->u.raw.sdlen = gdth_bufflen(scp); | 2702 | cmdp->u.raw.sdlen = scsi_bufflen(scp); |
2744 | cmdp->u.raw.sense_len = 16; | 2703 | cmdp->u.raw.sense_len = 16; |
2745 | cmdp->u.raw.sense_data = sense_paddr; | 2704 | cmdp->u.raw.sense_data = sense_paddr; |
2746 | cmdp->u.raw.direction = | 2705 | cmdp->u.raw.direction = |
@@ -2749,9 +2708,9 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b) | |||
2749 | cmdp->u.raw.sg_ranz = 0; | 2708 | cmdp->u.raw.sg_ranz = 0; |
2750 | } | 2709 | } |
2751 | 2710 | ||
2752 | if (gdth_bufflen(scp)) { | 2711 | if (scsi_bufflen(scp)) { |
2753 | cmndinfo->dma_dir = PCI_DMA_BIDIRECTIONAL; | 2712 | cmndinfo->dma_dir = PCI_DMA_BIDIRECTIONAL; |
2754 | sgcnt = pci_map_sg(ha->pdev, gdth_sglist(scp), gdth_sg_count(scp), | 2713 | sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), |
2755 | cmndinfo->dma_dir); | 2714 | cmndinfo->dma_dir); |
2756 | if (mode64) { | 2715 | if (mode64) { |
2757 | struct scatterlist *sl; | 2716 | struct scatterlist *sl; |
@@ -3372,8 +3331,8 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index, | |||
3372 | /* retry */ | 3331 | /* retry */ |
3373 | return 2; | 3332 | return 2; |
3374 | } | 3333 | } |
3375 | if (gdth_bufflen(scp)) | 3334 | if (scsi_bufflen(scp)) |
3376 | pci_unmap_sg(ha->pdev, gdth_sglist(scp), gdth_sg_count(scp), | 3335 | pci_unmap_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), |
3377 | cmndinfo->dma_dir); | 3336 | cmndinfo->dma_dir); |
3378 | 3337 | ||
3379 | if (cmndinfo->sense_paddr) | 3338 | if (cmndinfo->sense_paddr) |
@@ -4015,10 +3974,6 @@ static int gdth_queuecommand(struct scsi_cmnd *scp, | |||
4015 | gdth_update_timeout(scp, scp->timeout_per_command * 6); | 3974 | gdth_update_timeout(scp, scp->timeout_per_command * 6); |
4016 | cmndinfo->priority = DEFAULT_PRI; | 3975 | cmndinfo->priority = DEFAULT_PRI; |
4017 | 3976 | ||
4018 | gdth_set_bufflen(scp, scsi_bufflen(scp)); | ||
4019 | gdth_set_sg_count(scp, scsi_sg_count(scp)); | ||
4020 | gdth_set_sglist(scp, scsi_sglist(scp)); | ||
4021 | |||
4022 | return __gdth_queuecommand(ha, scp, cmndinfo); | 3977 | return __gdth_queuecommand(ha, scp, cmndinfo); |
4023 | } | 3978 | } |
4024 | 3979 | ||