aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-11-04 08:59:24 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2008-01-30 16:22:19 -0500
commit825f1df545ab0289185373b0eaf06fb0b3487422 (patch)
tree5cca3e02c0abe05dbca680a2cbe645ab9bd2d2d2 /drivers/ieee1394
parent8c4ac0949f7779cd4cc8c618f1b07e6113682010 (diff)
ieee1394: sbp2: s/g list access cosmetics
Replace sg->length by sg_dma_len(sg). Rename a variable for shorter line lengths and eliminate some superfluous local variables. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/sbp2.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 96eac0b53019..b91142b8482c 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -1451,7 +1451,7 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1451 struct sbp2_fwhost_info *hi, 1451 struct sbp2_fwhost_info *hi,
1452 struct sbp2_command_info *cmd, 1452 struct sbp2_command_info *cmd,
1453 unsigned int scsi_use_sg, 1453 unsigned int scsi_use_sg,
1454 struct scatterlist *sgpnt, 1454 struct scatterlist *sg,
1455 u32 orb_direction, 1455 u32 orb_direction,
1456 enum dma_data_direction dma_dir) 1456 enum dma_data_direction dma_dir)
1457{ 1457{
@@ -1461,12 +1461,12 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1461 1461
1462 /* special case if only one element (and less than 64KB in size) */ 1462 /* special case if only one element (and less than 64KB in size) */
1463 if ((scsi_use_sg == 1) && 1463 if ((scsi_use_sg == 1) &&
1464 (sgpnt[0].length <= SBP2_MAX_SG_ELEMENT_LENGTH)) { 1464 (sg_dma_len(sg) <= SBP2_MAX_SG_ELEMENT_LENGTH)) {
1465 1465
1466 cmd->dma_size = sgpnt[0].length; 1466 cmd->dma_size = sg_dma_len(sg);
1467 cmd->dma_type = CMD_DMA_PAGE; 1467 cmd->dma_type = CMD_DMA_PAGE;
1468 cmd->cmd_dma = dma_map_page(hi->host->device.parent, 1468 cmd->cmd_dma = dma_map_page(hi->host->device.parent,
1469 sg_page(&sgpnt[0]), sgpnt[0].offset, 1469 sg_page(sg), sg->offset,
1470 cmd->dma_size, cmd->dma_dir); 1470 cmd->dma_size, cmd->dma_dir);
1471 1471
1472 orb->data_descriptor_lo = cmd->cmd_dma; 1472 orb->data_descriptor_lo = cmd->cmd_dma;
@@ -1477,11 +1477,11 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1477 &cmd->scatter_gather_element[0]; 1477 &cmd->scatter_gather_element[0];
1478 u32 sg_count, sg_len; 1478 u32 sg_count, sg_len;
1479 dma_addr_t sg_addr; 1479 dma_addr_t sg_addr;
1480 int i, count = dma_map_sg(hi->host->device.parent, sgpnt, 1480 int i, count = dma_map_sg(hi->host->device.parent, sg,
1481 scsi_use_sg, dma_dir); 1481 scsi_use_sg, dma_dir);
1482 1482
1483 cmd->dma_size = scsi_use_sg; 1483 cmd->dma_size = scsi_use_sg;
1484 cmd->sge_buffer = sgpnt; 1484 cmd->sge_buffer = sg;
1485 1485
1486 /* use page tables (s/g) */ 1486 /* use page tables (s/g) */
1487 orb->misc |= ORB_SET_PAGE_TABLE_PRESENT(0x1); 1487 orb->misc |= ORB_SET_PAGE_TABLE_PRESENT(0x1);
@@ -1489,9 +1489,9 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1489 1489
1490 /* loop through and fill out our SBP-2 page tables 1490 /* loop through and fill out our SBP-2 page tables
1491 * (and split up anything too large) */ 1491 * (and split up anything too large) */
1492 for (i = 0, sg_count = 0; i < count; i++, sgpnt = sg_next(sgpnt)) { 1492 for (i = 0, sg_count = 0; i < count; i++, sg = sg_next(sg)) {
1493 sg_len = sg_dma_len(sgpnt); 1493 sg_len = sg_dma_len(sg);
1494 sg_addr = sg_dma_address(sgpnt); 1494 sg_addr = sg_dma_address(sg);
1495 while (sg_len) { 1495 while (sg_len) {
1496 sg_element[sg_count].segment_base_lo = sg_addr; 1496 sg_element[sg_count].segment_base_lo = sg_addr;
1497 if (sg_len > SBP2_MAX_SG_ELEMENT_LENGTH) { 1497 if (sg_len > SBP2_MAX_SG_ELEMENT_LENGTH) {
@@ -1521,11 +1521,10 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu,
1521 unchar *scsi_cmd, 1521 unchar *scsi_cmd,
1522 unsigned int scsi_use_sg, 1522 unsigned int scsi_use_sg,
1523 unsigned int scsi_request_bufflen, 1523 unsigned int scsi_request_bufflen,
1524 void *scsi_request_buffer, 1524 struct scatterlist *sg,
1525 enum dma_data_direction dma_dir) 1525 enum dma_data_direction dma_dir)
1526{ 1526{
1527 struct sbp2_fwhost_info *hi = lu->hi; 1527 struct sbp2_fwhost_info *hi = lu->hi;
1528 struct scatterlist *sgpnt = (struct scatterlist *)scsi_request_buffer;
1529 struct sbp2_command_orb *orb = &cmd->command_orb; 1528 struct sbp2_command_orb *orb = &cmd->command_orb;
1530 u32 orb_direction; 1529 u32 orb_direction;
1531 1530
@@ -1560,7 +1559,7 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu,
1560 orb->data_descriptor_lo = 0x0; 1559 orb->data_descriptor_lo = 0x0;
1561 orb->misc |= ORB_SET_DIRECTION(1); 1560 orb->misc |= ORB_SET_DIRECTION(1);
1562 } else 1561 } else
1563 sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sgpnt, 1562 sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sg,
1564 orb_direction, dma_dir); 1563 orb_direction, dma_dir);
1565 1564
1566 sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); 1565 sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb));
@@ -1650,7 +1649,6 @@ static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt,
1650 void (*done)(struct scsi_cmnd *)) 1649 void (*done)(struct scsi_cmnd *))
1651{ 1650{
1652 unchar *scsi_cmd = (unchar *)SCpnt->cmnd; 1651 unchar *scsi_cmd = (unchar *)SCpnt->cmnd;
1653 unsigned int request_bufflen = scsi_bufflen(SCpnt);
1654 struct sbp2_command_info *cmd; 1652 struct sbp2_command_info *cmd;
1655 1653
1656 cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); 1654 cmd = sbp2util_allocate_command_orb(lu, SCpnt, done);
@@ -1658,7 +1656,7 @@ static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt,
1658 return -EIO; 1656 return -EIO;
1659 1657
1660 sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt), 1658 sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt),
1661 request_bufflen, scsi_sglist(SCpnt), 1659 scsi_bufflen(SCpnt), scsi_sglist(SCpnt),
1662 SCpnt->sc_data_direction); 1660 SCpnt->sc_data_direction);
1663 sbp2_link_orb_command(lu, cmd); 1661 sbp2_link_orb_command(lu, cmd);
1664 1662