Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71755
b: refs/heads/master
c: baa8f3e
h: refs/heads/master
i:
  71753: dd1f929
  71751: 67435a9
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 19, 2007
1 parent 5a716a1 commit 41999c9
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 63 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8447d9d52adbe4c653482bd0d5ccb9b5d26f9c9d
refs/heads/master: baa8f3e94bc7a7ba3650d80b67d54c3e08365dee
24 changes: 1 addition & 23 deletions trunk/drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
25 changes: 5 additions & 20 deletions trunk/drivers/ide/arm/rapide.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
24 changes: 24 additions & 0 deletions trunk/drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
25 changes: 6 additions & 19 deletions trunk/drivers/ide/legacy/ide_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -73,8 +60,8 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base,
}

hwif_prop.hwif = hwif;
hwif_prop.index = index;

hwif_prop.index = hwif->index;
out:
return hwif;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ typedef struct hw_regs_s {
struct device *dev;
} hw_regs_t;

struct hwif_s * ide_find_port(unsigned long);

int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int,
struct hwif_s **);

Expand Down

0 comments on commit 41999c9

Please sign in to comment.