aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:41 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:41 -0400
commit0a1248c5a754cc8dc5b10a902d2f86b40144165c (patch)
tree81dbeefbccba76fa4b15478162a305aa2d5923b1
parent151055ed84df7bebc77d88471302a7cd02c6e0a4 (diff)
ide: unify exit paths in task_pio_intr()
There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-taskfile.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index a01c2c0450dc..79900a7a62e6 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -326,35 +326,28 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive)
326 if (write == 0) { 326 if (write == 0) {
327 /* Error? */ 327 /* Error? */
328 if (stat & ATA_ERR) 328 if (stat & ATA_ERR)
329 return task_error(drive, cmd, __func__, stat); 329 goto out_err;
330 330
331 /* Didn't want any data? Odd. */ 331 /* Didn't want any data? Odd. */
332 if ((stat & ATA_DRQ) == 0) { 332 if ((stat & ATA_DRQ) == 0) {
333 /* Command all done? */ 333 /* Command all done? */
334 if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { 334 if (OK_STAT(stat, ATA_DRDY, ATA_BUSY))
335 ide_finish_cmd(drive, cmd, stat); 335 goto out_end;
336 return ide_stopped;
337 }
338 336
339 /* Assume it was a spurious irq */ 337 /* Assume it was a spurious irq */
340 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, 338 goto out_wait;
341 NULL);
342
343 return ide_started;
344 } 339 }
345 } else { 340 } else {
346 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) 341 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
347 return task_error(drive, cmd, __func__, stat); 342 goto out_err;
348 343
349 /* Deal with unexpected ATA data phase. */ 344 /* Deal with unexpected ATA data phase. */
350 if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) 345 if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0))
351 return task_error(drive, cmd, __func__, stat); 346 goto out_err;
352 } 347 }
353 348
354 if (write && cmd->nleft == 0) { 349 if (write && cmd->nleft == 0)
355 ide_finish_cmd(drive, cmd, stat); 350 goto out_end;
356 return ide_stopped;
357 }
358 351
359 /* Still data left to transfer. */ 352 /* Still data left to transfer. */
360 ide_pio_datablock(drive, cmd, write); 353 ide_pio_datablock(drive, cmd, write);
@@ -363,15 +356,19 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive)
363 if (write == 0 && cmd->nleft == 0) { 356 if (write == 0 && cmd->nleft == 0) {
364 stat = wait_drive_not_busy(drive); 357 stat = wait_drive_not_busy(drive);
365 if (!OK_STAT(stat, 0, BAD_STAT)) 358 if (!OK_STAT(stat, 0, BAD_STAT))
366 return task_error(drive, cmd, __func__, stat); 359 goto out_err;
367 ide_finish_cmd(drive, cmd, stat);
368 return ide_stopped;
369 }
370 360
361 goto out_end;
362 }
363out_wait:
371 /* Still data left to transfer. */ 364 /* Still data left to transfer. */
372 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); 365 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL);
373
374 return ide_started; 366 return ide_started;
367out_end:
368 ide_finish_cmd(drive, cmd, stat);
369 return ide_stopped;
370out_err:
371 return task_error(drive, cmd, __func__, stat);
375} 372}
376 373
377static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, 374static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,