diff options
-rw-r--r-- | drivers/ide/ide.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 0d7328e0fb9..8ef521f66f8 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -694,6 +694,15 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), int index, retry = 1; ide_hwif_t *hwif; + if (initializing) { + hwif = ide_find_port(hw->io_ports[IDE_DATA_OFFSET]); + if (hwif) { + index = hwif->index; + goto found; + } + return -1; + } + do { for (index = 0; index < MAX_HWIFS; ++index) { hwif = &ide_hwifs[index]; @@ -704,8 +713,7 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), hwif = &ide_hwifs[index]; if (hwif->hold) continue; - if ((!hwif->present && !hwif->mate && !initializing) || - (!hwif->io_ports[IDE_DATA_OFFSET] && initializing)) + if (!hwif->present && hwif->mate == NULL) goto found; } for (index = 0; index < MAX_HWIFS; index++) |