]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/siimage.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6] / drivers / ide / pci / siimage.c
index 1388ffa97644c34ef31ecd702d0b6039a264854d..445ce6fbea335a6291c3ad47b4b92ac4adcf40d8 100644 (file)
@@ -44,6 +44,8 @@
 #include <linux/init.h>
 #include <linux/io.h>
 
+#define DRV_NAME "siimage"
+
 /**
  *     pdev_is_sata            -       check if device is SATA
  *     @pdev:  PCI device to check
@@ -455,14 +457,12 @@ static void sil_sata_pre_reset(ide_drive_t *drive)
 /**
  *     init_chipset_siimage    -       set up an SI device
  *     @dev: PCI device
- *     @name: device name
  *
  *     Perform the initial PCI set up for this device. Attempt to switch
  *     to 133 MHz clocking if the system isn't already set up to do it.
  */
 
-static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev,
-                                                  const char *name)
+static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev)
 {
        struct ide_host *host = pci_get_drvdata(dev);
        void __iomem *ioaddr = host->host_priv;
@@ -539,7 +539,8 @@ static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev,
                        { "== 100", "== 133", "== 2X PCI", "DISABLED!" };
 
                tmp >>= 4;
-               printk(KERN_INFO "%s: BASE CLOCK %s\n", name, clk_str[tmp & 3]);
+               printk(KERN_INFO DRV_NAME " %s: BASE CLOCK %s\n",
+                       pci_name(dev), clk_str[tmp & 3]);
        }
 
        return 0;
@@ -638,7 +639,7 @@ static int is_dev_seagate_sata(ide_drive_t *drive)
  *     that can occur before we know what drives are present.
  */
 
-static void __devinit sil_quirkproc(ide_drive_t *drive)
+static void sil_quirkproc(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
 
@@ -678,7 +679,7 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif)
  *     Check for the presence of an ATA66 capable cable on the interface.
  */
 
-static u8 __devinit sil_cable_detect(ide_hwif_t *hwif)
+static u8 sil_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
        unsigned long addr      = siimage_selreg(hwif, 0);
@@ -716,9 +717,9 @@ static const struct ide_dma_ops sil_dma_ops = {
        .dma_lost_irq           = ide_dma_lost_irq,
 };
 
-#define DECLARE_SII_DEV(name_str, p_ops)               \
+#define DECLARE_SII_DEV(p_ops)                         \
        {                                               \
-               .name           = name_str,             \
+               .name           = DRV_NAME,             \
                .init_chipset   = init_chipset_siimage, \
                .init_iops      = init_iops_siimage,    \
                .port_ops       = p_ops,                \
@@ -729,9 +730,8 @@ static const struct ide_dma_ops sil_dma_ops = {
        }
 
 static const struct ide_port_info siimage_chipsets[] __devinitdata = {
-       /* 0 */ DECLARE_SII_DEV("SiI680",               &sil_pata_port_ops),
-       /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA",   &sil_sata_port_ops),
-       /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA",   &sil_sata_port_ops)
+       /* 0: SiI680 */  DECLARE_SII_DEV(&sil_pata_port_ops),
+       /* 1: SiI3112 */ DECLARE_SII_DEV(&sil_sata_port_ops)
 };
 
 /**
@@ -760,7 +760,7 @@ static int __devinit siimage_init_one(struct pci_dev *dev,
                static int first = 1;
 
                if (first) {
-                       printk(KERN_INFO "siimage: For full SATA support you "
+                       printk(KERN_INFO DRV_NAME ": For full SATA support you "
                                "should use the libata sata_sil module.\n");
                        first = 0;
                }
@@ -779,8 +779,8 @@ static int __devinit siimage_init_one(struct pci_dev *dev,
                * seem to get terminally confused in the PCI spaces.
                */
                if (!request_mem_region(bar5, barsize, d.name)) {
-                       printk(KERN_WARNING "siimage: IDE controller MMIO "
-                                           "ports not available.\n");
+                       printk(KERN_WARNING DRV_NAME " %s: MMIO ports not "
+                               "available\n", pci_name(dev));
                } else {
                        ioaddr = ioremap(bar5, barsize);
                        if (ioaddr == NULL)
@@ -800,11 +800,29 @@ static int __devinit siimage_init_one(struct pci_dev *dev,
        return rc;
 }
 
+static void __devexit siimage_remove(struct pci_dev *dev)
+{
+       struct ide_host *host = pci_get_drvdata(dev);
+       void __iomem *ioaddr = host->host_priv;
+
+       ide_pci_remove(dev);
+
+       if (ioaddr) {
+               resource_size_t bar5 = pci_resource_start(dev, 5);
+               unsigned long barsize = pci_resource_len(dev, 5);
+
+               iounmap(ioaddr);
+               release_mem_region(bar5, barsize);
+       }
+
+       pci_disable_device(dev);
+}
+
 static const struct pci_device_id siimage_pci_tbl[] = {
        { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_680),    0 },
 #ifdef CONFIG_BLK_DEV_IDE_SATA
        { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_3112),   1 },
-       { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_1210SA), 2 },
+       { PCI_VDEVICE(CMD, PCI_DEVICE_ID_SII_1210SA), 1 },
 #endif
        { 0, },
 };
@@ -814,6 +832,7 @@ static struct pci_driver driver = {
        .name           = "SiI_IDE",
        .id_table       = siimage_pci_tbl,
        .probe          = siimage_init_one,
+       .remove         = siimage_remove,
 };
 
 static int __init siimage_ide_init(void)
@@ -821,7 +840,13 @@ static int __init siimage_ide_init(void)
        return ide_pci_register_driver(&driver);
 }
 
+static void __exit siimage_ide_exit(void)
+{
+       pci_unregister_driver(&driver);
+}
+
 module_init(siimage_ide_init);
+module_exit(siimage_ide_exit);
 
 MODULE_AUTHOR("Andre Hedrick, Alan Cox");
 MODULE_DESCRIPTION("PCI driver module for SiI IDE");