X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fide%2Fpci%2Fcy82c693.c;h=bfae2f882f48d48ec75ab4fb304ac5aa4321892c;hb=2fdc86901d2ab30a12402b46238951d2a7891590;hp=e14ad5530fa4b0c1e1369387d43e4e73d8ac8b7b;hpb=cdbfc557c43ea1f1f9b7062300ecb1254969814b;p=linux-2.6 diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index e14ad5530f..bfae2f882f 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -48,6 +48,8 @@ #include +#define DRV_NAME "cy82c693" + /* the current version */ #define CY82_VERSION "CY82C693U driver v0.34 99-13-12 Andreas S. Krebs (akrebs@altavista.net)" @@ -330,7 +332,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) /* * this function is called during init and is used to setup the cy82c693 chip */ -static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev) { if (PCI_FUNC(dev->devfn) != 1) return 0; @@ -349,8 +351,8 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c data = inb(CY82_DATA_PORT); #if CY82C693_DEBUG_INFO - printk(KERN_INFO "%s: Peripheral Configuration Register: 0x%X\n", - name, data); + printk(KERN_INFO DRV_NAME ": Peripheral Configuration Register: 0x%X\n", + data); #endif /* CY82C693_DEBUG_INFO */ /* @@ -371,8 +373,8 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c outb(data, CY82_DATA_PORT); #if CY82C693_DEBUG_INFO - printk(KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n", - name, data); + printk(KERN_INFO ": New Peripheral Configuration Register: 0x%X\n", + data); #endif /* CY82C693_DEBUG_INFO */ #endif /* CY82C693_SETDMA_CLOCK */ @@ -398,7 +400,7 @@ static const struct ide_port_ops cy82c693_port_ops = { }; static const struct ide_port_info cy82c693_chipset __devinitdata = { - .name = "CY82C693", + .name = DRV_NAME, .init_chipset = init_chipset_cy82c693, .init_iops = init_iops_cy82c693, .port_ops = &cy82c693_port_ops, @@ -419,12 +421,22 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && PCI_FUNC(dev->devfn) == 1) { dev2 = pci_get_slot(dev->bus, dev->devfn + 1); - ret = ide_setup_pci_devices(dev, dev2, &cy82c693_chipset); - /* We leak pci refs here but thats ok - we can't be unloaded */ + ret = ide_pci_init_two(dev, dev2, &cy82c693_chipset, NULL); + if (ret) + pci_dev_put(dev2); } return ret; } +static void __devexit cy82c693_remove(struct pci_dev *dev) +{ + struct ide_host *host = pci_get_drvdata(dev); + struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; + + ide_pci_remove(dev); + pci_dev_put(dev2); +} + static const struct pci_device_id cy82c693_pci_tbl[] = { { PCI_VDEVICE(CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693), 0 }, { 0, }, @@ -435,6 +447,7 @@ static struct pci_driver driver = { .name = "Cypress_IDE", .id_table = cy82c693_pci_tbl, .probe = cy82c693_init_one, + .remove = cy82c693_remove, }; static int __init cy82c693_ide_init(void) @@ -442,7 +455,13 @@ static int __init cy82c693_ide_init(void) return ide_pci_register_driver(&driver); } +static void __exit cy82c693_ide_exit(void) +{ + pci_unregister_driver(&driver); +} + module_init(cy82c693_ide_init); +module_exit(cy82c693_ide_exit); MODULE_AUTHOR("Andreas Krebs, Andre Hedrick"); MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE");