diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:16 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:16 -0400 |
commit | 3b36f66b81bc0d69ec7dfa736592224f6ca366b7 (patch) | |
tree | b99bf69c108198d14a0f600a600cf2790ca2be84 /drivers/ide | |
parent | e53cd458d593c88247b8a7b2754d0e8055869670 (diff) |
ide: add ide_legacy_device_add() helper
Add ide_legacy_device_add() helper for use by legacy VLB host drivers
(+ convert them to use it).
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-probe.c | 32 | ||||
-rw-r--r-- | drivers/ide/legacy/ali14xx.c | 28 | ||||
-rw-r--r-- | drivers/ide/legacy/dtc2278.c | 27 | ||||
-rw-r--r-- | drivers/ide/legacy/ht6560b.c | 28 | ||||
-rw-r--r-- | drivers/ide/legacy/umc8672.c | 27 |
5 files changed, 36 insertions, 106 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index c3ecc43b894b..8cad2b4c694f 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1633,3 +1633,35 @@ void ide_port_scan(ide_hwif_t *hwif) | |||
1633 | ide_proc_port_register_devices(hwif); | 1633 | ide_proc_port_register_devices(hwif); |
1634 | } | 1634 | } |
1635 | EXPORT_SYMBOL_GPL(ide_port_scan); | 1635 | EXPORT_SYMBOL_GPL(ide_port_scan); |
1636 | |||
1637 | int ide_legacy_device_add(const struct ide_port_info *d) | ||
1638 | { | ||
1639 | ide_hwif_t *hwif, *mate; | ||
1640 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
1641 | hw_regs_t hw[2]; | ||
1642 | |||
1643 | memset(&hw, 0, sizeof(hw)); | ||
1644 | |||
1645 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
1646 | hw[0].irq = 14; | ||
1647 | |||
1648 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
1649 | hw[1].irq = 15; | ||
1650 | |||
1651 | hwif = ide_find_port(); | ||
1652 | if (hwif) { | ||
1653 | ide_init_port_hw(hwif, &hw[0]); | ||
1654 | idx[0] = hwif->index; | ||
1655 | } | ||
1656 | |||
1657 | mate = ide_find_port(); | ||
1658 | if (mate) { | ||
1659 | ide_init_port_hw(mate, &hw[1]); | ||
1660 | idx[1] = mate->index; | ||
1661 | } | ||
1662 | |||
1663 | ide_device_add(idx, d); | ||
1664 | |||
1665 | return 0; | ||
1666 | } | ||
1667 | EXPORT_SYMBOL_GPL(ide_legacy_device_add); | ||
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index a940784d5796..24bd7838aec5 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -205,10 +205,6 @@ static const struct ide_port_info ali14xx_port_info = { | |||
205 | 205 | ||
206 | static int __init ali14xx_probe(void) | 206 | static int __init ali14xx_probe(void) |
207 | { | 207 | { |
208 | ide_hwif_t *hwif, *mate; | ||
209 | static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
210 | hw_regs_t hw[2]; | ||
211 | |||
212 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", | 208 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", |
213 | basePort, regOn); | 209 | basePort, regOn); |
214 | 210 | ||
@@ -218,29 +214,7 @@ static int __init ali14xx_probe(void) | |||
218 | return 1; | 214 | return 1; |
219 | } | 215 | } |
220 | 216 | ||
221 | memset(&hw, 0, sizeof(hw)); | 217 | return ide_legacy_device_add(&ali14xx_port_info); |
222 | |||
223 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
224 | hw[0].irq = 14; | ||
225 | |||
226 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
227 | hw[1].irq = 15; | ||
228 | |||
229 | hwif = ide_find_port(); | ||
230 | if (hwif) { | ||
231 | ide_init_port_hw(hwif, &hw[0]); | ||
232 | idx[0] = hwif->index; | ||
233 | } | ||
234 | |||
235 | mate = ide_find_port(); | ||
236 | if (mate) { | ||
237 | ide_init_port_hw(mate, &hw[1]); | ||
238 | idx[1] = mate->index; | ||
239 | } | ||
240 | |||
241 | ide_device_add(idx, &ali14xx_port_info); | ||
242 | |||
243 | return 0; | ||
244 | } | 218 | } |
245 | 219 | ||
246 | int probe_ali14xx; | 220 | int probe_ali14xx; |
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index a14abb2c23ed..92d119ba92af 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c | |||
@@ -106,9 +106,6 @@ static const struct ide_port_info dtc2278_port_info __initdata = { | |||
106 | static int __init dtc2278_probe(void) | 106 | static int __init dtc2278_probe(void) |
107 | { | 107 | { |
108 | unsigned long flags; | 108 | unsigned long flags; |
109 | ide_hwif_t *hwif, *mate; | ||
110 | static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
111 | hw_regs_t hw[2]; | ||
112 | 109 | ||
113 | local_irq_save(flags); | 110 | local_irq_save(flags); |
114 | /* | 111 | /* |
@@ -128,29 +125,7 @@ static int __init dtc2278_probe(void) | |||
128 | #endif | 125 | #endif |
129 | local_irq_restore(flags); | 126 | local_irq_restore(flags); |
130 | 127 | ||
131 | memset(&hw, 0, sizeof(hw)); | 128 | return ide_legacy_device_add(&dtc2278_port_info); |
132 | |||
133 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
134 | hw[0].irq = 14; | ||
135 | |||
136 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
137 | hw[1].irq = 15; | ||
138 | |||
139 | hwif = ide_find_port(); | ||
140 | if (hwif) { | ||
141 | ide_init_port_hw(hwif, &hw[0]); | ||
142 | idx[0] = hwif->index; | ||
143 | } | ||
144 | |||
145 | mate = ide_find_port(); | ||
146 | if (mate) { | ||
147 | ide_init_port_hw(mate, &hw[1]); | ||
148 | idx[1] = mate->index; | ||
149 | } | ||
150 | |||
151 | ide_device_add(idx, &dtc2278_port_info); | ||
152 | |||
153 | return 0; | ||
154 | } | 129 | } |
155 | 130 | ||
156 | int probe_dtc2278 = 0; | 131 | int probe_dtc2278 = 0; |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 9d45ed3bffaa..e4e38c3cd8ac 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
@@ -346,10 +346,6 @@ static const struct ide_port_info ht6560b_port_info __initdata = { | |||
346 | 346 | ||
347 | static int __init ht6560b_init(void) | 347 | static int __init ht6560b_init(void) |
348 | { | 348 | { |
349 | ide_hwif_t *hwif, *mate; | ||
350 | static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
351 | hw_regs_t hw[2]; | ||
352 | |||
353 | if (probe_ht6560b == 0) | 349 | if (probe_ht6560b == 0) |
354 | return -ENODEV; | 350 | return -ENODEV; |
355 | 351 | ||
@@ -364,29 +360,7 @@ static int __init ht6560b_init(void) | |||
364 | goto release_region; | 360 | goto release_region; |
365 | } | 361 | } |
366 | 362 | ||
367 | memset(&hw, 0, sizeof(hw)); | 363 | return ide_legacy_device_add(&ht6560b_port_info); |
368 | |||
369 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
370 | hw[0].irq = 14; | ||
371 | |||
372 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
373 | hw[1].irq = 15; | ||
374 | |||
375 | hwif = ide_find_port(); | ||
376 | if (hwif) { | ||
377 | ide_init_port_hw(hwif, &hw[0]); | ||
378 | idx[0] = hwif->index; | ||
379 | } | ||
380 | |||
381 | mate = ide_find_port(); | ||
382 | if (mate) { | ||
383 | ide_init_port_hw(mate, &hw[1]); | ||
384 | idx[1] = mate->index; | ||
385 | } | ||
386 | |||
387 | ide_device_add(idx, &ht6560b_port_info); | ||
388 | |||
389 | return 0; | ||
390 | 364 | ||
391 | release_region: | 365 | release_region: |
392 | release_region(HT_CONFIG_PORT, 1); | 366 | release_region(HT_CONFIG_PORT, 1); |
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 757156060a6b..b48ee345f817 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c | |||
@@ -133,10 +133,7 @@ static const struct ide_port_info umc8672_port_info __initdata = { | |||
133 | 133 | ||
134 | static int __init umc8672_probe(void) | 134 | static int __init umc8672_probe(void) |
135 | { | 135 | { |
136 | ide_hwif_t *hwif, *mate; | ||
137 | unsigned long flags; | 136 | unsigned long flags; |
138 | static u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
139 | hw_regs_t hw[2]; | ||
140 | 137 | ||
141 | if (!request_region(0x108, 2, "umc8672")) { | 138 | if (!request_region(0x108, 2, "umc8672")) { |
142 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); | 139 | printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); |
@@ -155,29 +152,7 @@ static int __init umc8672_probe(void) | |||
155 | umc_set_speeds(current_speeds); | 152 | umc_set_speeds(current_speeds); |
156 | local_irq_restore(flags); | 153 | local_irq_restore(flags); |
157 | 154 | ||
158 | memset(&hw, 0, sizeof(hw)); | 155 | return ide_legacy_device_add(&umc8672_port_info); |
159 | |||
160 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
161 | hw[0].irq = 14; | ||
162 | |||
163 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
164 | hw[1].irq = 15; | ||
165 | |||
166 | hwif = ide_find_port(); | ||
167 | if (hwif) { | ||
168 | ide_init_port_hw(hwif, &hw[0]); | ||
169 | idx[0] = hwif->index; | ||
170 | } | ||
171 | |||
172 | mate = ide_find_port(); | ||
173 | if (mate) { | ||
174 | ide_init_port_hw(mate, &hw[1]); | ||
175 | idx[1] = mate->index; | ||
176 | } | ||
177 | |||
178 | ide_device_add(idx, &umc8672_port_info); | ||
179 | |||
180 | return 0; | ||
181 | } | 156 | } |
182 | 157 | ||
183 | int probe_umc8672; | 158 | int probe_umc8672; |