diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-20 00:32:31 +0200 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-20 00:32:31 +0200 |
commit | baa8f3e94bc7a7ba3650d80b67d54c3e08365dee (patch) | |
tree | caabf63904cd62f758535e16dcc4676ba3ae5095 /drivers/ide/ide.c | |
parent | 8447d9d52adbe4c653482bd0d5ccb9b5d26f9c9d (diff) | |
download | linux-baa8f3e94bc7a7ba3650d80b67d54c3e08365dee.tar.gz linux-baa8f3e94bc7a7ba3650d80b67d54c3e08365dee.tar.bz2 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/ide.c')
-rw-r--r-- | drivers/ide/ide.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 15741367eb35..ce6644f41b21 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -265,6 +265,30 @@ static int ide_system_bus_speed(void) return system_bus_speed; } +ide_hwif_t * ide_find_port(unsigned long base) +{ + ide_hwif_t *hwif; + int i; + + for (i = 0; i < MAX_HWIFS; i++) { + hwif = &ide_hwifs[i]; + if (hwif->io_ports[IDE_DATA_OFFSET] == base) + goto found; + } + + for (i = 0; i < MAX_HWIFS; i++) { + hwif = &ide_hwifs[i]; + if (hwif->io_ports[IDE_DATA_OFFSET] == 0) + goto found; + } + + hwif = NULL; +found: + return hwif; +} + +EXPORT_SYMBOL_GPL(ide_find_port); + static struct resource* hwif_request_region(ide_hwif_t *hwif, unsigned long addr, int num) { |