Add ide_cfg_mtx lock/unlock to ide_port_setup_devices() and then move
ide_port_setup_devices() call from init_irq() to ide_device_add_all().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
 {
        int i;
 
+       mutex_lock(&ide_cfg_mtx);
        for (i = 0; i < MAX_DRIVES; i++) {
                ide_drive_t *drive = &hwif->drives[i];
 
 
                ide_add_drive_to_hwgroup(drive);
        }
+       mutex_unlock(&ide_cfg_mtx);
 }
 
 /*
                        hwif->sharing_irq ? "shar" : "serializ", match->name);
        printk("\n");
 
-       ide_port_setup_devices(hwif);
-
        mutex_unlock(&ide_cfg_mtx);
        return 0;
 out_unlink:
                        continue;
                }
 
+               ide_port_setup_devices(hwif);
+
                ide_acpi_init(hwif);
                ide_acpi_port_init_devices(hwif);
        }