complete(&hwif->gendev_rel_comp);
 }
 
-static void hwif_register (ide_hwif_t *hwif)
+static void ide_register_port(ide_hwif_t *hwif)
 {
        int ret;
 
 {
        unsigned long flags;
        unsigned int irqd;
-       int unit;
+       int unit, rc = -ENODEV;
+
+       BUG_ON(hwif->present);
 
        if (hwif->noprobe)
                return -EACCES;
                ide_drive_t *drive = &hwif->drives[unit];
                drive->dn = (hwif->channel ? 2 : 0) + unit;
                (void) probe_for_drive(drive);
-               if (drive->present && !hwif->present) {
-                       hwif->present = 1;
-                       if (hwif->chipset != ide_4drives ||
-                           !hwif->mate || 
-                           !hwif->mate->present) {
-                               hwif_register(hwif);
-                       }
-               }
+               if (drive->present)
+                       rc = 0;
        }
        if (hwif->io_ports[IDE_CONTROL_OFFSET] && hwif->reset) {
                printk(KERN_WARNING "%s: reset\n", hwif->name);
        if (irqd)
                enable_irq(irqd);
 
-       if (!hwif->present)
-               return -ENODEV;
-
-       return 0;
+       return rc;
 }
 
 static void ide_port_tune_devices(ide_hwif_t *hwif)
                        continue;
                }
 
+               hwif->present = 1;
+
+               if (hwif->chipset != ide_4drives || !hwif->mate ||
+                   !hwif->mate->present)
+                       ide_register_port(hwif);
+
                ide_port_tune_devices(hwif);
        }