aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-06-15 12:52:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 12:52:58 -0400
commitf4d3ffa52a402ec9e8699571cf3811763d284459 (patch)
tree792c78dbf602af3f35020b041255905a95b917f2 /drivers/ide
parenteba8999cefb6b61704d8fa825b7694825a087765 (diff)
ide: move ack_intr() method into 'struct ide_port_ops' (take 2)
Move the ack_intr() method into 'struct ide_port_ops', also renaming it to test_irq() while at it... Signed-off-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/buddha.c15
-rw-r--r--drivers/ide/falconide.c1
-rw-r--r--drivers/ide/gayle.c14
-rw-r--r--drivers/ide/ide-io.c3
-rw-r--r--drivers/ide/ide-probe.c1
-rw-r--r--drivers/ide/macide.c12
-rw-r--r--drivers/ide/q40ide.c7
7 files changed, 26 insertions, 27 deletions
diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c
index 9cd7b115763d..ab4f169d0837 100644
--- a/drivers/ide/buddha.c
+++ b/drivers/ide/buddha.c
@@ -99,7 +99,7 @@ static const char *buddha_board_name[] = { "Buddha", "Catweasel", "X-Surf" };
99 * Check and acknowledge the interrupt status 99 * Check and acknowledge the interrupt status
100 */ 100 */
101 101
102static int buddha_ack_intr(ide_hwif_t *hwif) 102static int buddha_test_irq(ide_hwif_t *hwif)
103{ 103{
104 unsigned char ch; 104 unsigned char ch;
105 105
@@ -118,8 +118,7 @@ static void xsurf_clear_irq(ide_drive_t *drive)
118} 118}
119 119
120static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, 120static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base,
121 unsigned long ctl, unsigned long irq_port, 121 unsigned long ctl, unsigned long irq_port)
122 ide_ack_intr_t *ack_intr)
123{ 122{
124 int i; 123 int i;
125 124
@@ -134,14 +133,19 @@ static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base,
134 hw->io_ports.irq_addr = irq_port; 133 hw->io_ports.irq_addr = irq_port;
135 134
136 hw->irq = IRQ_AMIGA_PORTS; 135 hw->irq = IRQ_AMIGA_PORTS;
137 hw->ack_intr = ack_intr;
138} 136}
139 137
138static const struct ide_port_ops buddha_port_ops = {
139 .test_irq = buddha_test_irq,
140};
141
140static const struct ide_port_ops xsurf_port_ops = { 142static const struct ide_port_ops xsurf_port_ops = {
141 .clear_irq = xsurf_clear_irq, 143 .clear_irq = xsurf_clear_irq,
144 .test_irq = buddha_test_irq,
142}; 145};
143 146
144static const struct ide_port_info buddha_port_info = { 147static const struct ide_port_info buddha_port_info = {
148 .port_ops = &buddha_port_ops,
145 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, 149 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
146 .irq_flags = IRQF_SHARED, 150 .irq_flags = IRQF_SHARED,
147 .chipset = ide_generic, 151 .chipset = ide_generic,
@@ -217,8 +221,7 @@ fail_base2:
217 irq_port = buddha_board + xsurf_irqports[i]; 221 irq_port = buddha_board + xsurf_irqports[i];
218 } 222 }
219 223
220 buddha_setup_ports(&hw[i], base, ctl, irq_port, 224 buddha_setup_ports(&hw[i], base, ctl, irq_port);
221 buddha_ack_intr);
222 225
223 hws[i] = &hw[i]; 226 hws[i] = &hw[i];
224 } 227 }
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index 22fa27389c3b..a5a07ccb81a7 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -128,7 +128,6 @@ static void __init falconide_setup_ports(struct ide_hw *hw)
128 hw->io_ports.ctl_addr = ATA_HD_BASE + ATA_HD_CONTROL; 128 hw->io_ports.ctl_addr = ATA_HD_BASE + ATA_HD_CONTROL;
129 129
130 hw->irq = IRQ_MFP_IDE; 130 hw->irq = IRQ_MFP_IDE;
131 hw->ack_intr = NULL;
132} 131}
133 132
134 /* 133 /*
diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c
index c5dd1e5cca4d..b9e517de6a82 100644
--- a/drivers/ide/gayle.c
+++ b/drivers/ide/gayle.c
@@ -66,7 +66,7 @@ MODULE_PARM_DESC(doubler, "enable support for IDE doublers");
66 * Check and acknowledge the interrupt status 66 * Check and acknowledge the interrupt status
67 */ 67 */
68 68
69static int gayle_ack_intr(ide_hwif_t *hwif) 69static int gayle_test_irq(ide_hwif_t *hwif)
70{ 70{
71 unsigned char ch; 71 unsigned char ch;
72 72
@@ -85,8 +85,7 @@ static void gayle_a1200_clear_irq(ide_drive_t *drive)
85} 85}
86 86
87static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base, 87static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
88 unsigned long ctl, unsigned long irq_port, 88 unsigned long ctl, unsigned long irq_port)
89 ide_ack_intr_t *ack_intr)
90{ 89{
91 int i; 90 int i;
92 91
@@ -101,11 +100,15 @@ static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
101 hw->io_ports.irq_addr = irq_port; 100 hw->io_ports.irq_addr = irq_port;
102 101
103 hw->irq = IRQ_AMIGA_PORTS; 102 hw->irq = IRQ_AMIGA_PORTS;
104 hw->ack_intr = ack_intr;
105} 103}
106 104
105static const struct ide_port_ops gayle_a4000_port_ops = {
106 .test_irq = gayle_test_irq,
107};
108
107static const struct ide_port_ops gayle_a1200_port_ops = { 109static const struct ide_port_ops gayle_a1200_port_ops = {
108 .clear_irq = gayle_a1200_clear_irq, 110 .clear_irq = gayle_a1200_clear_irq,
111 .test_irq = gayle_test_irq,
109}; 112};
110 113
111static const struct ide_port_info gayle_port_info = { 114static const struct ide_port_info gayle_port_info = {
@@ -148,6 +151,7 @@ found:
148 if (a4000) { 151 if (a4000) {
149 phys_base = GAYLE_BASE_4000; 152 phys_base = GAYLE_BASE_4000;
150 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000); 153 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000);
154 d.port_ops = &gayle_a4000_port_ops;
151 } else { 155 } else {
152 phys_base = GAYLE_BASE_1200; 156 phys_base = GAYLE_BASE_1200;
153 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); 157 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200);
@@ -164,7 +168,7 @@ found:
164 base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT); 168 base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT);
165 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; 169 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
166 170
167 gayle_setup_ports(&hw[i], base, ctrlport, irqport, gayle_ack_intr); 171 gayle_setup_ports(&hw[i], base, ctrlport, irqport);
168 172
169 hws[i] = &hw[i]; 173 hws[i] = &hw[i];
170 } 174 }
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 9e53efe9fb2d..1059f809b809 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -804,7 +804,8 @@ irqreturn_t ide_intr (int irq, void *dev_id)
804 804
805 spin_lock_irqsave(&hwif->lock, flags); 805 spin_lock_irqsave(&hwif->lock, flags);
806 806
807 if (hwif->ack_intr && hwif->ack_intr(hwif) == 0) 807 if (hwif->port_ops && hwif->port_ops->test_irq &&
808 hwif->port_ops->test_irq(hwif) == 0)
808 goto out; 809 goto out;
809 810
810 handler = hwif->handler; 811 handler = hwif->handler;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index fdd04bcd5568..c2e7159d7930 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1170,7 +1170,6 @@ static void ide_init_port_hw(ide_hwif_t *hwif, struct ide_hw *hw)
1170 hwif->irq = hw->irq; 1170 hwif->irq = hw->irq;
1171 hwif->dev = hw->dev; 1171 hwif->dev = hw->dev;
1172 hwif->gendev.parent = hw->parent ? hw->parent : hw->dev; 1172 hwif->gendev.parent = hw->parent ? hw->parent : hw->dev;
1173 hwif->ack_intr = hw->ack_intr;
1174 hwif->config_data = hw->config; 1173 hwif->config_data = hw->config;
1175} 1174}
1176 1175
diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c
index 05cdab35a75c..505ec43e5606 100644
--- a/drivers/ide/macide.c
+++ b/drivers/ide/macide.c
@@ -53,7 +53,7 @@
53 53
54volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR); 54volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR);
55 55
56int macide_ack_intr(ide_hwif_t* hwif) 56int macide_test_irq(ide_hwif_t *hwif)
57{ 57{
58 if (*ide_ifr & 0x20) 58 if (*ide_ifr & 0x20)
59 return 1; 59 return 1;
@@ -66,7 +66,7 @@ static void macide_clear_irq(ide_drive_t *drive)
66} 66}
67 67
68static 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,
69 int irq, ide_ack_intr_t *ack_intr) 69 int irq)
70{ 70{
71 int i; 71 int i;
72 72
@@ -78,11 +78,11 @@ static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base,
78 hw->io_ports.ctl_addr = base + IDE_CONTROL; 78 hw->io_ports.ctl_addr = base + IDE_CONTROL;
79 79
80 hw->irq = irq; 80 hw->irq = irq;
81 hw->ack_intr = ack_intr;
82} 81}
83 82
84static const struct ide_port_ops macide_port_ops = { 83static const struct ide_port_ops macide_port_ops = {
85 .clear_irq = macide_clear_irq, 84 .clear_irq = macide_clear_irq,
85 .test_irq = macide_test_irq,
86}; 86};
87 87
88static const struct ide_port_info macide_port_info = { 88static const struct ide_port_info macide_port_info = {
@@ -101,7 +101,6 @@ static const char *mac_ide_name[] =
101 101
102static int __init macide_init(void) 102static int __init macide_init(void)
103{ 103{
104 ide_ack_intr_t *ack_intr;
105 unsigned long base; 104 unsigned long base;
106 int irq; 105 int irq;
107 struct ide_hw hw, *hws[] = { &hw }; 106 struct ide_hw hw, *hws[] = { &hw };
@@ -113,17 +112,14 @@ static int __init macide_init(void)
113 switch (macintosh_config->ide_type) { 112 switch (macintosh_config->ide_type) {
114 case MAC_IDE_QUADRA: 113 case MAC_IDE_QUADRA:
115 base = IDE_BASE; 114 base = IDE_BASE;
116 ack_intr = macide_ack_intr;
117 irq = IRQ_NUBUS_F; 115 irq = IRQ_NUBUS_F;
118 break; 116 break;
119 case MAC_IDE_PB: 117 case MAC_IDE_PB:
120 base = IDE_BASE; 118 base = IDE_BASE;
121 ack_intr = macide_ack_intr;
122 irq = IRQ_NUBUS_C; 119 irq = IRQ_NUBUS_C;
123 break; 120 break;
124 case MAC_IDE_BABOON: 121 case MAC_IDE_BABOON:
125 base = BABOON_BASE; 122 base = BABOON_BASE;
126 ack_intr = NULL;
127 d.port_ops = NULL; 123 d.port_ops = NULL;
128 irq = IRQ_BABOON_1; 124 irq = IRQ_BABOON_1;
129 break; 125 break;
@@ -134,7 +130,7 @@ static int __init macide_init(void)
134 printk(KERN_INFO "ide: Macintosh %s IDE controller\n", 130 printk(KERN_INFO "ide: Macintosh %s IDE controller\n",
135 mac_ide_name[macintosh_config->ide_type - 1]); 131 mac_ide_name[macintosh_config->ide_type - 1]);
136 132
137 macide_setup_ports(&hw, base, irq, ack_intr); 133 macide_setup_ports(&hw, base, irq);
138 134
139 return ide_host_add(&d, hws, 1, NULL); 135 return ide_host_add(&d, hws, 1, NULL);
140} 136}
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c
index ab49a97023d9..90786083b439 100644
--- a/drivers/ide/q40ide.c
+++ b/drivers/ide/q40ide.c
@@ -51,9 +51,7 @@ static int q40ide_default_irq(unsigned long base)
51/* 51/*
52 * Addresses are pretranslated for Q40 ISA access. 52 * Addresses are pretranslated for Q40 ISA access.
53 */ 53 */
54static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, 54static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, int irq)
55 ide_ack_intr_t *ack_intr,
56 int irq)
57{ 55{
58 memset(hw, 0, sizeof(*hw)); 56 memset(hw, 0, sizeof(*hw));
59 /* BIG FAT WARNING: 57 /* BIG FAT WARNING:
@@ -69,7 +67,6 @@ static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base,
69 hw->io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206); 67 hw->io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206);
70 68
71 hw->irq = irq; 69 hw->irq = irq;
72 hw->ack_intr = ack_intr;
73} 70}
74 71
75static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, 72static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
@@ -156,7 +153,7 @@ static int __init q40ide_init(void)
156 release_region(pcide_bases[i], 8); 153 release_region(pcide_bases[i], 8);
157 continue; 154 continue;
158 } 155 }
159 q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL, 156 q40_ide_setup_ports(&hw[i], pcide_bases[i],
160 q40ide_default_irq(pcide_bases[i])); 157 q40ide_default_irq(pcide_bases[i]));
161 158
162 hws[i] = &hw[i]; 159 hws[i] = &hw[i];