aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2010-02-26 17:01:47 -0500
committerJens Axboe <jens.axboe@oracle.com>2010-02-28 13:42:32 -0500
commitbf8873781831c7799255e0932848401070185dd0 (patch)
tree5aaff18a945b308bd3dc86f2aa9fc74fefbc1b7d /drivers/block
parentaad9fb6f2c5beafe76a724c90a4bd0d695ab8b42 (diff)
cciss: eliminate unnecessary pointer use in cciss scsi code
cciss: eliminate unnecessary pointer use in cciss scsi code An extra level of indirection was being used in some places for no real reason. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/cciss_scsi.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index c4582323a07d..6dc15b669694 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1400,7 +1400,7 @@ cciss_scatter_gather(struct pci_dev *pdev,
1400static int 1400static int
1401cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) 1401cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
1402{ 1402{
1403 ctlr_info_t **c; 1403 ctlr_info_t *c;
1404 int ctlr, rc; 1404 int ctlr, rc;
1405 unsigned char scsi3addr[8]; 1405 unsigned char scsi3addr[8];
1406 CommandList_struct *cp; 1406 CommandList_struct *cp;
@@ -1408,8 +1408,8 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd
1408 1408
1409 // Get the ptr to our adapter structure (hba[i]) out of cmd->host. 1409 // Get the ptr to our adapter structure (hba[i]) out of cmd->host.
1410 // We violate cmd->host privacy here. (Is there another way?) 1410 // We violate cmd->host privacy here. (Is there another way?)
1411 c = (ctlr_info_t **) &cmd->device->host->hostdata[0]; 1411 c = (ctlr_info_t *) cmd->device->host->hostdata[0];
1412 ctlr = (*c)->ctlr; 1412 ctlr = c->ctlr;
1413 1413
1414 rc = lookup_scsi3addr(ctlr, cmd->device->channel, cmd->device->id, 1414 rc = lookup_scsi3addr(ctlr, cmd->device->channel, cmd->device->id,
1415 cmd->device->lun, scsi3addr); 1415 cmd->device->lun, scsi3addr);
@@ -1432,7 +1432,7 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd
1432 see what the device thinks of it. */ 1432 see what the device thinks of it. */
1433 1433
1434 spin_lock_irqsave(CCISS_LOCK(ctlr), flags); 1434 spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
1435 cp = scsi_cmd_alloc(*c); 1435 cp = scsi_cmd_alloc(c);
1436 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); 1436 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
1437 if (cp == NULL) { /* trouble... */ 1437 if (cp == NULL) { /* trouble... */
1438 printk("scsi_cmd_alloc returned NULL!\n"); 1438 printk("scsi_cmd_alloc returned NULL!\n");
@@ -1490,15 +1490,14 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd
1490 BUG(); 1490 BUG();
1491 break; 1491 break;
1492 } 1492 }
1493 1493 cciss_scatter_gather(c->pdev, cp, cmd);
1494 cciss_scatter_gather((*c)->pdev, cp, cmd); // Fill the SG list
1495 1494
1496 /* Put the request on the tail of the request queue */ 1495 /* Put the request on the tail of the request queue */
1497 1496
1498 spin_lock_irqsave(CCISS_LOCK(ctlr), flags); 1497 spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
1499 addQ(&(*c)->reqQ, cp); 1498 addQ(&c->reqQ, cp);
1500 (*c)->Qdepth++; 1499 c->Qdepth++;
1501 start_io(*c); 1500 start_io(c);
1502 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); 1501 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
1503 1502
1504 /* the cmd'll come back via intr handler in complete_scsi_command() */ 1503 /* the cmd'll come back via intr handler in complete_scsi_command() */
@@ -1655,14 +1654,14 @@ static int cciss_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
1655 int rc; 1654 int rc;
1656 CommandList_struct *cmd_in_trouble; 1655 CommandList_struct *cmd_in_trouble;
1657 unsigned char lunaddr[8]; 1656 unsigned char lunaddr[8];
1658 ctlr_info_t **c; 1657 ctlr_info_t *c;
1659 int ctlr; 1658 int ctlr;
1660 1659
1661 /* find the controller to which the command to be aborted was sent */ 1660 /* find the controller to which the command to be aborted was sent */
1662 c = (ctlr_info_t **) &scsicmd->device->host->hostdata[0]; 1661 c = (ctlr_info_t *) scsicmd->device->host->hostdata[0];
1663 if (c == NULL) /* paranoia */ 1662 if (c == NULL) /* paranoia */
1664 return FAILED; 1663 return FAILED;
1665 ctlr = (*c)->ctlr; 1664 ctlr = c->ctlr;
1666 printk(KERN_WARNING "cciss%d: resetting tape drive or medium changer.\n", ctlr); 1665 printk(KERN_WARNING "cciss%d: resetting tape drive or medium changer.\n", ctlr);
1667 /* find the command that's giving us trouble */ 1666 /* find the command that's giving us trouble */
1668 cmd_in_trouble = (CommandList_struct *) scsicmd->host_scribble; 1667 cmd_in_trouble = (CommandList_struct *) scsicmd->host_scribble;
@@ -1672,7 +1671,7 @@ static int cciss_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
1672 /* send a reset to the SCSI LUN which the command was sent to */ 1671 /* send a reset to the SCSI LUN which the command was sent to */
1673 rc = sendcmd_withirq(CCISS_RESET_MSG, ctlr, NULL, 0, 0, lunaddr, 1672 rc = sendcmd_withirq(CCISS_RESET_MSG, ctlr, NULL, 0, 0, lunaddr,
1674 TYPE_MSG); 1673 TYPE_MSG);
1675 if (rc == 0 && wait_for_device_to_become_ready(*c, lunaddr) == 0) 1674 if (rc == 0 && wait_for_device_to_become_ready(c, lunaddr) == 0)
1676 return SUCCESS; 1675 return SUCCESS;
1677 printk(KERN_WARNING "cciss%d: resetting device failed.\n", ctlr); 1676 printk(KERN_WARNING "cciss%d: resetting device failed.\n", ctlr);
1678 return FAILED; 1677 return FAILED;
@@ -1683,14 +1682,14 @@ static int cciss_eh_abort_handler(struct scsi_cmnd *scsicmd)
1683 int rc; 1682 int rc;
1684 CommandList_struct *cmd_to_abort; 1683 CommandList_struct *cmd_to_abort;
1685 unsigned char lunaddr[8]; 1684 unsigned char lunaddr[8];
1686 ctlr_info_t **c; 1685 ctlr_info_t *c;
1687 int ctlr; 1686 int ctlr;
1688 1687
1689 /* find the controller to which the command to be aborted was sent */ 1688 /* find the controller to which the command to be aborted was sent */
1690 c = (ctlr_info_t **) &scsicmd->device->host->hostdata[0]; 1689 c = (ctlr_info_t *) scsicmd->device->host->hostdata[0];
1691 if (c == NULL) /* paranoia */ 1690 if (c == NULL) /* paranoia */
1692 return FAILED; 1691 return FAILED;
1693 ctlr = (*c)->ctlr; 1692 ctlr = c->ctlr;
1694 printk(KERN_WARNING "cciss%d: aborting tardy SCSI cmd\n", ctlr); 1693 printk(KERN_WARNING "cciss%d: aborting tardy SCSI cmd\n", ctlr);
1695 1694
1696 /* find the command to be aborted */ 1695 /* find the command to be aborted */