summaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/ide_platform.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz2007-10-20 00:32:31 +0200
committerBartlomiej Zolnierkiewicz2007-10-20 00:32:31 +0200
commitbaa8f3e94bc7a7ba3650d80b67d54c3e08365dee (patch)
treecaabf63904cd62f758535e16dcc4676ba3ae5095 /drivers/ide/legacy/ide_platform.c
parentide: add ide_device_add() (diff)
downloadkernel-qcow2-linux-baa8f3e94bc7a7ba3650d80b67d54c3e08365dee.tar.gz
kernel-qcow2-linux-baa8f3e94bc7a7ba3650d80b67d54c3e08365dee.tar.xz
kernel-qcow2-linux-baa8f3e94bc7a7ba3650d80b67d54c3e08365dee.zip
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.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,
int mmio)
{
unsigned long port = (unsigned long)base;
- ide_hwif_t *hwif;
- int index, i;
-
- for (index = 0; index < MAX_HWIFS; ++index) {
- hwif = ide_hwifs + index;
- if (hwif->io_ports[IDE_DATA_OFFSET] == port)
- goto found;
- }
-
- for (index = 0; index < MAX_HWIFS; ++index) {
- hwif = ide_hwifs + index;
- if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
- goto found;
- }
+ ide_hwif_t *hwif = ide_find_port(port);
+ int i;
- return NULL;
-
-found:
+ if (hwif == NULL)
+ goto out;
hwif->hw.io_ports[IDE_DATA_OFFSET] = port;
@@ -73,8 +60,8 @@ found:
}
hwif_prop.hwif = hwif;
- hwif_prop.index = index;
-
+ hwif_prop.index = hwif->index;
+out:
return hwif;
}