]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/jmicron.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[linux-2.6] / drivers / ide / pci / jmicron.c
index 0083eaf89c773ca61760b4a180d870e77f9fa8e4..545b6e172d9bcc74b712789edc375d6fd31f6195 100644 (file)
@@ -8,12 +8,11 @@
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/pci.h>
-#include <linux/delay.h>
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/init.h>
 
-#include <asm/io.h>
+#define DRV_NAME "jmicron"
 
 typedef enum {
        PORT_PATA0 = 0,
@@ -22,15 +21,15 @@ typedef enum {
 } port_type;
 
 /**
- *     ata66_jmicron           -       Cable check
+ *     jmicron_cable_detect    -       cable detection
  *     @hwif: IDE port
  *
  *     Returns the cable type.
  */
 
-static u8 __devinit ata66_jmicron(ide_hwif_t *hwif)
+static u8 __devinit jmicron_cable_detect(ide_hwif_t *hwif)
 {
-       struct pci_dev *pdev = hwif->pci_dev;
+       struct pci_dev *pdev = to_pci_dev(hwif->dev);
 
        u32 control;
        u32 control5;
@@ -66,8 +65,7 @@ static u8 __devinit ata66_jmicron(ide_hwif_t *hwif)
         *      actually do our cable checking etc. Thankfully we don't need
         *      to do the plumbing for other cases.
         */
-       switch (port_map[port])
-       {
+       switch (port_map[port]) {
        case PORT_PATA0:
                if (control & (1 << 3)) /* 40/80 pin primary */
                        return ATA_CBL_PATA40;
@@ -99,30 +97,16 @@ static void jmicron_set_dma_mode(ide_drive_t *drive, const u8 mode)
 {
 }
 
-/**
- *     init_hwif_jmicron       -       set up hwif structs
- *     @hwif: interface to set up
- *
- *     Minimal set up is required for the Jmicron hardware.
- */
-
-static void __devinit init_hwif_jmicron(ide_hwif_t *hwif)
-{
-       hwif->set_pio_mode = &jmicron_set_pio_mode;
-       hwif->set_dma_mode = &jmicron_set_dma_mode;
-
-       if (hwif->dma_base == 0)
-               return;
-
-       if (hwif->cbl != ATA_CBL_PATA40_SHORT)
-               hwif->cbl = ata66_jmicron(hwif);
-}
+static const struct ide_port_ops jmicron_port_ops = {
+       .set_pio_mode           = jmicron_set_pio_mode,
+       .set_dma_mode           = jmicron_set_dma_mode,
+       .cable_detect           = jmicron_cable_detect,
+};
 
 static const struct ide_port_info jmicron_chipset __devinitdata = {
-       .name           = "JMB",
-       .init_hwif      = init_hwif_jmicron,
-       .host_flags     = IDE_HFLAG_BOOTABLE,
+       .name           = DRV_NAME,
        .enablebits     = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } },
+       .port_ops       = &jmicron_port_ops,
        .pio_mask       = ATA_PIO5,
        .mwdma_mask     = ATA_MWDMA2,
        .udma_mask      = ATA_UDMA6,
@@ -139,7 +123,7 @@ static const struct ide_port_info jmicron_chipset __devinitdata = {
 
 static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       return ide_setup_pci_device(dev, &jmicron_chipset);
+       return ide_pci_init_one(dev, &jmicron_chipset, NULL);
 }
 
 /* All JMB PATA controllers have and will continue to have the same
@@ -170,6 +154,7 @@ static struct pci_driver driver = {
        .name           = "JMicron IDE",
        .id_table       = jmicron_pci_tbl,
        .probe          = jmicron_init_one,
+       .remove         = ide_pci_remove,
 };
 
 static int __init jmicron_ide_init(void)
@@ -177,7 +162,13 @@ static int __init jmicron_ide_init(void)
        return ide_pci_register_driver(&driver);
 }
 
+static void __exit jmicron_ide_exit(void)
+{
+       pci_unregister_driver(&driver);
+}
+
 module_init(jmicron_ide_init);
+module_exit(jmicron_ide_exit);
 
 MODULE_AUTHOR("Alan Cox");
 MODULE_DESCRIPTION("PCI driver module for the JMicron in legacy modes");