aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-15 15:21:57 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-15 15:21:57 -0400
commit5a7b75ab429e9ed568be50cfbf7091f097457cb8 (patch)
treedd2b16ba3be2b40311df559ef248398155d0345e /drivers/ide
parent9fd13a27c8a35ff1986793cb96aaedb5e75b5368 (diff)
ide-tape: factor out waiting for good ireason from idetape_transfer_pc()
Factor out waiting for good ireason from idetape_transfer_pc() to ide_tape_wait_ireason() as a preparation for adding generic ide_transfer_pc() helper. 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')
-rw-r--r--drivers/ide/ide-tape.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 1ce8b31453c5..63b837ef7e05 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -947,21 +947,12 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
947 * again, the callback function will be called and then we will handle the next 947 * again, the callback function will be called and then we will handle the next
948 * request. 948 * request.
949 */ 949 */
950static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive) 950
951static u8 ide_tape_wait_ireason(ide_drive_t *drive, u8 ireason)
951{ 952{
952 ide_hwif_t *hwif = drive->hwif; 953 ide_hwif_t *hwif = drive->hwif;
953 idetape_tape_t *tape = drive->driver_data;
954 struct ide_atapi_pc *pc = tape->pc;
955 int retries = 100; 954 int retries = 100;
956 ide_startstop_t startstop;
957 u8 ireason;
958 955
959 if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
960 printk(KERN_ERR "%s: Strange, packet command initiated yet "
961 "DRQ isn't asserted\n", drive->name);
962 return startstop;
963 }
964 ireason = hwif->INB(hwif->io_ports.nsect_addr);
965 while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { 956 while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
966 printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing " 957 printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
967 "a packet command, retrying\n", drive->name); 958 "a packet command, retrying\n", drive->name);
@@ -975,6 +966,27 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
975 ireason &= ~IO; 966 ireason &= ~IO;
976 } 967 }
977 } 968 }
969
970 return ireason;
971}
972
973static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
974{
975 ide_hwif_t *hwif = drive->hwif;
976 idetape_tape_t *tape = drive->driver_data;
977 struct ide_atapi_pc *pc = tape->pc;
978 ide_startstop_t startstop;
979 u8 ireason;
980
981 if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
982 printk(KERN_ERR "%s: Strange, packet command initiated yet "
983 "DRQ isn't asserted\n", drive->name);
984 return startstop;
985 }
986
987 ireason = hwif->INB(hwif->io_ports.nsect_addr);
988 ireason = ide_tape_wait_ireason(drive, ireason);
989
978 if ((ireason & CD) == 0 || (ireason & IO)) { 990 if ((ireason & CD) == 0 || (ireason & IO)) {
979 printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing " 991 printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
980 "a packet command\n", drive->name); 992 "a packet command\n", drive->name);