aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:11 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:11 -0500
commit22c525b976778cce5bb6f8fdcc70046168c54b1a (patch)
tree40ab6ef79aa8e059d55e8c55d19fdc4dfe7fdce3
parent6a2144146aa2e0eb60e48ba73ac0e1c51346edf6 (diff)
ide: remove ata_status_t and atapi_status_t
Remove ata_status_t (unused) and atapi_status_t. While at it: * replace 'HWIF(drive)' by 'drive->hwif' (or just 'hwif' where possible) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-floppy.c14
-rw-r--r--drivers/ide/ide-lib.c21
-rw-r--r--drivers/ide/ide-tape.c34
-rw-r--r--drivers/scsi/ide-scsi.c9
-rw-r--r--include/linux/ide.h44
5 files changed, 37 insertions, 85 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 53f90257a8f0..7b94c7aff256 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -788,12 +788,12 @@ static void idefloppy_retry_pc (ide_drive_t *drive)
788static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) 788static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
789{ 789{
790 idefloppy_floppy_t *floppy = drive->driver_data; 790 idefloppy_floppy_t *floppy = drive->driver_data;
791 atapi_status_t status;
792 atapi_bcount_t bcount; 791 atapi_bcount_t bcount;
793 atapi_ireason_t ireason; 792 atapi_ireason_t ireason;
794 idefloppy_pc_t *pc = floppy->pc; 793 idefloppy_pc_t *pc = floppy->pc;
795 struct request *rq = pc->rq; 794 struct request *rq = pc->rq;
796 unsigned int temp; 795 unsigned int temp;
796 u8 stat;
797 797
798 debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", 798 debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n",
799 __FUNCTION__); 799 __FUNCTION__);
@@ -809,16 +809,16 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
809 } 809 }
810 810
811 /* Clear the interrupt */ 811 /* Clear the interrupt */
812 status.all = HWIF(drive)->INB(IDE_STATUS_REG); 812 stat = drive->hwif->INB(IDE_STATUS_REG);
813 813
814 if (!status.b.drq) { /* No more interrupts */ 814 if ((stat & DRQ_STAT) == 0) { /* No more interrupts */
815 debug_log(KERN_INFO "Packet command completed, %d bytes " 815 debug_log(KERN_INFO "Packet command completed, %d bytes "
816 "transferred\n", pc->actually_transferred); 816 "transferred\n", pc->actually_transferred);
817 clear_bit(PC_DMA_IN_PROGRESS, &pc->flags); 817 clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
818 818
819 local_irq_enable_in_hardirq(); 819 local_irq_enable_in_hardirq();
820 820
821 if (status.b.check || test_bit(PC_DMA_ERROR, &pc->flags)) { 821 if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) {
822 /* Error detected */ 822 /* Error detected */
823 debug_log(KERN_INFO "ide-floppy: %s: I/O error\n", 823 debug_log(KERN_INFO "ide-floppy: %s: I/O error\n",
824 drive->name); 824 drive->name);
@@ -1632,14 +1632,14 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg)
1632 /* Else assume format_unit has finished, and we're 1632 /* Else assume format_unit has finished, and we're
1633 ** at 0x10000 */ 1633 ** at 0x10000 */
1634 } else { 1634 } else {
1635 atapi_status_t status;
1636 unsigned long flags; 1635 unsigned long flags;
1636 u8 stat;
1637 1637
1638 local_irq_save(flags); 1638 local_irq_save(flags);
1639 status.all = HWIF(drive)->INB(IDE_STATUS_REG); 1639 stat = drive->hwif->INB(IDE_STATUS_REG);
1640 local_irq_restore(flags); 1640 local_irq_restore(flags);
1641 1641
1642 progress_indication = !status.b.dsc ? 0 : 0x10000; 1642 progress_indication = ((stat & SEEK_STAT) == 0) ? 0 : 0x10000;
1643 } 1643 }
1644 if (put_user(progress_indication, arg)) 1644 if (put_user(progress_indication, arg))
1645 return (-EFAULT); 1645 return (-EFAULT);
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 3bae2c46924f..dc7e539b4d0b 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -562,27 +562,24 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
562static u8 ide_dump_atapi_status(ide_drive_t *drive, const char *msg, u8 stat) 562static u8 ide_dump_atapi_status(ide_drive_t *drive, const char *msg, u8 stat)
563{ 563{
564 unsigned long flags; 564 unsigned long flags;
565
566 atapi_status_t status;
567 atapi_error_t error; 565 atapi_error_t error;
568 566
569 status.all = stat;
570 error.all = 0; 567 error.all = 0;
571 local_irq_save(flags); 568 local_irq_save(flags);
572 printk("%s: %s: status=0x%02x { ", drive->name, msg, stat); 569 printk("%s: %s: status=0x%02x { ", drive->name, msg, stat);
573 if (status.b.bsy) 570 if (stat & BUSY_STAT)
574 printk("Busy "); 571 printk("Busy ");
575 else { 572 else {
576 if (status.b.drdy) printk("DriveReady "); 573 if (stat & READY_STAT) printk("DriveReady ");
577 if (status.b.df) printk("DeviceFault "); 574 if (stat & WRERR_STAT) printk("DeviceFault ");
578 if (status.b.dsc) printk("SeekComplete "); 575 if (stat & SEEK_STAT) printk("SeekComplete ");
579 if (status.b.drq) printk("DataRequest "); 576 if (stat & DRQ_STAT) printk("DataRequest ");
580 if (status.b.corr) printk("CorrectedError "); 577 if (stat & ECC_STAT) printk("CorrectedError ");
581 if (status.b.idx) printk("Index "); 578 if (stat & INDEX_STAT) printk("Index ");
582 if (status.b.check) printk("Error "); 579 if (stat & ERR_STAT) printk("Error ");
583 } 580 }
584 printk("}\n"); 581 printk("}\n");
585 if (status.b.check && !status.b.bsy) { 582 if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
586 error.all = HWIF(drive)->INB(IDE_ERROR_REG); 583 error.all = HWIF(drive)->INB(IDE_ERROR_REG);
587 printk("%s: %s: error=0x%02x { ", drive->name, msg, error.all); 584 printk("%s: %s: error=0x%02x { ", drive->name, msg, error.all);
588 if (error.b.ili) printk("IllegalLengthIndication "); 585 if (error.b.ili) printk("IllegalLengthIndication ");
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 90e902d233cf..c91039505436 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1848,15 +1848,14 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
1848{ 1848{
1849 ide_hwif_t *hwif = drive->hwif; 1849 ide_hwif_t *hwif = drive->hwif;
1850 idetape_tape_t *tape = drive->driver_data; 1850 idetape_tape_t *tape = drive->driver_data;
1851 atapi_status_t status;
1852 atapi_bcount_t bcount; 1851 atapi_bcount_t bcount;
1853 atapi_ireason_t ireason; 1852 atapi_ireason_t ireason;
1854 idetape_pc_t *pc = tape->pc; 1853 idetape_pc_t *pc = tape->pc;
1855
1856 unsigned int temp; 1854 unsigned int temp;
1857#if SIMULATE_ERRORS 1855#if SIMULATE_ERRORS
1858 static int error_sim_count = 0; 1856 static int error_sim_count = 0;
1859#endif 1857#endif
1858 u8 stat;
1860 1859
1861#if IDETAPE_DEBUG_LOG 1860#if IDETAPE_DEBUG_LOG
1862 if (tape->debug_level >= 4) 1861 if (tape->debug_level >= 4)
@@ -1865,10 +1864,10 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
1865#endif /* IDETAPE_DEBUG_LOG */ 1864#endif /* IDETAPE_DEBUG_LOG */
1866 1865
1867 /* Clear the interrupt */ 1866 /* Clear the interrupt */
1868 status.all = HWIF(drive)->INB(IDE_STATUS_REG); 1867 stat = hwif->INB(IDE_STATUS_REG);
1869 1868
1870 if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) { 1869 if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) {
1871 if (HWIF(drive)->ide_dma_end(drive) || status.b.check) { 1870 if (hwif->ide_dma_end(drive) || (stat & ERR_STAT)) {
1872 /* 1871 /*
1873 * A DMA error is sometimes expected. For example, 1872 * A DMA error is sometimes expected. For example,
1874 * if the tape is crossing a filemark during a 1873 * if the tape is crossing a filemark during a
@@ -1902,7 +1901,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
1902 } 1901 }
1903 1902
1904 /* No more interrupts */ 1903 /* No more interrupts */
1905 if (!status.b.drq) { 1904 if ((stat & DRQ_STAT) == 0) {
1906#if IDETAPE_DEBUG_LOG 1905#if IDETAPE_DEBUG_LOG
1907 if (tape->debug_level >= 2) 1906 if (tape->debug_level >= 2)
1908 printk(KERN_INFO "ide-tape: Packet command completed, %d bytes transferred\n", pc->actually_transferred); 1907 printk(KERN_INFO "ide-tape: Packet command completed, %d bytes transferred\n", pc->actually_transferred);
@@ -1917,12 +1916,13 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
1917 (++error_sim_count % 100) == 0) { 1916 (++error_sim_count % 100) == 0) {
1918 printk(KERN_INFO "ide-tape: %s: simulating error\n", 1917 printk(KERN_INFO "ide-tape: %s: simulating error\n",
1919 tape->name); 1918 tape->name);
1920 status.b.check = 1; 1919 stat |= ERR_STAT;
1921 } 1920 }
1922#endif 1921#endif
1923 if (status.b.check && pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) 1922 if ((stat & ERR_STAT) && pc->c[0] == IDETAPE_REQUEST_SENSE_CMD)
1924 status.b.check = 0; 1923 stat &= ~ERR_STAT;
1925 if (status.b.check || test_bit(PC_DMA_ERROR, &pc->flags)) { /* Error detected */ 1924 if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) {
1925 /* Error detected */
1926#if IDETAPE_DEBUG_LOG 1926#if IDETAPE_DEBUG_LOG
1927 if (tape->debug_level >= 1) 1927 if (tape->debug_level >= 1)
1928 printk(KERN_INFO "ide-tape: %s: I/O error\n", 1928 printk(KERN_INFO "ide-tape: %s: I/O error\n",
@@ -1941,7 +1941,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
1941 } 1941 }
1942 pc->error = 0; 1942 pc->error = 0;
1943 if (test_bit(PC_WAIT_FOR_DSC, &pc->flags) && 1943 if (test_bit(PC_WAIT_FOR_DSC, &pc->flags) &&
1944 !status.b.dsc) { 1944 (stat & SEEK_STAT) == 0) {
1945 /* Media access command */ 1945 /* Media access command */
1946 tape->dsc_polling_start = jiffies; 1946 tape->dsc_polling_start = jiffies;
1947 tape->dsc_polling_frequency = IDETAPE_DSC_MA_FAST; 1947 tape->dsc_polling_frequency = IDETAPE_DSC_MA_FAST;
@@ -2285,11 +2285,11 @@ static ide_startstop_t idetape_media_access_finished (ide_drive_t *drive)
2285{ 2285{
2286 idetape_tape_t *tape = drive->driver_data; 2286 idetape_tape_t *tape = drive->driver_data;
2287 idetape_pc_t *pc = tape->pc; 2287 idetape_pc_t *pc = tape->pc;
2288 atapi_status_t status; 2288 u8 stat;
2289 2289
2290 status.all = HWIF(drive)->INB(IDE_STATUS_REG); 2290 stat = drive->hwif->INB(IDE_STATUS_REG);
2291 if (status.b.dsc) { 2291 if (stat & SEEK_STAT) {
2292 if (status.b.check) { 2292 if (stat & ERR_STAT) {
2293 /* Error detected */ 2293 /* Error detected */
2294 if (pc->c[0] != IDETAPE_TEST_UNIT_READY_CMD) 2294 if (pc->c[0] != IDETAPE_TEST_UNIT_READY_CMD)
2295 printk(KERN_ERR "ide-tape: %s: I/O error, ", 2295 printk(KERN_ERR "ide-tape: %s: I/O error, ",
@@ -2407,7 +2407,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
2407 idetape_tape_t *tape = drive->driver_data; 2407 idetape_tape_t *tape = drive->driver_data;
2408 idetape_pc_t *pc = NULL; 2408 idetape_pc_t *pc = NULL;
2409 struct request *postponed_rq = tape->postponed_rq; 2409 struct request *postponed_rq = tape->postponed_rq;
2410 atapi_status_t status; 2410 u8 stat;
2411 2411
2412#if IDETAPE_DEBUG_LOG 2412#if IDETAPE_DEBUG_LOG
2413#if 0 2413#if 0
@@ -2455,7 +2455,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
2455 * If the tape is still busy, postpone our request and service 2455 * If the tape is still busy, postpone our request and service
2456 * the other device meanwhile. 2456 * the other device meanwhile.
2457 */ 2457 */
2458 status.all = HWIF(drive)->INB(IDE_STATUS_REG); 2458 stat = drive->hwif->INB(IDE_STATUS_REG);
2459 2459
2460 if (!drive->dsc_overlap && !(rq->cmd[0] & REQ_IDETAPE_PC2)) 2460 if (!drive->dsc_overlap && !(rq->cmd[0] & REQ_IDETAPE_PC2))
2461 set_bit(IDETAPE_IGNORE_DSC, &tape->flags); 2461 set_bit(IDETAPE_IGNORE_DSC, &tape->flags);
@@ -2471,7 +2471,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
2471 tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time); 2471 tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time);
2472 calculate_speeds(drive); 2472 calculate_speeds(drive);
2473 if (!test_and_clear_bit(IDETAPE_IGNORE_DSC, &tape->flags) && 2473 if (!test_and_clear_bit(IDETAPE_IGNORE_DSC, &tape->flags) &&
2474 !status.b.dsc) { 2474 (stat & SEEK_STAT) == 0) {
2475 if (postponed_rq == NULL) { 2475 if (postponed_rq == NULL) {
2476 tape->dsc_polling_start = jiffies; 2476 tape->dsc_polling_start = jiffies;
2477 tape->dsc_polling_frequency = tape->best_dsc_rw_frequency; 2477 tape->dsc_polling_frequency = tape->best_dsc_rw_frequency;
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 9706de9d98d5..bd2b56912472 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -398,11 +398,10 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
398 idescsi_pc_t *pc=scsi->pc; 398 idescsi_pc_t *pc=scsi->pc;
399 struct request *rq = pc->rq; 399 struct request *rq = pc->rq;
400 atapi_bcount_t bcount; 400 atapi_bcount_t bcount;
401 atapi_status_t status;
402 atapi_ireason_t ireason; 401 atapi_ireason_t ireason;
403 atapi_feature_t feature; 402 atapi_feature_t feature;
404
405 unsigned int temp; 403 unsigned int temp;
404 u8 stat;
406 405
407#if IDESCSI_DEBUG_LOG 406#if IDESCSI_DEBUG_LOG
408 printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); 407 printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
@@ -427,14 +426,14 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
427 426
428 feature.all = 0; 427 feature.all = 0;
429 /* Clear the interrupt */ 428 /* Clear the interrupt */
430 status.all = HWIF(drive)->INB(IDE_STATUS_REG); 429 stat = drive->hwif->INB(IDE_STATUS_REG);
431 430
432 if (!status.b.drq) { 431 if ((stat & DRQ_STAT) == 0) {
433 /* No more interrupts */ 432 /* No more interrupts */
434 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) 433 if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
435 printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred); 434 printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred);
436 local_irq_enable_in_hardirq(); 435 local_irq_enable_in_hardirq();
437 if (status.b.check) 436 if (stat & ERR_STAT)
438 rq->errors++; 437 rq->errors++;
439 idescsi_end_request (drive, 1, 0); 438 idescsi_end_request (drive, 1, 0);
440 return ide_stopped; 439 return ide_stopped;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index c6ffc2028fb5..921cf717f22a 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -366,50 +366,6 @@ typedef union {
366} select_t, ata_select_t; 366} select_t, ata_select_t;
367 367
368/* 368/*
369 * The ATA-IDE Status Register.
370 * The ATAPI Status Register.
371 *
372 * check : Error occurred
373 * idx : Index Error
374 * corr : Correctable error occurred
375 * drq : Data is request by the device
376 * dsc : Disk Seek Complete : ata
377 * : Media access command finished : atapi
378 * df : Device Fault : ata
379 * : Reserved : atapi
380 * drdy : Ready, Command Mode Capable : ata
381 * : Ignored for ATAPI commands : atapi
382 * bsy : Disk is Busy
383 * : The device has access to the command block
384 */
385typedef union {
386 unsigned all :8;
387 struct {
388#if defined(__LITTLE_ENDIAN_BITFIELD)
389 unsigned check :1;
390 unsigned idx :1;
391 unsigned corr :1;
392 unsigned drq :1;
393 unsigned dsc :1;
394 unsigned df :1;
395 unsigned drdy :1;
396 unsigned bsy :1;
397#elif defined(__BIG_ENDIAN_BITFIELD)
398 unsigned bsy :1;
399 unsigned drdy :1;
400 unsigned df :1;
401 unsigned dsc :1;
402 unsigned drq :1;
403 unsigned corr :1;
404 unsigned idx :1;
405 unsigned check :1;
406#else
407#error "Please fix <asm/byteorder.h>"
408#endif
409 } b;
410} ata_status_t, atapi_status_t;
411
412/*
413 * ATAPI Feature Register 369 * ATAPI Feature Register
414 * 370 *
415 * dma : Using DMA or PIO 371 * dma : Using DMA or PIO