aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:12 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:12 -0500
commit8e7657ae0f56c14882e53ffdae8055c2b1624de1 (patch)
tree93e8fbbf66d0a9f877b13d4534c6052713f3a268 /drivers/ide/ide-tape.c
parent790d1239898d4f893112280decd344d90f43ee96 (diff)
ide: remove atapi_ireason_t (take 3)
Remove atapi_ireason_t. While at it: * replace 'HWIF(drive)' by 'drive->hwif' (or just 'hwif' where possible) v2: * v1 had CD and IO bits reversed in many places. * Use CD and IO defines from <linux/hdreg.h>. v3: * Fix incorrect "(ireason & IO) == test_bit()". (Noticed by Sergei) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 4c24e185ccbf..3539131f23f4 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1847,14 +1847,13 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
1847{ 1847{
1848 ide_hwif_t *hwif = drive->hwif; 1848 ide_hwif_t *hwif = drive->hwif;
1849 idetape_tape_t *tape = drive->driver_data; 1849 idetape_tape_t *tape = drive->driver_data;
1850 atapi_ireason_t ireason;
1851 idetape_pc_t *pc = tape->pc; 1850 idetape_pc_t *pc = tape->pc;
1852 unsigned int temp; 1851 unsigned int temp;
1853#if SIMULATE_ERRORS 1852#if SIMULATE_ERRORS
1854 static int error_sim_count = 0; 1853 static int error_sim_count = 0;
1855#endif 1854#endif
1856 u16 bcount; 1855 u16 bcount;
1857 u8 stat; 1856 u8 stat, ireason;
1858 1857
1859#if IDETAPE_DEBUG_LOG 1858#if IDETAPE_DEBUG_LOG
1860 if (tape->debug_level >= 4) 1859 if (tape->debug_level >= 4)
@@ -1965,18 +1964,18 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
1965 bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | 1964 bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
1966 hwif->INB(IDE_BCOUNTL_REG); 1965 hwif->INB(IDE_BCOUNTL_REG);
1967 1966
1968 ireason.all = hwif->INB(IDE_IREASON_REG); 1967 ireason = hwif->INB(IDE_IREASON_REG);
1969 1968
1970 if (ireason.b.cod) { 1969 if (ireason & CD) {
1971 printk(KERN_ERR "ide-tape: CoD != 0 in idetape_pc_intr\n"); 1970 printk(KERN_ERR "ide-tape: CoD != 0 in idetape_pc_intr\n");
1972 return ide_do_reset(drive); 1971 return ide_do_reset(drive);
1973 } 1972 }
1974 if (ireason.b.io == test_bit(PC_WRITING, &pc->flags)) { 1973 if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) {
1975 /* Hopefully, we will never get here */ 1974 /* Hopefully, we will never get here */
1976 printk(KERN_ERR "ide-tape: We wanted to %s, ", 1975 printk(KERN_ERR "ide-tape: We wanted to %s, ",
1977 ireason.b.io ? "Write":"Read"); 1976 (ireason & IO) ? "Write" : "Read");
1978 printk(KERN_ERR "ide-tape: but the tape wants us to %s !\n", 1977 printk(KERN_ERR "ide-tape: but the tape wants us to %s !\n",
1979 ireason.b.io ? "Read":"Write"); 1978 (ireason & IO) ? "Read" : "Write");
1980 return ide_do_reset(drive); 1979 return ide_do_reset(drive);
1981 } 1980 }
1982 if (!test_bit(PC_WRITING, &pc->flags)) { 1981 if (!test_bit(PC_WRITING, &pc->flags)) {
@@ -2070,28 +2069,28 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
2070 ide_hwif_t *hwif = drive->hwif; 2069 ide_hwif_t *hwif = drive->hwif;
2071 idetape_tape_t *tape = drive->driver_data; 2070 idetape_tape_t *tape = drive->driver_data;
2072 idetape_pc_t *pc = tape->pc; 2071 idetape_pc_t *pc = tape->pc;
2073 atapi_ireason_t ireason;
2074 int retries = 100; 2072 int retries = 100;
2075 ide_startstop_t startstop; 2073 ide_startstop_t startstop;
2074 u8 ireason;
2076 2075
2077 if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) { 2076 if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
2078 printk(KERN_ERR "ide-tape: Strange, packet command initiated yet DRQ isn't asserted\n"); 2077 printk(KERN_ERR "ide-tape: Strange, packet command initiated yet DRQ isn't asserted\n");
2079 return startstop; 2078 return startstop;
2080 } 2079 }
2081 ireason.all = hwif->INB(IDE_IREASON_REG); 2080 ireason = hwif->INB(IDE_IREASON_REG);
2082 while (retries-- && (!ireason.b.cod || ireason.b.io)) { 2081 while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
2083 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing " 2082 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing "
2084 "a packet command, retrying\n"); 2083 "a packet command, retrying\n");
2085 udelay(100); 2084 udelay(100);
2086 ireason.all = hwif->INB(IDE_IREASON_REG); 2085 ireason = hwif->INB(IDE_IREASON_REG);
2087 if (retries == 0) { 2086 if (retries == 0) {
2088 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while " 2087 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while "
2089 "issuing a packet command, ignoring\n"); 2088 "issuing a packet command, ignoring\n");
2090 ireason.b.cod = 1; 2089 ireason |= CD;
2091 ireason.b.io = 0; 2090 ireason &= ~IO;
2092 } 2091 }
2093 } 2092 }
2094 if (!ireason.b.cod || ireason.b.io) { 2093 if ((ireason & CD) == 0 || (ireason & IO)) {
2095 printk(KERN_ERR "ide-tape: (IO,CoD) != (0,1) while issuing " 2094 printk(KERN_ERR "ide-tape: (IO,CoD) != (0,1) while issuing "
2096 "a packet command\n"); 2095 "a packet command\n");
2097 return ide_do_reset(drive); 2096 return ide_do_reset(drive);