siimage: convert to use ->host_priv
[safe/jmp/linux-2.6] / drivers / ide / pci / delkin_cb.c
index 26aa492..f84bfb4 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  linux/drivers/ide/pci/delkin_cb.c
- *
  *  Created 20 Oct 2004 by Mark Lord
  *
  *  Basic support for Delkin/ASKA/Workbit Cardbus CompactFlash adapter
  *  License.  See the file COPYING in the main directory of this archive for
  *  more details.
  */
-#include <linux/autoconf.h>
+
 #include <linux/types.h>
 #include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/blkdev.h>
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/init.h>
 #include <linux/pci.h>
+
 #include <asm/io.h>
 
 /*
@@ -46,14 +43,23 @@ static const u8 setup[] = {
        0x00, 0x00, 0x00, 0x00, 0xa4, 0x83, 0x02, 0x13,
 };
 
+static const struct ide_port_ops delkin_cb_port_ops = {
+       .quirkproc              = ide_undecoded_slave,
+};
+
+static const struct ide_port_info delkin_cb_port_info = {
+       .port_ops               = &delkin_cb_port_ops,
+       .host_flags             = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS |
+                                 IDE_HFLAG_NO_DMA,
+};
+
 static int __devinit
 delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
 {
+       struct ide_host *host;
        unsigned long base;
-       hw_regs_t hw;
-       ide_hwif_t *hwif = NULL;
-       ide_drive_t *drive;
        int i, rc;
+       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
 
        rc = pci_enable_device(dev);
        if (rc) {
@@ -73,36 +79,35 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
                if (setup[i])
                        outb(setup[i], base + i);
        }
-       pci_release_regions(dev);       /* IDE layer handles regions itself */
 
        memset(&hw, 0, sizeof(hw));
        ide_std_init_ports(&hw, base + 0x10, base + 0x1e);
        hw.irq = dev->irq;
+       hw.dev = &dev->dev;
        hw.chipset = ide_pci;           /* this enables IRQ sharing */
 
-       rc = ide_register_hw(&hw, &ide_undecoded_slave, &hwif);
-       if (rc < 0) {
-               printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc);
-               pci_disable_device(dev);
-               return -ENODEV;
-       }
-       pci_set_drvdata(dev, hwif);
-       hwif->pci_dev = dev;
-       drive = &hwif->drives[0];
-       if (drive->present) {
-               drive->io_32bit = 1;
-               drive->unmask   = 1;
-       }
+       rc = ide_host_add(&delkin_cb_port_info, hws, &host);
+       if (rc)
+               goto out_disable;
+
+       pci_set_drvdata(dev, host);
+
        return 0;
+
+out_disable:
+       pci_release_regions(dev);
+       pci_disable_device(dev);
+       return rc;
 }
 
 static void
 delkin_cb_remove (struct pci_dev *dev)
 {
-       ide_hwif_t *hwif = pci_get_drvdata(dev);
+       struct ide_host *host = pci_get_drvdata(dev);
 
-       if (hwif)
-               ide_unregister(hwif->index);
+       ide_host_remove(host);
+
+       pci_release_regions(dev);
        pci_disable_device(dev);
 }
 
@@ -120,14 +125,12 @@ static struct pci_driver driver = {
        .remove         = delkin_cb_remove,
 };
 
-static int
-delkin_cb_init (void)
+static int __init delkin_cb_init(void)
 {
        return pci_register_driver(&driver);
 }
 
-static void
-delkin_cb_exit (void)
+static void __exit delkin_cb_exit(void)
 {
        pci_unregister_driver(&driver);
 }