aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/macide.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-06-15 12:52:57 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 12:52:57 -0400
commiteba8999cefb6b61704d8fa825b7694825a087765 (patch)
treee5f7d1ed464efe21160b425e8a57b017b9e99441 /drivers/ide/macide.c
parent74414a91204ee57528041f771da1fd1ee3ba64c4 (diff)
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 <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/macide.c')
-rw-r--r--drivers/ide/macide.c18
1 files changed, 14 insertions, 4 deletions
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);
55 55
56int macide_ack_intr(ide_hwif_t* hwif) 56int macide_ack_intr(ide_hwif_t* hwif)
57{ 57{
58 if (*ide_ifr & 0x20) { 58 if (*ide_ifr & 0x20)
59 *ide_ifr &= ~0x20;
60 return 1; 59 return 1;
61 }
62 return 0; 60 return 0;
63} 61}
64 62
63static void macide_clear_irq(ide_drive_t *drive)
64{
65 *ide_ifr &= ~0x20;
66}
67
65static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base, 68static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base,
66 int irq, ide_ack_intr_t *ack_intr) 69 int irq, ide_ack_intr_t *ack_intr)
67{ 70{
@@ -78,7 +81,12 @@ static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base,
78 hw->ack_intr = ack_intr; 81 hw->ack_intr = ack_intr;
79} 82}
80 83
84static const struct ide_port_ops macide_port_ops = {
85 .clear_irq = macide_clear_irq,
86};
87
81static const struct ide_port_info macide_port_info = { 88static const struct ide_port_info macide_port_info = {
89 .port_ops = &macide_port_ops,
82 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, 90 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
83 .irq_flags = IRQF_SHARED, 91 .irq_flags = IRQF_SHARED,
84 .chipset = ide_generic, 92 .chipset = ide_generic,
@@ -97,6 +105,7 @@ static int __init macide_init(void)
97 unsigned long base; 105 unsigned long base;
98 int irq; 106 int irq;
99 struct ide_hw hw, *hws[] = { &hw }; 107 struct ide_hw hw, *hws[] = { &hw };
108 struct ide_port_info d = macide_port_info;
100 109
101 if (!MACH_IS_MAC) 110 if (!MACH_IS_MAC)
102 return -ENODEV; 111 return -ENODEV;
@@ -115,6 +124,7 @@ static int __init macide_init(void)
115 case MAC_IDE_BABOON: 124 case MAC_IDE_BABOON:
116 base = BABOON_BASE; 125 base = BABOON_BASE;
117 ack_intr = NULL; 126 ack_intr = NULL;
127 d.port_ops = NULL;
118 irq = IRQ_BABOON_1; 128 irq = IRQ_BABOON_1;
119 break; 129 break;
120 default: 130 default:
@@ -126,7 +136,7 @@ static int __init macide_init(void)
126 136
127 macide_setup_ports(&hw, base, irq, ack_intr); 137 macide_setup_ports(&hw, base, irq, ack_intr);
128 138
129 return ide_host_add(&macide_port_info, hws, 1, NULL); 139 return ide_host_add(&d, hws, 1, NULL);
130} 140}
131 141
132module_init(macide_init); 142module_init(macide_init);