]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/cs5530.c
ide: drop 'name' parameter from ->init_chipset method
[linux-2.6] / drivers / ide / pci / cs5530.c
index 547690395eee6e3b07bf0c597843ab3a1b0fc106..f235db8c678b5faa326b293899f98f9cb3899a71 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * linux/drivers/ide/pci/cs5530.c              Version 0.77    Sep 24 2007
- *
  * Copyright (C) 2000                  Andre Hedrick <andre@linux-ide.org>
  * Copyright (C) 2000                  Mark Lord <mlord@pobox.com>
  * Copyright (C) 2007                  Bartlomiej Zolnierkiewicz
 #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 DRV_NAME "cs5530"
 
 /*
  * Here are the standard PIO mode 0-4 timings for each "format".
@@ -116,8 +110,6 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
                case XFER_MW_DMA_0:     timings = 0x00077771; break;
                case XFER_MW_DMA_1:     timings = 0x00012121; break;
                case XFER_MW_DMA_2:     timings = 0x00002020; break;
-               default:
-                       return;
        }
        basereg = CS5530_BASEREG(drive->hwif);
        reg = inl(basereg + 4);                 /* get drive0 config register */
@@ -137,12 +129,11 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
 /**
  *     init_chipset_5530       -       set up 5530 bridge
  *     @dev: PCI device
- *     @name: device name
  *
  *     Initialize the cs5530 bridge for reliable IDE DMA operation.
  */
 
-static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_cs5530(struct pci_dev *dev)
 {
        struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
 
@@ -161,11 +152,11 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
                }
        }
        if (!master_0) {
-               printk(KERN_ERR "%s: unable to locate PCI MASTER function\n", name);
+               printk(KERN_ERR DRV_NAME ": unable to locate PCI MASTER function\n");
                goto out;
        }
        if (!cs5530_0) {
-               printk(KERN_ERR "%s: unable to locate CS5530 LEGACY function\n", name);
+               printk(KERN_ERR DRV_NAME ": unable to locate CS5530 LEGACY function\n");
                goto out;
        }
 
@@ -238,29 +229,27 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
        unsigned long basereg;
        u32 d0_timings;
 
-       hwif->set_pio_mode = &cs5530_set_pio_mode;
-       hwif->set_dma_mode = &cs5530_set_dma_mode;
-
        basereg = CS5530_BASEREG(hwif);
        d0_timings = inl(basereg + 0);
        if (CS5530_BAD_PIO(d0_timings))
                outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 0);
        if (CS5530_BAD_PIO(inl(basereg + 8)))
                outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 8);
-
-       if (hwif->dma_base == 0)
-               return;
-
-       hwif->udma_filter = cs5530_udma_filter;
 }
 
+static const struct ide_port_ops cs5530_port_ops = {
+       .set_pio_mode           = cs5530_set_pio_mode,
+       .set_dma_mode           = cs5530_set_dma_mode,
+       .udma_filter            = cs5530_udma_filter,
+};
+
 static const struct ide_port_info cs5530_chipset __devinitdata = {
-       .name           = "CS5530",
+       .name           = DRV_NAME,
        .init_chipset   = init_chipset_cs5530,
        .init_hwif      = init_hwif_cs5530,
+       .port_ops       = &cs5530_port_ops,
        .host_flags     = IDE_HFLAG_SERIALIZE |
-                         IDE_HFLAG_POST_SET_MODE |
-                         IDE_HFLAG_BOOTABLE,
+                         IDE_HFLAG_POST_SET_MODE,
        .pio_mask       = ATA_PIO4,
        .mwdma_mask     = ATA_MWDMA2,
        .udma_mask      = ATA_UDMA2,
@@ -268,7 +257,7 @@ static const struct ide_port_info cs5530_chipset __devinitdata = {
 
 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       return ide_setup_pci_device(dev, &cs5530_chipset);
+       return ide_pci_init_one(dev, &cs5530_chipset, NULL);
 }
 
 static const struct pci_device_id cs5530_pci_tbl[] = {
@@ -281,6 +270,7 @@ static struct pci_driver driver = {
        .name           = "CS5530 IDE",
        .id_table       = cs5530_pci_tbl,
        .probe          = cs5530_init_one,
+       .remove         = ide_pci_remove,
 };
 
 static int __init cs5530_ide_init(void)
@@ -288,7 +278,13 @@ static int __init cs5530_ide_init(void)
        return ide_pci_register_driver(&driver);
 }
 
+static void __exit cs5530_ide_exit(void)
+{
+       pci_unregister_driver(&driver);
+}
+
 module_init(cs5530_ide_init);
+module_exit(cs5530_ide_exit);
 
 MODULE_AUTHOR("Mark Lord");
 MODULE_DESCRIPTION("PCI driver module for Cyrix/NS 5530 IDE");