summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-07-11 14:49:24 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-30 12:12:22 -0700
commita923f756be07aae690ec3dd2e4a25967658cf893 (patch)
tree9f3f6232fbb71d94e407f481b803f4d8ad7d21b9
parent92bd401ba7248946a4215d65ae9b1993ae66db2c (diff)
downloadlinux-a923f756be07aae690ec3dd2e4a25967658cf893.tar.bz2
[SCSI] libsas: reindent sas_queuecommand
Switch sas_queuecommand to a normal indentation and goto based error handling. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c81
1 files changed, 38 insertions, 43 deletions
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index ba3acd416add..9dd1e9eda19b 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -184,56 +184,51 @@ int sas_queue_up(struct sas_task *task)
int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
{
- int res = 0;
- struct domain_device *dev = cmd_to_domain_dev(cmd);
struct sas_internal *i = to_sas_internal(host->transportt);
+ struct domain_device *dev = cmd_to_domain_dev(cmd);
+ struct sas_ha_struct *sas_ha = dev->port->ha;
+ struct sas_task *task;
+ int res = 0;
- {
- struct sas_ha_struct *sas_ha = dev->port->ha;
- struct sas_task *task;
-
- /* If the device fell off, no sense in issuing commands */
- if (dev->gone) {
- cmd->result = DID_BAD_TARGET << 16;
- cmd->scsi_done(cmd);
- goto out;
- }
+ /* If the device fell off, no sense in issuing commands */
+ if (dev->gone) {
+ cmd->result = DID_BAD_TARGET << 16;
+ goto out_done;
+ }
- if (dev_is_sata(dev)) {
- unsigned long flags;
+ if (dev_is_sata(dev)) {
+ unsigned long flags;
- spin_lock_irqsave(dev->sata_dev.ap->lock, flags);
- res = ata_sas_queuecmd(cmd, dev->sata_dev.ap);
- spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags);
- goto out;
- }
+ spin_lock_irqsave(dev->sata_dev.ap->lock, flags);
+ res = ata_sas_queuecmd(cmd, dev->sata_dev.ap);
+ spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags);
+ return res;
+ }
- res = -ENOMEM;
- task = sas_create_task(cmd, dev, GFP_ATOMIC);
- if (!task)
- goto out;
+ task = sas_create_task(cmd, dev, GFP_ATOMIC);
+ if (!task)
+ return -ENOMEM;
- /* Queue up, Direct Mode or Task Collector Mode. */
- if (sas_ha->lldd_max_execute_num < 2)
- res = i->dft->lldd_execute_task(task, 1, GFP_ATOMIC);
- else
- res = sas_queue_up(task);
+ /* Queue up, Direct Mode or Task Collector Mode. */
+ if (sas_ha->lldd_max_execute_num < 2)
+ res = i->dft->lldd_execute_task(task, 1, GFP_ATOMIC);
+ else
+ res = sas_queue_up(task);
- /* Examine */
- if (res) {
- SAS_DPRINTK("lldd_execute_task returned: %d\n", res);
- ASSIGN_SAS_TASK(cmd, NULL);
- sas_free_task(task);
- if (res == -SAS_QUEUE_FULL) {
- cmd->result = DID_SOFT_ERROR << 16; /* retry */
- res = 0;
- cmd->scsi_done(cmd);
- }
- goto out;
- }
- }
-out:
- return res;
+ if (res)
+ goto out_free_task;
+ return 0;
+
+out_free_task:
+ SAS_DPRINTK("lldd_execute_task returned: %d\n", res);
+ ASSIGN_SAS_TASK(cmd, NULL);
+ sas_free_task(task);
+ if (res != -SAS_QUEUE_FULL)
+ return res;
+ cmd->result = DID_SOFT_ERROR << 16; /* retry */
+out_done:
+ cmd->scsi_done(cmd);
+ return 0;
}
static void sas_eh_finish_cmd(struct scsi_cmnd *cmd)