aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/ncr53c8xx.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-02-07 07:54:46 -0700
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-27 22:55:09 -0600
commit6ea3c0b2dac0d6a857d6bc010e544f4c901fff78 (patch)
tree0650d6e8b5be747eb192e558dd90e875ca7a13fb /drivers/scsi/ncr53c8xx.c
parentb0dc1db15225d5801bf3105966c9ce12c5142013 (diff)
[SCSI] Add spi_populate_*_msg functions
Introduce new helpers: - spi_populate_width_msg() - spi_populate_sync_msg() - spi_populate_ppr_msg() and use them in drivers which already enable the SPI transport. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/ncr53c8xx.c')
-rw-r--r--drivers/scsi/ncr53c8xx.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index abb1859bff0..22f913127f0 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -4105,17 +4105,11 @@ static int ncr_prepare_nego(struct ncb *np, struct ccb *cp, u_char *msgptr)
switch (nego) {
case NS_SYNC:
- msgptr[msglen++] = EXTENDED_MESSAGE;
- msgptr[msglen++] = 3;
- msgptr[msglen++] = EXTENDED_SDTR;
- msgptr[msglen++] = tp->maxoffs ? tp->minsync : 0;
- msgptr[msglen++] = tp->maxoffs;
+ msglen += spi_populate_sync_msg(msgptr + msglen,
+ tp->maxoffs ? tp->minsync : 0, tp->maxoffs);
break;
case NS_WIDE:
- msgptr[msglen++] = EXTENDED_MESSAGE;
- msgptr[msglen++] = 2;
- msgptr[msglen++] = EXTENDED_WDTR;
- msgptr[msglen++] = tp->usrwide;
+ msglen += spi_populate_width_msg(msgptr + msglen, tp->usrwide);
break;
}
@@ -6989,12 +6983,7 @@ void ncr_int_sir (struct ncb *np)
spi_offset(starget) = ofs;
ncr_setsync(np, cp, scntl3, (fak<<5)|ofs);
- np->msgout[0] = EXTENDED_MESSAGE;
- np->msgout[1] = 3;
- np->msgout[2] = EXTENDED_SDTR;
- np->msgout[3] = per;
- np->msgout[4] = ofs;
-
+ spi_populate_sync_msg(np->msgout, per, ofs);
cp->nego_status = NS_SYNC;
if (DEBUG_FLAGS & DEBUG_NEGO) {
@@ -7080,11 +7069,7 @@ void ncr_int_sir (struct ncb *np)
spi_width(starget) = wide;
ncr_setwide(np, cp, wide, 1);
-
- np->msgout[0] = EXTENDED_MESSAGE;
- np->msgout[1] = 2;
- np->msgout[2] = EXTENDED_WDTR;
- np->msgout[3] = wide;
+ spi_populate_width_msg(np->msgout, wide);
np->msgin [0] = NOP;