diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-19 18:32:31 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-19 18:32:31 -0400 |
commit | baa8f3e94bc7a7ba3650d80b67d54c3e08365dee (patch) | |
tree | caabf63904cd62f758535e16dcc4676ba3ae5095 /drivers/ide/legacy/ide_platform.c | |
parent | 8447d9d52adbe4c653482bd0d5ccb9b5d26f9c9d (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/legacy/ide_platform.c')
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 25 |
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; | |
53 | found: | ||
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 | 64 | out: | |
78 | return hwif; | 65 | return hwif; |
79 | } | 66 | } |
80 | 67 | ||