ide/legacy/q40ide.c: add MODULE_LICENSE
[sfrench/cifs-2.6.git] / drivers / ide / legacy / q40ide.c
index a73db1bd482d6ecbdcf023f72aba169e61595f4b..2da28759686ec5be154c241a4a5ac6875ac3f4b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/legacy/q40ide.c -- Q40 I/O port IDE Driver
+ *  Q40 I/O port IDE Driver
  *
  *     (c) Richard Zidlicky
  *
@@ -66,16 +66,12 @@ static int q40ide_default_irq(unsigned long base)
 
 
 /*
- * This is very similar to ide_setup_ports except that addresses
- * are pretranslated for q40 ISA access
+ * Addresses are pretranslated for Q40 ISA access.
  */
 void q40_ide_setup_ports ( hw_regs_t *hw,
                        unsigned long base, int *offsets,
                        unsigned long ctrl, unsigned long intr,
                        ide_ack_intr_t *ack_intr,
-/*
- *                     ide_io_ops_t *iops,
- */
                        int irq)
 {
        int i;
@@ -92,9 +88,6 @@ void q40_ide_setup_ports ( hw_regs_t *hw,
 
        hw->irq = irq;
        hw->ack_intr = ack_intr;
-/*
- *     hw->iops = iops;
- */
 }
 
 
@@ -111,15 +104,17 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
  *  Probe for Q40 IDE interfaces
  */
 
-void q40ide_init(void)
+static int __init q40ide_init(void)
 {
     int i;
     ide_hwif_t *hwif;
-    int index;
     const char *name;
+    u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
     if (!MACH_IS_Q40)
-      return ;
+      return -ENODEV;
+
+    printk(KERN_INFO "ide: Q40 IDE controller\n");
 
     for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
        hw_regs_t hw;
@@ -141,10 +136,22 @@ void q40ide_init(void)
                        0, NULL,
 //                     m68kide_iops,
                        q40ide_default_irq(pcide_bases[i]));
-       index = ide_register_hw(&hw, NULL, 1, &hwif);
-       // **FIXME**
-       if (index != -1)
+
+       hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+       if (hwif) {
+               ide_init_port_data(hwif, hwif->index);
+               ide_init_port_hw(hwif, &hw);
                hwif->mmio = 1;
+
+               idx[i] = hwif->index;
+       }
     }
+
+    ide_device_add(idx, NULL);
+
+    return 0;
 }
 
+module_init(q40ide_init);
+
+MODULE_LICENSE("GPL");