ide: ->cable_detect method cannot be marked __devinit
[pandora-kernel.git] / drivers / ide / pci / it821x.c
index e63fdaf..b6dc723 100644 (file)
@@ -67,6 +67,8 @@
 #include <linux/ide.h>
 #include <linux/init.h>
 
+#define DRV_NAME "it821x"
+
 struct it821x_dev
 {
        unsigned int smart:1,           /* Are we in smart raid mode */
@@ -426,7 +428,7 @@ static void it821x_set_dma_mode(ide_drive_t *drive, const u8 speed)
  *     the needed logic onboard.
  */
 
-static u8 __devinit it821x_cable_detect(ide_hwif_t *hwif)
+static u8 it821x_cable_detect(ide_hwif_t *hwif)
 {
        /* The reference driver also only does disk side */
        return ATA_CBL_PATA80;
@@ -441,7 +443,7 @@ static u8 __devinit it821x_cable_detect(ide_hwif_t *hwif)
  *     final tuning that is needed, or fixups to work around bugs.
  */
 
-static void __devinit it821x_quirkproc(ide_drive_t *drive)
+static void it821x_quirkproc(ide_drive_t *drive)
 {
        struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif);
        struct hd_driveid *id = drive->id;
@@ -569,7 +571,8 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
                idev->timing10 = 1;
                hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
                if (idev->smart == 0)
-                       printk(KERN_WARNING "it821x: Revision 0x10, workarounds activated.\n");
+                       printk(KERN_WARNING DRV_NAME " %s: revision 0x10, "
+                               "workarounds activated\n", pci_name(dev));
        }
 
        if (idev->smart == 0) {
@@ -602,18 +605,20 @@ static void __devinit it8212_disable_raid(struct pci_dev *dev)
        pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20);
 }
 
-static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev)
 {
        u8 conf;
        static char *mode[2] = { "pass through", "smart" };
 
        /* Force the card into bypass mode if so requested */
        if (it8212_noraid) {
-               printk(KERN_INFO "it8212: forcing bypass mode.\n");
+               printk(KERN_INFO DRV_NAME " %s: forcing bypass mode\n",
+                       pci_name(dev));
                it8212_disable_raid(dev);
        }
        pci_read_config_byte(dev, 0x50, &conf);
-       printk(KERN_INFO "it821x: controller in %s mode.\n", mode[conf & 1]);
+       printk(KERN_INFO DRV_NAME " %s: controller in %s mode\n",
+               pci_name(dev), mode[conf & 1]);
        return 0;
 }
 
@@ -625,17 +630,12 @@ static const struct ide_port_ops it821x_port_ops = {
        .cable_detect           = it821x_cable_detect,
 };
 
-#define DECLARE_ITE_DEV(name_str)                      \
-       {                                               \
-               .name           = name_str,             \
-               .init_chipset   = init_chipset_it821x,  \
-               .init_hwif      = init_hwif_it821x,     \
-               .port_ops       = &it821x_port_ops,     \
-               .pio_mask       = ATA_PIO4,             \
-       }
-
-static const struct ide_port_info it821x_chipsets[] __devinitdata = {
-       /* 0 */ DECLARE_ITE_DEV("IT8212"),
+static const struct ide_port_info it821x_chipset __devinitdata = {
+       .name           = DRV_NAME,
+       .init_chipset   = init_chipset_it821x,
+       .init_hwif      = init_hwif_it821x,
+       .port_ops       = &it821x_port_ops,
+       .pio_mask       = ATA_PIO4,
 };
 
 /**
@@ -654,17 +654,26 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic
 
        itdevs = kzalloc(2 * sizeof(*itdevs), GFP_KERNEL);
        if (itdevs == NULL) {
-               printk(KERN_ERR "it821x: out of memory\n");
+               printk(KERN_ERR DRV_NAME " %s: out of memory\n", pci_name(dev));
                return -ENOMEM;
        }
 
-       rc = ide_pci_init_one(dev, &it821x_chipsets[id->driver_data], itdevs);
+       rc = ide_pci_init_one(dev, &it821x_chipset, itdevs);
        if (rc)
                kfree(itdevs);
 
        return rc;
 }
 
+static void __devexit it821x_remove(struct pci_dev *dev)
+{
+       struct ide_host *host = pci_get_drvdata(dev);
+       struct it821x_dev *itdevs = host->host_priv;
+
+       ide_pci_remove(dev);
+       kfree(itdevs);
+}
+
 static const struct pci_device_id it821x_pci_tbl[] = {
        { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 },
        { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 },
@@ -677,6 +686,7 @@ static struct pci_driver driver = {
        .name           = "ITE821x IDE",
        .id_table       = it821x_pci_tbl,
        .probe          = it821x_init_one,
+       .remove         = it821x_remove,
 };
 
 static int __init it821x_ide_init(void)
@@ -684,7 +694,13 @@ static int __init it821x_ide_init(void)
        return ide_pci_register_driver(&driver);
 }
 
+static void __exit it821x_ide_exit(void)
+{
+       pci_unregister_driver(&driver);
+}
+
 module_init(it821x_ide_init);
+module_exit(it821x_ide_exit);
 
 module_param_named(noraid, it8212_noraid, int, S_IRUGO);
 MODULE_PARM_DESC(noraid, "Force card into bypass mode");