diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-07-11 14:49:24 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-30 15:12:22 -0400 |
commit | a923f756be07aae690ec3dd2e4a25967658cf893 (patch) | |
tree | 9f3f6232fbb71d94e407f481b803f4d8ad7d21b9 /drivers/scsi/libsas/sas_scsi_host.c | |
parent | 92bd401ba7248946a4215d65ae9b1993ae66db2c (diff) |
[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>
Diffstat (limited to 'drivers/scsi/libsas/sas_scsi_host.c')
-rw-r--r-- | drivers/scsi/libsas/sas_scsi_host.c | 81 |
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) | |||
184 | 184 | ||
185 | int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) | 185 | int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) |
186 | { | 186 | { |
187 | int res = 0; | ||
188 | struct domain_device *dev = cmd_to_domain_dev(cmd); | ||
189 | struct sas_internal *i = to_sas_internal(host->transportt); | 187 | struct sas_internal *i = to_sas_internal(host->transportt); |
188 | struct domain_device *dev = cmd_to_domain_dev(cmd); | ||
189 | struct sas_ha_struct *sas_ha = dev->port->ha; | ||
190 | struct sas_task *task; | ||
191 | int res = 0; | ||
190 | 192 | ||
191 | { | 193 | /* If the device fell off, no sense in issuing commands */ |
192 | struct sas_ha_struct *sas_ha = dev->port->ha; | 194 | if (dev->gone) { |
193 | struct sas_task *task; | 195 | cmd->result = DID_BAD_TARGET << 16; |
194 | 196 | goto out_done; | |
195 | /* If the device fell off, no sense in issuing commands */ | 197 | } |
196 | if (dev->gone) { | ||
197 | cmd->result = DID_BAD_TARGET << 16; | ||
198 | cmd->scsi_done(cmd); | ||
199 | goto out; | ||
200 | } | ||
201 | 198 | ||
202 | if (dev_is_sata(dev)) { | 199 | if (dev_is_sata(dev)) { |
203 | unsigned long flags; | 200 | unsigned long flags; |
204 | 201 | ||
205 | spin_lock_irqsave(dev->sata_dev.ap->lock, flags); | 202 | spin_lock_irqsave(dev->sata_dev.ap->lock, flags); |
206 | res = ata_sas_queuecmd(cmd, dev->sata_dev.ap); | 203 | res = ata_sas_queuecmd(cmd, dev->sata_dev.ap); |
207 | spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags); | 204 | spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags); |
208 | goto out; | 205 | return res; |
209 | } | 206 | } |
210 | 207 | ||
211 | res = -ENOMEM; | 208 | task = sas_create_task(cmd, dev, GFP_ATOMIC); |
212 | task = sas_create_task(cmd, dev, GFP_ATOMIC); | 209 | if (!task) |
213 | if (!task) | 210 | return -ENOMEM; |
214 | goto out; | ||
215 | 211 | ||
216 | /* Queue up, Direct Mode or Task Collector Mode. */ | 212 | /* Queue up, Direct Mode or Task Collector Mode. */ |
217 | if (sas_ha->lldd_max_execute_num < 2) | 213 | if (sas_ha->lldd_max_execute_num < 2) |
218 | res = i->dft->lldd_execute_task(task, 1, GFP_ATOMIC); | 214 | res = i->dft->lldd_execute_task(task, 1, GFP_ATOMIC); |
219 | else | 215 | else |
220 | res = sas_queue_up(task); | 216 | res = sas_queue_up(task); |
221 | 217 | ||
222 | /* Examine */ | 218 | if (res) |
223 | if (res) { | 219 | goto out_free_task; |
224 | SAS_DPRINTK("lldd_execute_task returned: %d\n", res); | 220 | return 0; |
225 | ASSIGN_SAS_TASK(cmd, NULL); | 221 | |
226 | sas_free_task(task); | 222 | out_free_task: |
227 | if (res == -SAS_QUEUE_FULL) { | 223 | SAS_DPRINTK("lldd_execute_task returned: %d\n", res); |
228 | cmd->result = DID_SOFT_ERROR << 16; /* retry */ | 224 | ASSIGN_SAS_TASK(cmd, NULL); |
229 | res = 0; | 225 | sas_free_task(task); |
230 | cmd->scsi_done(cmd); | 226 | if (res != -SAS_QUEUE_FULL) |
231 | } | 227 | return res; |
232 | goto out; | 228 | cmd->result = DID_SOFT_ERROR << 16; /* retry */ |
233 | } | 229 | out_done: |
234 | } | 230 | cmd->scsi_done(cmd); |
235 | out: | 231 | return 0; |
236 | return res; | ||
237 | } | 232 | } |
238 | 233 | ||
239 | static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) | 234 | static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) |