summaryrefslogtreecommitdiffstats
path: root/drivers/ide/arm
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-20 00:32:31 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-20 00:32:31 +0200
commitbaa8f3e94bc7a7ba3650d80b67d54c3e08365dee (patch)
treecaabf63904cd62f758535e16dcc4676ba3ae5095 /drivers/ide/arm
parent8447d9d52adbe4c653482bd0d5ccb9b5d26f9c9d (diff)
downloadop-kernel-dev-baa8f3e94bc7a7ba3650d80b67d54c3e08365dee.zip
op-kernel-dev-baa8f3e94bc7a7ba3650d80b67d54c3e08365dee.tar.gz
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')
-rw-r--r--drivers/ide/arm/icside.c24
-rw-r--r--drivers/ide/arm/rapide.c25
2 files changed, 6 insertions, 43 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 6298932..fda3f87 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -438,35 +438,13 @@ static void icside_dma_init(ide_hwif_t *hwif)
#define icside_dma_init(hwif) (0)
#endif
-static ide_hwif_t *icside_find_hwif(unsigned long dataport)
-{
- ide_hwif_t *hwif;
- int index;
-
- for (index = 0; index < MAX_HWIFS; ++index) {
- hwif = &ide_hwifs[index];
- if (hwif->io_ports[IDE_DATA_OFFSET] == dataport)
- goto found;
- }
-
- for (index = 0; index < MAX_HWIFS; ++index) {
- hwif = &ide_hwifs[index];
- if (!hwif->io_ports[IDE_DATA_OFFSET])
- goto found;
- }
-
- hwif = NULL;
-found:
- return hwif;
-}
-
static ide_hwif_t *
icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec)
{
unsigned long port = (unsigned long)base + info->dataoffset;
ide_hwif_t *hwif;
- hwif = icside_find_hwif(port);
+ hwif = ide_find_port(port);
if (hwif) {
int i;
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 6d2fe21..96cd3f5 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -13,31 +13,16 @@
#include <asm/ecard.h>
-/*
- * Something like this really should be in generic code, but isn't.
- */
static ide_hwif_t *
rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
{
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;
- }
+ ide_hwif_t *hwif = ide_find_port(port);
+ int i;
- for (index = 0; index < MAX_HWIFS; ++index) {
- hwif = ide_hwifs + index;
- if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
- goto found;
- }
-
- return NULL;
+ if (hwif == NULL)
+ goto out;
- found:
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hwif->hw.io_ports[i] = port;
hwif->io_ports[i] = port;
@@ -48,7 +33,7 @@ rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int
hwif->hw.irq = hwif->irq = irq;
hwif->mmio = 1;
default_hwif_mmiops(hwif);
-
+out:
return hwif;
}
OpenPOWER on IntegriCloud