libata: move ata_irq_on() into libata-sff.c
PATCH 1/1 libata: move ata_irq_on() into libata-sff.c
ata_irq_on() isn't used outside of libata core layer. The function is TF/SFF interface specific but currently used by core path with some hack too. Move it from include/linux/libata.h to drivers/ata/libata-sff.c.
--- drivers/ata/libata-sff.c | 29 +++++++++++++++++++++++++++++ drivers/ata/libata.h | 3 +++ include/linux/libata.h | 31 ------------------------------- 3 files changed, 32 insertions(+), 31 deletions(-)
drivers/ata/libata-sff.c +29 -0
@@ -39,6 +39,35 @@#include "libata.h" /** +* ata_irq_on - Enable interrupts on a port. +* @ap: Port on which interrupts are enabled. +* +* Enable interrupts on a legacy IDE device using MMIO or PIO, +* wait for idle, clear any pending interrupts. +* +* LOCKING: +* Inherited from caller. +*/ +u8 ata_irq_on (struct ata_port *ap) +{ +struct ata_ioports *ioaddr = &ap->ioaddr; +u8 tmp; + + ap->ctl &= ~ATA_NIEN ; + ap->last_ctl = ap->ctl; + +if (ap->flags &ATA_FLAG_MMIO ) +writeb (ap->ctl, (void __iomem *) ioaddr->ctl_addr); +else +outb (ap->ctl, ioaddr->ctl_addr); + tmp =ata_wait_idle (ap); + + ap->ops->irq_clear (ap); + +return tmp; +} + +/** * ata_tf_load_pio - send taskfile registers to host controller * @ap: Port to which output is sent * @tf: ATA taskfile register set
drivers/ata/libata.h +3 -0
@@ -119,4 +119,7 @@ extern void ata_scsi_error(struct Scsi_Hextern void ata_port_wait_eh (struct ata_port *ap);extern void ata_qc_schedule_eh (struct ata_queued_cmd *qc); +/* libata-sff.c */ +extern u8 ata_irq_on (struct ata_port *ap); +#endif /* __LIBATA_H__ */
include/linux/libata.h +0 -31
@@ -1148,37 +1148,6 @@ static inline void ata_qc_reinit(struct }/** -* ata_irq_on - Enable interrupts on a port. -* @ap: Port on which interrupts are enabled. -* -* Enable interrupts on a legacy IDE device using MMIO or PIO, -* wait for idle, clear any pending interrupts. -* -* LOCKING: -* Inherited from caller. -*/ - -static inline u8 ata_irq_on (struct ata_port *ap) -{ -struct ata_ioports *ioaddr = &ap->ioaddr; -u8 tmp; - - ap->ctl &= ~ATA_NIEN ; - ap->last_ctl = ap->ctl; - -if (ap->flags &ATA_FLAG_MMIO ) -writeb (ap->ctl, (void __iomem *) ioaddr->ctl_addr); -else -outb (ap->ctl, ioaddr->ctl_addr); - tmp =ata_wait_idle (ap); - - ap->ops->irq_clear (ap); - -return tmp; -} - - -/** * ata_irq_ack - Acknowledge a device interrupt. * @ap: Port on which interrupts are enabled. *
PATCH 1/1 libata: fix ata_irq_on()
* IRQ must be cleared *before* unmasking not after.
* ata_wait_idle() causes spurious 1sec wait and there is no reason to wait for !DRQ. DRQ waiting causes unnecessary delay on empty port which reports funky status like 0x7f. !BSY waiting seems superflous too. No caller depends on ata_irq_on() to wait for idle state. The port is either already idle on entry or the caller waits for idle status afterwards. Wait only for !BSY without whining on failure.
---
Jeff, this fixes 'abnormal status 0xXX' messages for empty ports. The message was triggerd from ata_bmdma_thaw(). Unlike old EH, new EH thaws empty ports (mainly for hotplugging) and controllers which reports set DRQ on empty ports triggers the message. I think this update should be included in #uptream-fixes too. People are getting annoyed by the message.
Thanks.
drivers/ata/libata-sff.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/ata/libata-sff.c +3 -5
@@ -51,7 +51,8 @@u8 ata_irq_on (struct ata_port *ap) {struct ata_ioports *ioaddr = &ap->ioaddr; -u8 tmp; + + ap->ops->irq_clear (ap); ap->ctl &= ~ATA_NIEN ; ap->last_ctl = ap->ctl;
@@ -60,11 +61,8 @@ u8 ata_irq_on(struct ata_port *ap)writeb (ap->ctl, (void __iomem *) ioaddr->ctl_addr); else outb(ap->ctl, ioaddr->ctl_addr); - tmp =ata_wait_idle (ap); - - ap->ops->irq_clear (ap); -return tmp; +return ata_busy_wait (ap,ATA_BUSY ,1000 ); }/**
Jeff Garzik
AppliedQuoted 6 lines · Tejun Heo
ata_irq_on()isn't used outside of libata core layer. The function is TF/SFF interface specific but currently used by core path with some hack too. Move it frominclude/linux/libata.htodrivers/ata/libata-sff.c.Signed-off-by Tejun Heo <[email protected]>
applied