* Factor out cable detection from ide_init_port() to ide_port_cable_detect().
* Move ide_port_cable_detect() call to ide_device_add_all().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
        /* call chipset specific routine for each enabled port */
        if (d->init_hwif)
                d->init_hwif(hwif);
+}
 
+static void ide_port_cable_detect(ide_hwif_t *hwif)
+{
        if (hwif->cable_detect && (hwif->ultra_mask & 0x78)) {
                if (hwif->cbl != ATA_CBL_PATA40_SHORT)
                        hwif->cbl = hwif->cable_detect(hwif);
                mate = (i & 1) ? NULL : hwif;
 
                ide_init_port(hwif, i & 1, d);
+               ide_port_cable_detect(hwif);
                ide_port_init_devices(hwif);
        }