aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cy82c693.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/cy82c693.c')
-rw-r--r--drivers/ide/pci/cy82c693.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index e14ad5530fa4..bfae2f882f48 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -48,6 +48,8 @@
48 48
49#include <asm/io.h> 49#include <asm/io.h>
50 50
51#define DRV_NAME "cy82c693"
52
51/* the current version */ 53/* the current version */
52#define CY82_VERSION "CY82C693U driver v0.34 99-13-12 Andreas S. Krebs (akrebs@altavista.net)" 54#define CY82_VERSION "CY82C693U driver v0.34 99-13-12 Andreas S. Krebs (akrebs@altavista.net)"
53 55
@@ -330,7 +332,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
330/* 332/*
331 * this function is called during init and is used to setup the cy82c693 chip 333 * this function is called during init and is used to setup the cy82c693 chip
332 */ 334 */
333static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const char *name) 335static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev)
334{ 336{
335 if (PCI_FUNC(dev->devfn) != 1) 337 if (PCI_FUNC(dev->devfn) != 1)
336 return 0; 338 return 0;
@@ -349,8 +351,8 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c
349 data = inb(CY82_DATA_PORT); 351 data = inb(CY82_DATA_PORT);
350 352
351#if CY82C693_DEBUG_INFO 353#if CY82C693_DEBUG_INFO
352 printk(KERN_INFO "%s: Peripheral Configuration Register: 0x%X\n", 354 printk(KERN_INFO DRV_NAME ": Peripheral Configuration Register: 0x%X\n",
353 name, data); 355 data);
354#endif /* CY82C693_DEBUG_INFO */ 356#endif /* CY82C693_DEBUG_INFO */
355 357
356 /* 358 /*
@@ -371,8 +373,8 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c
371 outb(data, CY82_DATA_PORT); 373 outb(data, CY82_DATA_PORT);
372 374
373#if CY82C693_DEBUG_INFO 375#if CY82C693_DEBUG_INFO
374 printk(KERN_INFO "%s: New Peripheral Configuration Register: 0x%X\n", 376 printk(KERN_INFO ": New Peripheral Configuration Register: 0x%X\n",
375 name, data); 377 data);
376#endif /* CY82C693_DEBUG_INFO */ 378#endif /* CY82C693_DEBUG_INFO */
377 379
378#endif /* CY82C693_SETDMA_CLOCK */ 380#endif /* CY82C693_SETDMA_CLOCK */
@@ -398,7 +400,7 @@ static const struct ide_port_ops cy82c693_port_ops = {
398}; 400};
399 401
400static const struct ide_port_info cy82c693_chipset __devinitdata = { 402static const struct ide_port_info cy82c693_chipset __devinitdata = {
401 .name = "CY82C693", 403 .name = DRV_NAME,
402 .init_chipset = init_chipset_cy82c693, 404 .init_chipset = init_chipset_cy82c693,
403 .init_iops = init_iops_cy82c693, 405 .init_iops = init_iops_cy82c693,
404 .port_ops = &cy82c693_port_ops, 406 .port_ops = &cy82c693_port_ops,
@@ -419,12 +421,22 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev
419 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && 421 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
420 PCI_FUNC(dev->devfn) == 1) { 422 PCI_FUNC(dev->devfn) == 1) {
421 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 423 dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
422 ret = ide_setup_pci_devices(dev, dev2, &cy82c693_chipset); 424 ret = ide_pci_init_two(dev, dev2, &cy82c693_chipset, NULL);
423 /* We leak pci refs here but thats ok - we can't be unloaded */ 425 if (ret)
426 pci_dev_put(dev2);
424 } 427 }
425 return ret; 428 return ret;
426} 429}
427 430
431static void __devexit cy82c693_remove(struct pci_dev *dev)
432{
433 struct ide_host *host = pci_get_drvdata(dev);
434 struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL;
435
436 ide_pci_remove(dev);
437 pci_dev_put(dev2);
438}
439
428static const struct pci_device_id cy82c693_pci_tbl[] = { 440static const struct pci_device_id cy82c693_pci_tbl[] = {
429 { PCI_VDEVICE(CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693), 0 }, 441 { PCI_VDEVICE(CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693), 0 },
430 { 0, }, 442 { 0, },
@@ -435,6 +447,7 @@ static struct pci_driver driver = {
435 .name = "Cypress_IDE", 447 .name = "Cypress_IDE",
436 .id_table = cy82c693_pci_tbl, 448 .id_table = cy82c693_pci_tbl,
437 .probe = cy82c693_init_one, 449 .probe = cy82c693_init_one,
450 .remove = cy82c693_remove,
438}; 451};
439 452
440static int __init cy82c693_ide_init(void) 453static int __init cy82c693_ide_init(void)
@@ -442,7 +455,13 @@ static int __init cy82c693_ide_init(void)
442 return ide_pci_register_driver(&driver); 455 return ide_pci_register_driver(&driver);
443} 456}
444 457
458static void __exit cy82c693_ide_exit(void)
459{
460 pci_unregister_driver(&driver);
461}
462
445module_init(cy82c693_ide_init); 463module_init(cy82c693_ide_init);
464module_exit(cy82c693_ide_exit);
446 465
447MODULE_AUTHOR("Andreas Krebs, Andre Hedrick"); 466MODULE_AUTHOR("Andreas Krebs, Andre Hedrick");
448MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE"); 467MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE");