]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/via82cxxx.c
Merge branch 'header-move' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemo...
[linux-2.6] / drivers / ide / pci / via82cxxx.c
index bc1675da37d10a1df29f397f4dabfec5942a0323..a6b2cc83f293cbcf34a97eec5d0b071a2905955e 100644 (file)
@@ -35,6 +35,8 @@
 #include <asm/processor.h>
 #endif
 
+#define DRV_NAME "via82cxxx"
+
 #define VIA_IDE_ENABLE         0x40
 #define VIA_IDE_CONFIG         0x41
 #define VIA_FIFO_CONFIG                0x43
@@ -260,13 +262,12 @@ static void __devinit via_cable_detect(struct via82cxxx_dev *vdev, u32 u)
 /**
  *     init_chipset_via82cxxx  -       initialization handler
  *     @dev: PCI device
- *     @name: Name of interface
  *
  *     The initialization callback. Here we determine the IDE chip type
  *     and initialize its drive independent registers.
  */
 
-static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev)
 {
        struct ide_host *host = pci_get_drvdata(dev);
        struct via82cxxx_dev *vdev = host->host_priv;
@@ -351,7 +352,7 @@ static int via_cable_override(struct pci_dev *pdev)
        return 0;
 }
 
-static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif)
+static u8 via82cxxx_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *pdev = to_pci_dev(hwif->dev);
        struct ide_host *host = pci_get_drvdata(pdev);
@@ -373,7 +374,7 @@ static const struct ide_port_ops via_port_ops = {
 };
 
 static const struct ide_port_info via82cxxx_chipset __devinitdata = {
-       .name           = "VP_IDE",
+       .name           = DRV_NAME,
        .init_chipset   = init_chipset_via82cxxx,
        .enablebits     = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
        .port_ops       = &via_port_ops,
@@ -401,20 +402,19 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
         */
        via_config = via_config_find(&isa);
        if (!via_config->id) {
-               printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n");
+               printk(KERN_WARNING DRV_NAME " %s: unknown chipset, skipping\n",
+                       pci_name(dev));
                return -ENODEV;
        }
 
        /*
         * Print the boot message.
         */
-       printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s "
-               "controller on pci%s\n",
-               via_config->name, isa->revision,
+       printk(KERN_INFO DRV_NAME " %s: VIA %s (rev %02x) IDE %sDMA%s\n",
+               pci_name(dev), via_config->name, isa->revision,
                via_config->udma_mask ? "U" : "MW",
                via_dma[via_config->udma_mask ?
-                       (fls(via_config->udma_mask) - 1) : 0],
-               pci_name(dev));
+                       (fls(via_config->udma_mask) - 1) : 0]);
 
        pci_dev_put(isa);
 
@@ -430,9 +430,9 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
        }
 
        if (via_clock < 20000 || via_clock > 50000) {
-               printk(KERN_WARNING "VP_IDE: User given PCI clock speed "
+               printk(KERN_WARNING DRV_NAME ": User given PCI clock speed "
                        "impossible (%d), using 33 MHz instead.\n", via_clock);
-               printk(KERN_WARNING "VP_IDE: Use ide0=ata66 if you want "
+               printk(KERN_WARNING DRV_NAME ": Use ide0=ata66 if you want "
                        "to assume 80-wire cable.\n");
                via_clock = 33333;
        }
@@ -454,7 +454,8 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
 
        vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
        if (!vdev) {
-               printk(KERN_ERR "VP_IDE: out of memory :(\n");
+               printk(KERN_ERR DRV_NAME " %s: out of memory :(\n",
+                       pci_name(dev));
                return -ENOMEM;
        }
 
@@ -467,6 +468,15 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
        return rc;
 }
 
+static void __devexit via_remove(struct pci_dev *dev)
+{
+       struct ide_host *host = pci_get_drvdata(dev);
+       struct via82cxxx_dev *vdev = host->host_priv;
+
+       ide_pci_remove(dev);
+       kfree(vdev);
+}
+
 static const struct pci_device_id via_pci_tbl[] = {
        { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1),  0 },
        { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C586_1),  0 },
@@ -481,6 +491,7 @@ static struct pci_driver driver = {
        .name           = "VIA_IDE",
        .id_table       = via_pci_tbl,
        .probe          = via_init_one,
+       .remove         = via_remove,
 };
 
 static int __init via_ide_init(void)
@@ -488,7 +499,13 @@ static int __init via_ide_init(void)
        return ide_pci_register_driver(&driver);
 }
 
+static void __exit via_ide_exit(void)
+{
+       pci_unregister_driver(&driver);
+}
+
 module_init(via_ide_init);
+module_exit(via_ide_exit);
 
 MODULE_AUTHOR("Vojtech Pavlik, Michel Aubry, Jeff Garzik, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for VIA IDE");