diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-15 15:22:00 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-15 15:22:00 -0400 |
commit | 6bf1641ca1c7554f0da54aaf89788731b541bacc (patch) | |
tree | ce7c371971e68b650d87e67935e460c948f4cb20 /drivers/ide/ide-floppy.c | |
parent | 28c7214bd8c2bbd4873b8f1e7f58d86d3731124f (diff) |
ide: add ide_issue_pc() helper
Add generic ide_issue_pc() helper to ide-atapi.c and then
convert ide-{floppy,tape,scsi} device drivers to use it.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 13f650fa2125..e658aafc51da 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -576,9 +576,6 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
576 | struct ide_atapi_pc *pc) | 576 | struct ide_atapi_pc *pc) |
577 | { | 577 | { |
578 | idefloppy_floppy_t *floppy = drive->driver_data; | 578 | idefloppy_floppy_t *floppy = drive->driver_data; |
579 | ide_hwif_t *hwif = drive->hwif; | ||
580 | u16 bcount; | ||
581 | u8 dma; | ||
582 | 579 | ||
583 | if (floppy->failed_pc == NULL && | 580 | if (floppy->failed_pc == NULL && |
584 | pc->c[0] != GPCMD_REQUEST_SENSE) | 581 | pc->c[0] != GPCMD_REQUEST_SENSE) |
@@ -600,37 +597,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
600 | debug_log("Retry number - %d\n", pc->retries); | 597 | debug_log("Retry number - %d\n", pc->retries); |
601 | 598 | ||
602 | pc->retries++; | 599 | pc->retries++; |
603 | /* We haven't transferred any data yet */ | ||
604 | pc->xferred = 0; | ||
605 | pc->cur_pos = pc->buf; | ||
606 | bcount = min(pc->req_xfer, 63 * 1024); | ||
607 | |||
608 | if (pc->flags & PC_FLAG_DMA_ERROR) { | ||
609 | pc->flags &= ~PC_FLAG_DMA_ERROR; | ||
610 | ide_dma_off(drive); | ||
611 | } | ||
612 | dma = 0; | ||
613 | 600 | ||
614 | if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma) | 601 | return ide_issue_pc(drive, pc, idefloppy_transfer_pc1, |
615 | dma = !hwif->dma_ops->dma_setup(drive); | 602 | IDEFLOPPY_WAIT_CMD, NULL); |
616 | |||
617 | if (!dma) | ||
618 | pc->flags &= ~PC_FLAG_DMA_OK; | ||
619 | |||
620 | ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma); | ||
621 | |||
622 | if (pc->flags & PC_FLAG_DRQ_INTERRUPT) { | ||
623 | /* Issue the packet command */ | ||
624 | ide_execute_command(drive, WIN_PACKETCMD, | ||
625 | &idefloppy_transfer_pc1, | ||
626 | IDEFLOPPY_WAIT_CMD, | ||
627 | NULL); | ||
628 | return ide_started; | ||
629 | } else { | ||
630 | /* Issue the packet command */ | ||
631 | ide_execute_pkt_cmd(drive); | ||
632 | return idefloppy_transfer_pc1(drive); | ||
633 | } | ||
634 | } | 603 | } |
635 | 604 | ||
636 | static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int prevent) | 605 | static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int prevent) |