aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:43 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:43 -0400
commitb6a45a0b1e9a358b81201659cf87b023e3ec73e0 (patch)
tree07a3d4f02f33ec872862f278b4feffc8e5273e90 /drivers/ide
parent75a0cff4e8ed47584dd15fbde2172ebc4c051bb2 (diff)
ide: move drive_is_ready() to ide-io.c
Move drive_is_ready() to ide-io.c, then make it static. Also make some minor CodingStyle fixups while at it. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-io.c23
-rw-r--r--drivers/ide/ide-iops.c25
2 files changed, 23 insertions, 25 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index d90cf5d08142..835cf646bb07 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -887,6 +887,29 @@ static void ide_plug_device(ide_drive_t *drive)
887 spin_unlock_irqrestore(q->queue_lock, flags); 887 spin_unlock_irqrestore(q->queue_lock, flags);
888} 888}
889 889
890static int drive_is_ready(ide_drive_t *drive)
891{
892 ide_hwif_t *hwif = drive->hwif;
893 u8 stat = 0;
894
895 if (drive->waiting_for_dma)
896 return hwif->dma_ops->dma_test_irq(drive);
897
898 if (hwif->io_ports.ctl_addr &&
899 (hwif->host_flags & IDE_HFLAG_BROKEN_ALTSTATUS) == 0)
900 stat = hwif->tp_ops->read_altstatus(hwif);
901 else
902 /* Note: this may clear a pending IRQ!! */
903 stat = hwif->tp_ops->read_status(hwif);
904
905 if (stat & ATA_BUSY)
906 /* drive busy: definitely not interrupting */
907 return 0;
908
909 /* drive ready: *might* be interrupting */
910 return 1;
911}
912
890/** 913/**
891 * ide_timer_expiry - handle lack of an IDE interrupt 914 * ide_timer_expiry - handle lack of an IDE interrupt
892 * @data: timer callback magic (hwif) 915 * @data: timer callback magic (hwif)
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index cd1f2e464c4b..ee9c60342787 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -438,31 +438,6 @@ void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
438 438
439EXPORT_SYMBOL(ide_fixstring); 439EXPORT_SYMBOL(ide_fixstring);
440 440
441int drive_is_ready (ide_drive_t *drive)
442{
443 ide_hwif_t *hwif = drive->hwif;
444 u8 stat = 0;
445
446 if (drive->waiting_for_dma)
447 return hwif->dma_ops->dma_test_irq(drive);
448
449 if (hwif->io_ports.ctl_addr &&
450 (hwif->host_flags & IDE_HFLAG_BROKEN_ALTSTATUS) == 0)
451 stat = hwif->tp_ops->read_altstatus(hwif);
452 else
453 /* Note: this may clear a pending IRQ!! */
454 stat = hwif->tp_ops->read_status(hwif);
455
456 if (stat & ATA_BUSY)
457 /* drive busy: definitely not interrupting */
458 return 0;
459
460 /* drive ready: *might* be interrupting */
461 return 1;
462}
463
464EXPORT_SYMBOL(drive_is_ready);
465
466/* 441/*
467 * This routine busy-waits for the drive status to be not "busy". 442 * This routine busy-waits for the drive status to be not "busy".
468 * It then checks the status for all of the "good" bits and none 443 * It then checks the status for all of the "good" bits and none