From eba8999cefb6b61704d8fa825b7694825a087765 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Mon, 15 Jun 2009 18:52:57 +0200 Subject: ide: move IRQ clearing from ack_intr() method to clear_irq() method (take 2) There are now two methods that clear the port interrupt: ack_intr() method, implemented only on M680x0 machines, that is called at the start of ide_intr(), and clear_irq() method, that is called somewhat later in this function. In order to stop this duplication, delegate the task of clearing the interrupt to clear_irq() method, only leaving to ack_intr() the task of testing for the port interrupt. Signed-off-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/macide.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'drivers/ide/macide.c') diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c index 1447c8c90565..05cdab35a75c 100644 --- a/drivers/ide/macide.c +++ b/drivers/ide/macide.c @@ -55,13 +55,16 @@ volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR); int macide_ack_intr(ide_hwif_t* hwif) { - if (*ide_ifr & 0x20) { - *ide_ifr &= ~0x20; + if (*ide_ifr & 0x20) return 1; - } return 0; } +static void macide_clear_irq(ide_drive_t *drive) +{ + *ide_ifr &= ~0x20; +} + static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base, int irq, ide_ack_intr_t *ack_intr) { @@ -78,7 +81,12 @@ static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base, hw->ack_intr = ack_intr; } +static const struct ide_port_ops macide_port_ops = { + .clear_irq = macide_clear_irq, +}; + static const struct ide_port_info macide_port_info = { + .port_ops = &macide_port_ops, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, .irq_flags = IRQF_SHARED, .chipset = ide_generic, @@ -97,6 +105,7 @@ static int __init macide_init(void) unsigned long base; int irq; struct ide_hw hw, *hws[] = { &hw }; + struct ide_port_info d = macide_port_info; if (!MACH_IS_MAC) return -ENODEV; @@ -115,6 +124,7 @@ static int __init macide_init(void) case MAC_IDE_BABOON: base = BABOON_BASE; ack_intr = NULL; + d.port_ops = NULL; irq = IRQ_BABOON_1; break; default: @@ -126,7 +136,7 @@ static int __init macide_init(void) macide_setup_ports(&hw, base, irq, ack_intr); - return ide_host_add(&macide_port_info, hws, 1, NULL); + return ide_host_add(&d, hws, 1, NULL); } module_init(macide_init); -- cgit v1.2.1