Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89654
b: refs/heads/master
c: d35055a
h: refs/heads/master
v: v3
  • Loading branch information
Boaz Harrosh authored and James Bottomley committed Apr 7, 2008
1 parent b8f77bb commit 7444d7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 60 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 68066c3ed14b529331bc2ff12470e9ca1cae5c3f
refs/heads/master: d35055a0f2637f29f95001a67b464fe833b09ebc
73 changes: 14 additions & 59 deletions trunk/drivers/scsi/gdth.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@

/* The meaning of the Scsi_Pointer members in this driver is as follows:
* ptr: Chaining
* this_residual: gdth_bufflen
* buffer: gdth_sglist
* this_residual: unused
* buffer: unused
* dma_handle: unused
* buffers_residual: gdth_sg_count
* buffers_residual: unused
* Status: unused
* Message: unused
* have_data_in: unused
Expand Down Expand Up @@ -372,47 +372,6 @@ static const struct file_operations gdth_fops = {
.release = gdth_close,
};

/*
* gdth scsi_command access wrappers.
* below 6 functions are used throughout the driver to access scsi_command's
* io parameters. The reason we do not use the regular accessors from
* scsi_cmnd.h is because of gdth_execute(). Since it is unrecommended for
* llds to directly set scsi_cmnd's IO members. This driver will use SCp
* members for IO parameters, and will copy scsi_cmnd's members to Scp
* members in queuecommand. For internal commands through gdth_execute()
* SCp's members will be set directly.
*/
static inline unsigned gdth_bufflen(struct scsi_cmnd *cmd)
{
return (unsigned)cmd->SCp.this_residual;
}

static inline void gdth_set_bufflen(struct scsi_cmnd *cmd, unsigned bufflen)
{
cmd->SCp.this_residual = bufflen;
}

static inline unsigned gdth_sg_count(struct scsi_cmnd *cmd)
{
return (unsigned)cmd->SCp.buffers_residual;
}

static inline void gdth_set_sg_count(struct scsi_cmnd *cmd, unsigned sg_count)
{
cmd->SCp.buffers_residual = sg_count;
}

static inline struct scatterlist *gdth_sglist(struct scsi_cmnd *cmd)
{
return cmd->SCp.buffer;
}

static inline void gdth_set_sglist(struct scsi_cmnd *cmd,
struct scatterlist *sglist)
{
cmd->SCp.buffer = sglist;
}

#include "gdth_proc.h"
#include "gdth_proc.c"

Expand Down Expand Up @@ -2337,20 +2296,20 @@ static void gdth_next(gdth_ha_str *ha)
static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
char *buffer, ushort count)
{
ushort cpcount,i, max_sg = gdth_sg_count(scp);
ushort cpcount,i, max_sg = scsi_sg_count(scp);
ushort cpsum,cpnow;
struct scatterlist *sl;
char *address;

cpcount = min_t(ushort, count, gdth_bufflen(scp));
cpcount = min_t(ushort, count, scsi_bufflen(scp));

if (cpcount) {
cpsum=0;
scsi_for_each_sg(scp, sl, max_sg, i) {
unsigned long flags;
cpnow = (ushort)sl->length;
TRACE(("copy_internal() now %d sum %d count %d %d\n",
cpnow, cpsum, cpcount, gdth_bufflen(scp)));
cpnow, cpsum, cpcount, scsi_bufflen(scp)));
if (cpsum+cpnow > cpcount)
cpnow = cpcount - cpsum;
cpsum += cpnow;
Expand Down Expand Up @@ -2573,10 +2532,10 @@ static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive)
cmdp->u.cache.BlockCnt = blockcnt;
}

if (gdth_bufflen(scp)) {
if (scsi_bufflen(scp)) {
cmndinfo->dma_dir = (read_write == 1 ?
PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
sgcnt = pci_map_sg(ha->pdev, gdth_sglist(scp), gdth_sg_count(scp),
sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp),
cmndinfo->dma_dir);
if (mode64) {
struct scatterlist *sl;
Expand Down Expand Up @@ -2723,7 +2682,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
cmdp->u.raw64.lun = l;
cmdp->u.raw64.bus = b;
cmdp->u.raw64.priority = 0;
cmdp->u.raw64.sdlen = gdth_bufflen(scp);
cmdp->u.raw64.sdlen = scsi_bufflen(scp);
cmdp->u.raw64.sense_len = 16;
cmdp->u.raw64.sense_data = sense_paddr;
cmdp->u.raw64.direction =
Expand All @@ -2740,7 +2699,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
cmdp->u.raw.bus = b;
cmdp->u.raw.priority = 0;
cmdp->u.raw.link_p = 0;
cmdp->u.raw.sdlen = gdth_bufflen(scp);
cmdp->u.raw.sdlen = scsi_bufflen(scp);
cmdp->u.raw.sense_len = 16;
cmdp->u.raw.sense_data = sense_paddr;
cmdp->u.raw.direction =
Expand All @@ -2749,9 +2708,9 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b)
cmdp->u.raw.sg_ranz = 0;
}

if (gdth_bufflen(scp)) {
if (scsi_bufflen(scp)) {
cmndinfo->dma_dir = PCI_DMA_BIDIRECTIONAL;
sgcnt = pci_map_sg(ha->pdev, gdth_sglist(scp), gdth_sg_count(scp),
sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp),
cmndinfo->dma_dir);
if (mode64) {
struct scatterlist *sl;
Expand Down Expand Up @@ -3372,8 +3331,8 @@ static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index,
/* retry */
return 2;
}
if (gdth_bufflen(scp))
pci_unmap_sg(ha->pdev, gdth_sglist(scp), gdth_sg_count(scp),
if (scsi_bufflen(scp))
pci_unmap_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp),
cmndinfo->dma_dir);

if (cmndinfo->sense_paddr)
Expand Down Expand Up @@ -4015,10 +3974,6 @@ static int gdth_queuecommand(struct scsi_cmnd *scp,
gdth_update_timeout(scp, scp->timeout_per_command * 6);
cmndinfo->priority = DEFAULT_PRI;

gdth_set_bufflen(scp, scsi_bufflen(scp));
gdth_set_sg_count(scp, scsi_sg_count(scp));
gdth_set_sglist(scp, scsi_sglist(scp));

return __gdth_queuecommand(ha, scp, cmndinfo);
}

Expand Down

0 comments on commit 7444d7b

Please sign in to comment.