]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/ide/legacy/q40ide.c
gayle: reserve memory resources at once
[karo-tx-linux.git] / drivers / ide / legacy / q40ide.c
index 6f535d00e6389d26ccc1f7187eebe8238dadc498..fcb04b8b02381e622d5f64f45850eda656499657 100644 (file)
@@ -70,6 +70,8 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base,
 
        hw->irq = irq;
        hw->ack_intr = ack_intr;
+
+       hw->chipset = ide_generic;
 }
 
 static void q40ide_input_data(ide_drive_t *drive, struct request *rq,
@@ -110,7 +112,7 @@ static int __init q40ide_init(void)
 {
     int i;
     ide_hwif_t *hwif;
-    const char *name;
+    hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL };
     u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
     if (!MACH_IS_Q40)
@@ -119,9 +121,8 @@ static int __init q40ide_init(void)
     printk(KERN_INFO "ide: Q40 IDE controller\n");
 
     for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
-       hw_regs_t hw;
+       const char *name = q40_ide_names[i];
 
-       name = q40_ide_names[i];
        if (!request_region(pcide_bases[i], 8, name)) {
                printk("could not reserve ports %lx-%lx for %s\n",
                       pcide_bases[i],pcide_bases[i]+8,name);
@@ -133,25 +134,23 @@ static int __init q40ide_init(void)
                release_region(pcide_bases[i], 8);
                continue;
        }
-       q40_ide_setup_ports(&hw, pcide_bases[i],
-                       NULL,
-//                     m68kide_iops,
+       q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL,
                        q40ide_default_irq(pcide_bases[i]));
 
        hwif = ide_find_port();
        if (hwif) {
-               ide_init_port_data(hwif, hwif->index);
-               ide_init_port_hw(hwif, &hw);
+               hwif->chipset = ide_generic;
 
                /* Q40 has a byte-swapped IDE interface */
                hwif->input_data  = q40ide_input_data;
                hwif->output_data = q40ide_output_data;
 
+               hws[i] = &hw[i];
                idx[i] = hwif->index;
        }
     }
 
-    ide_device_add(idx, NULL);
+    ide_device_add(idx, NULL, hws);
 
     return 0;
 }