aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/ide/ide-floppy.c25
-rw-r--r--drivers/ide/ide-tape.c27
-rw-r--r--drivers/scsi/ide-scsi.c17
3 files changed, 33 insertions, 36 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 239aebcfc359..830186fdcc74 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -788,12 +788,11 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
788{ 788{
789 idefloppy_floppy_t *floppy = drive->driver_data; 789 idefloppy_floppy_t *floppy = drive->driver_data;
790 ide_hwif_t *hwif = drive->hwif; 790 ide_hwif_t *hwif = drive->hwif;
791 atapi_ireason_t ireason;
792 idefloppy_pc_t *pc = floppy->pc; 791 idefloppy_pc_t *pc = floppy->pc;
793 struct request *rq = pc->rq; 792 struct request *rq = pc->rq;
794 unsigned int temp; 793 unsigned int temp;
795 u16 bcount; 794 u16 bcount;
796 u8 stat; 795 u8 stat, ireason;
797 796
798 debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", 797 debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n",
799 __FUNCTION__); 798 __FUNCTION__);
@@ -852,18 +851,18 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
852 bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | 851 bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
853 hwif->INB(IDE_BCOUNTL_REG); 852 hwif->INB(IDE_BCOUNTL_REG);
854 /* on this interrupt */ 853 /* on this interrupt */
855 ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); 854 ireason = hwif->INB(IDE_IREASON_REG);
856 855
857 if (ireason.b.cod) { 856 if (ireason & CD) {
858 printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n"); 857 printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n");
859 return ide_do_reset(drive); 858 return ide_do_reset(drive);
860 } 859 }
861 if (ireason.b.io == test_bit(PC_WRITING, &pc->flags)) { 860 if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) {
862 /* Hopefully, we will never get here */ 861 /* Hopefully, we will never get here */
863 printk(KERN_ERR "ide-floppy: We wanted to %s, ", 862 printk(KERN_ERR "ide-floppy: We wanted to %s, ",
864 ireason.b.io ? "Write":"Read"); 863 (ireason & IO) ? "Write" : "Read");
865 printk(KERN_ERR "but the floppy wants us to %s !\n", 864 printk(KERN_ERR "but the floppy wants us to %s !\n",
866 ireason.b.io ? "Read":"Write"); 865 (ireason & IO) ? "Read" : "Write");
867 return ide_do_reset(drive); 866 return ide_do_reset(drive);
868 } 867 }
869 if (!test_bit(PC_WRITING, &pc->flags)) { 868 if (!test_bit(PC_WRITING, &pc->flags)) {
@@ -920,15 +919,15 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
920{ 919{
921 ide_startstop_t startstop; 920 ide_startstop_t startstop;
922 idefloppy_floppy_t *floppy = drive->driver_data; 921 idefloppy_floppy_t *floppy = drive->driver_data;
923 atapi_ireason_t ireason; 922 u8 ireason;
924 923
925 if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) { 924 if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
926 printk(KERN_ERR "ide-floppy: Strange, packet command " 925 printk(KERN_ERR "ide-floppy: Strange, packet command "
927 "initiated yet DRQ isn't asserted\n"); 926 "initiated yet DRQ isn't asserted\n");
928 return startstop; 927 return startstop;
929 } 928 }
930 ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); 929 ireason = drive->hwif->INB(IDE_IREASON_REG);
931 if (!ireason.b.cod || ireason.b.io) { 930 if ((ireason & CD) == 0 || (ireason & IO)) {
932 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while " 931 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while "
933 "issuing a packet command\n"); 932 "issuing a packet command\n");
934 return ide_do_reset(drive); 933 return ide_do_reset(drive);
@@ -968,15 +967,15 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
968{ 967{
969 idefloppy_floppy_t *floppy = drive->driver_data; 968 idefloppy_floppy_t *floppy = drive->driver_data;
970 ide_startstop_t startstop; 969 ide_startstop_t startstop;
971 atapi_ireason_t ireason; 970 u8 ireason;
972 971
973 if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) { 972 if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
974 printk(KERN_ERR "ide-floppy: Strange, packet command " 973 printk(KERN_ERR "ide-floppy: Strange, packet command "
975 "initiated yet DRQ isn't asserted\n"); 974 "initiated yet DRQ isn't asserted\n");
976 return startstop; 975 return startstop;
977 } 976 }
978 ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); 977 ireason = drive->hwif->INB(IDE_IREASON_REG);
979 if (!ireason.b.cod || ireason.b.io) { 978 if ((ireason & CD) == 0 || (ireason & IO)) {
980 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) " 979 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) "
981 "while issuing a packet command\n"); 980 "while issuing a packet command\n");
982 return ide_do_reset(drive); 981 return ide_do_reset(drive);
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);
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 77e8a81228fc..ab7e8642cb88 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -398,10 +398,9 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
398 ide_hwif_t *hwif = drive->hwif; 398 ide_hwif_t *hwif = drive->hwif;
399 idescsi_pc_t *pc = scsi->pc; 399 idescsi_pc_t *pc = scsi->pc;
400 struct request *rq = pc->rq; 400 struct request *rq = pc->rq;
401 atapi_ireason_t ireason;
402 unsigned int temp; 401 unsigned int temp;
403 u16 bcount; 402 u16 bcount;
404 u8 stat; 403 u8 stat, ireason;
405 404
406#if IDESCSI_DEBUG_LOG 405#if IDESCSI_DEBUG_LOG
407 printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); 406 printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
@@ -439,13 +438,13 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
439 } 438 }
440 bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) | 439 bcount = (hwif->INB(IDE_BCOUNTH_REG) << 8) |
441 hwif->INB(IDE_BCOUNTL_REG); 440 hwif->INB(IDE_BCOUNTL_REG);
442 ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); 441 ireason = hwif->INB(IDE_IREASON_REG);
443 442
444 if (ireason.b.cod) { 443 if (ireason & CD) {
445 printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n"); 444 printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n");
446 return ide_do_reset (drive); 445 return ide_do_reset (drive);
447 } 446 }
448 if (ireason.b.io) { 447 if (ireason & IO) {
449 temp = pc->actually_transferred + bcount; 448 temp = pc->actually_transferred + bcount;
450 if (temp > pc->request_transfer) { 449 if (temp > pc->request_transfer) {
451 if (temp > pc->buffer_size) { 450 if (temp > pc->buffer_size) {
@@ -474,7 +473,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
474#endif /* IDESCSI_DEBUG_LOG */ 473#endif /* IDESCSI_DEBUG_LOG */
475 } 474 }
476 } 475 }
477 if (ireason.b.io) { 476 if (ireason & IO) {
478 clear_bit(PC_WRITING, &pc->flags); 477 clear_bit(PC_WRITING, &pc->flags);
479 if (pc->sg) 478 if (pc->sg)
480 idescsi_input_buffers(drive, pc, bcount); 479 idescsi_input_buffers(drive, pc, bcount);
@@ -503,16 +502,16 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
503 ide_hwif_t *hwif = drive->hwif; 502 ide_hwif_t *hwif = drive->hwif;
504 idescsi_scsi_t *scsi = drive_to_idescsi(drive); 503 idescsi_scsi_t *scsi = drive_to_idescsi(drive);
505 idescsi_pc_t *pc = scsi->pc; 504 idescsi_pc_t *pc = scsi->pc;
506 atapi_ireason_t ireason;
507 ide_startstop_t startstop; 505 ide_startstop_t startstop;
506 u8 ireason;
508 507
509 if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) { 508 if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
510 printk(KERN_ERR "ide-scsi: Strange, packet command " 509 printk(KERN_ERR "ide-scsi: Strange, packet command "
511 "initiated yet DRQ isn't asserted\n"); 510 "initiated yet DRQ isn't asserted\n");
512 return startstop; 511 return startstop;
513 } 512 }
514 ireason.all = HWIF(drive)->INB(IDE_IREASON_REG); 513 ireason = hwif->INB(IDE_IREASON_REG);
515 if (!ireason.b.cod || ireason.b.io) { 514 if ((ireason & CD) == 0 || (ireason & IO)) {
516 printk(KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while " 515 printk(KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while "
517 "issuing a packet command\n"); 516 "issuing a packet command\n");
518 return ide_do_reset (drive); 517 return ide_do_reset (drive);