]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/hpt34x.c
hpt34x: add ->remove method and module_exit()
[linux-2.6] / drivers / ide / pci / hpt34x.c
index 25dbb814822d6410e92ec4e8852bf53c79a325ee..b52f8339102e75b6388f1e53aa53cd70e7a2597a 100644 (file)
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
 #include <linux/ioport.h>
-#include <linux/blkdev.h>
 #include <linux/hdreg.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/ide.h>
 
-#include <asm/io.h>
-#include <asm/irq.h>
-
 #define HPT343_DEBUG_DRIVE_INFO                0
 
 static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed)
@@ -122,32 +115,28 @@ static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const cha
        return dev->irq;
 }
 
-static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
-{
-       hwif->set_pio_mode = &hpt34x_set_pio_mode;
-       hwif->set_dma_mode = &hpt34x_set_mode;
-}
+static const struct ide_port_ops hpt34x_port_ops = {
+       .set_pio_mode           = hpt34x_set_pio_mode,
+       .set_dma_mode           = hpt34x_set_mode,
+};
 
 #define IDE_HFLAGS_HPT34X \
        (IDE_HFLAG_NO_ATAPI_DMA | \
         IDE_HFLAG_NO_DSC | \
-        IDE_HFLAG_ABUSE_SET_DMA_MODE | \
         IDE_HFLAG_NO_AUTODMA)
 
 static const struct ide_port_info hpt34x_chipsets[] __devinitdata = {
        { /* 0 */
                .name           = "HPT343",
                .init_chipset   = init_chipset_hpt34x,
-               .init_hwif      = init_hwif_hpt34x,
-               .extra          = 16,
-               .host_flags     = IDE_HFLAGS_HPT34X,
+               .port_ops       = &hpt34x_port_ops,
+               .host_flags     = IDE_HFLAGS_HPT34X | IDE_HFLAG_NON_BOOTABLE,
                .pio_mask       = ATA_PIO5,
        },
        { /* 1 */
                .name           = "HPT345",
                .init_chipset   = init_chipset_hpt34x,
-               .init_hwif      = init_hwif_hpt34x,
-               .extra          = 16,
+               .port_ops       = &hpt34x_port_ops,
                .host_flags     = IDE_HFLAGS_HPT34X | IDE_HFLAG_OFF_BOARD,
                .pio_mask       = ATA_PIO5,
 #ifdef CONFIG_HPT34X_AUTODMA
@@ -167,7 +156,7 @@ static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_devic
 
        d = &hpt34x_chipsets[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0];
 
-       return ide_setup_pci_device(dev, d);
+       return ide_pci_init_one(dev, d, NULL);
 }
 
 static const struct pci_device_id hpt34x_pci_tbl[] = {
@@ -180,6 +169,7 @@ static struct pci_driver driver = {
        .name           = "HPT34x_IDE",
        .id_table       = hpt34x_pci_tbl,
        .probe          = hpt34x_init_one,
+       .remove         = ide_pci_remove,
 };
 
 static int __init hpt34x_ide_init(void)
@@ -187,7 +177,13 @@ static int __init hpt34x_ide_init(void)
        return ide_pci_register_driver(&driver);
 }
 
+static void __exit hpt34x_ide_exit(void)
+{
+       pci_unregister_driver(&driver);
+}
+
 module_init(hpt34x_ide_init);
+module_exit(hpt34x_ide_exit);
 
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for Highpoint 34x IDE");