Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / ide / legacy / falconide.c
index 3e2c612..724f950 100644 (file)
@@ -112,11 +112,12 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
 
 static int __init falconide_init(void)
 {
-       ide_hwif_t *hwif;
+       struct ide_host *host;
        hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
+       int rc;
 
        if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
-               return 0;
+               return -ENODEV;
 
        printk(KERN_INFO "ide: Falcon IDE controller\n");
 
@@ -127,17 +128,25 @@ static int __init falconide_init(void)
 
        falconide_setup_ports(&hw);
 
-       hwif = ide_find_port();
-       if (hwif) {
-               u8 index = hwif->index;
-               u8 idx[4] = { index, 0xff, 0xff, 0xff };
-
-               ide_get_lock(NULL, NULL);
-               ide_device_add(idx, &falconide_port_info, hws);
-               ide_release_lock();
+       host = ide_host_alloc(&falconide_port_info, hws);
+       if (host == NULL) {
+               rc = -ENOMEM;
+               goto err;
        }
 
+       ide_get_lock(NULL, NULL);
+       rc = ide_host_register(host, &falconide_port_info, hws);
+       ide_release_lock();
+
+       if (rc)
+               goto err_free;
+
        return 0;
+err_free:
+       ide_host_free(host);
+err:
+       release_mem_region(ATA_HD_BASE, 0x40);
+       return rc;
 }
 
 module_init(falconide_init);