aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/ide_platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/legacy/ide_platform.c')
-rw-r--r--drivers/ide/legacy/ide_platform.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index 9a153915f3cf..d1e76fa7869e 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -33,24 +33,11 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base,
33 int mmio) 33 int mmio)
34{ 34{
35 unsigned long port = (unsigned long)base; 35 unsigned long port = (unsigned long)base;
36 ide_hwif_t *hwif; 36 ide_hwif_t *hwif = ide_find_port(port);
37 int index, i; 37 int i;
38
39 for (index = 0; index < MAX_HWIFS; ++index) {
40 hwif = ide_hwifs + index;
41 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
42 goto found;
43 }
44
45 for (index = 0; index < MAX_HWIFS; ++index) {
46 hwif = ide_hwifs + index;
47 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
48 goto found;
49 }
50 38
51 return NULL; 39 if (hwif == NULL)
52 40 goto out;
53found:
54 41
55 hwif->hw.io_ports[IDE_DATA_OFFSET] = port; 42 hwif->hw.io_ports[IDE_DATA_OFFSET] = port;
56 43
@@ -73,8 +60,8 @@ found:
73 } 60 }
74 61
75 hwif_prop.hwif = hwif; 62 hwif_prop.hwif = hwif;
76 hwif_prop.index = index; 63 hwif_prop.index = hwif->index;
77 64out:
78 return hwif; 65 return hwif;
79} 66}
80 67