diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:21 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:21 -0400 |
commit | cd68841b854e24076d41c32eae3ccfce6ae60a59 (patch) | |
tree | 1973406f2e69c70bd0fff73ee892db6e44c304cd | |
parent | 40c8a7f67d38de87f97a548b81b6cd0621a3ff9a (diff) |
cy82c693: add ->remove method and module_exit()
Fix the refcounting for dev2 while at it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/pci/cy82c693.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index abd27ed7c30c..04f268866b6d 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -420,11 +420,21 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev | |||
420 | PCI_FUNC(dev->devfn) == 1) { | 420 | PCI_FUNC(dev->devfn) == 1) { |
421 | dev2 = pci_get_slot(dev->bus, dev->devfn + 1); | 421 | dev2 = pci_get_slot(dev->bus, dev->devfn + 1); |
422 | ret = ide_pci_init_two(dev, dev2, &cy82c693_chipset, NULL); | 422 | ret = ide_pci_init_two(dev, dev2, &cy82c693_chipset, NULL); |
423 | /* We leak pci refs here but thats ok - we can't be unloaded */ | 423 | if (ret) |
424 | pci_dev_put(dev2); | ||
424 | } | 425 | } |
425 | return ret; | 426 | return ret; |
426 | } | 427 | } |
427 | 428 | ||
429 | static void __devexit cy82c693_remove(struct pci_dev *dev) | ||
430 | { | ||
431 | struct ide_host *host = pci_get_drvdata(dev); | ||
432 | struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; | ||
433 | |||
434 | ide_pci_remove(dev); | ||
435 | pci_dev_put(dev2); | ||
436 | } | ||
437 | |||
428 | static const struct pci_device_id cy82c693_pci_tbl[] = { | 438 | static const struct pci_device_id cy82c693_pci_tbl[] = { |
429 | { PCI_VDEVICE(CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693), 0 }, | 439 | { PCI_VDEVICE(CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693), 0 }, |
430 | { 0, }, | 440 | { 0, }, |
@@ -435,6 +445,7 @@ static struct pci_driver driver = { | |||
435 | .name = "Cypress_IDE", | 445 | .name = "Cypress_IDE", |
436 | .id_table = cy82c693_pci_tbl, | 446 | .id_table = cy82c693_pci_tbl, |
437 | .probe = cy82c693_init_one, | 447 | .probe = cy82c693_init_one, |
448 | .remove = cy82c693_remove, | ||
438 | }; | 449 | }; |
439 | 450 | ||
440 | static int __init cy82c693_ide_init(void) | 451 | static int __init cy82c693_ide_init(void) |
@@ -442,7 +453,13 @@ static int __init cy82c693_ide_init(void) | |||
442 | return ide_pci_register_driver(&driver); | 453 | return ide_pci_register_driver(&driver); |
443 | } | 454 | } |
444 | 455 | ||
456 | static void __exit cy82c693_ide_exit(void) | ||
457 | { | ||
458 | pci_unregister_driver(&driver); | ||
459 | } | ||
460 | |||
445 | module_init(cy82c693_ide_init); | 461 | module_init(cy82c693_ide_init); |
462 | module_exit(cy82c693_ide_exit); | ||
446 | 463 | ||
447 | MODULE_AUTHOR("Andreas Krebs, Andre Hedrick"); | 464 | MODULE_AUTHOR("Andreas Krebs, Andre Hedrick"); |
448 | MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE"); | 465 | MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE"); |