aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/arm/rapide.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-19 18:32:31 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-19 18:32:31 -0400
commitbaa8f3e94bc7a7ba3650d80b67d54c3e08365dee (patch)
treecaabf63904cd62f758535e16dcc4676ba3ae5095 /drivers/ide/arm/rapide.c
parent8447d9d52adbe4c653482bd0d5ccb9b5d26f9c9d (diff)
ide: add ide_find_port() helper
* Add ide_find_port() helper. * Convert icside, rapide and ide_platform host drivers to use it. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm/rapide.c')
-rw-r--r--drivers/ide/arm/rapide.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 6d2fe21cd729..96cd3f5b9adc 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -13,31 +13,16 @@
13 13
14#include <asm/ecard.h> 14#include <asm/ecard.h>
15 15
16/*
17 * Something like this really should be in generic code, but isn't.
18 */
19static ide_hwif_t * 16static ide_hwif_t *
20rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) 17rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
21{ 18{
22 unsigned long port = (unsigned long)base; 19 unsigned long port = (unsigned long)base;
23 ide_hwif_t *hwif; 20 ide_hwif_t *hwif = ide_find_port(port);
24 int index, i; 21 int i;
25
26 for (index = 0; index < MAX_HWIFS; ++index) {
27 hwif = ide_hwifs + index;
28 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
29 goto found;
30 }
31 22
32 for (index = 0; index < MAX_HWIFS; ++index) { 23 if (hwif == NULL)
33 hwif = ide_hwifs + index; 24 goto out;
34 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
35 goto found;
36 }
37
38 return NULL;
39 25
40 found:
41 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 26 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
42 hwif->hw.io_ports[i] = port; 27 hwif->hw.io_ports[i] = port;
43 hwif->io_ports[i] = port; 28 hwif->io_ports[i] = port;
@@ -48,7 +33,7 @@ rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int
48 hwif->hw.irq = hwif->irq = irq; 33 hwif->hw.irq = hwif->irq = irq;
49 hwif->mmio = 1; 34 hwif->mmio = 1;
50 default_hwif_mmiops(hwif); 35 default_hwif_mmiops(hwif);
51 36out:
52 return hwif; 37 return hwif;
53} 38}
54 39