diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-09-22 05:19:20 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-09-22 05:19:20 -0400 |
commit | dd8e9ed6ed544e2b924429d29cd2a6b55590109b (patch) | |
tree | 0961c205e59591e7da65ce7504c919e7ee3e4351 /drivers/mtd/devices/pmc551.c | |
parent | 668040fcd1e06fc3e68a92708cbdfa5a52c37d3c (diff) |
[MTD] Switch to pci_get_device and do ref counting
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/devices/pmc551.c')
-rw-r--r-- | drivers/mtd/devices/pmc551.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index 2c0149708739..a03a8a79e5c5 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c | |||
@@ -674,7 +674,7 @@ static int __init init_pmc551(void) | |||
674 | */ | 674 | */ |
675 | for( count = 0; count < MAX_MTD_DEVICES; count++ ) { | 675 | for( count = 0; count < MAX_MTD_DEVICES; count++ ) { |
676 | 676 | ||
677 | if ((PCI_Device = pci_find_device(PCI_VENDOR_ID_V3_SEMI, | 677 | if ((PCI_Device = pci_get_device(PCI_VENDOR_ID_V3_SEMI, |
678 | PCI_DEVICE_ID_V3_SEMI_V370PDC, | 678 | PCI_DEVICE_ID_V3_SEMI_V370PDC, |
679 | PCI_Device ) ) == NULL) { | 679 | PCI_Device ) ) == NULL) { |
680 | break; | 680 | break; |
@@ -783,6 +783,10 @@ static int __init init_pmc551(void) | |||
783 | kfree(mtd); | 783 | kfree(mtd); |
784 | break; | 784 | break; |
785 | } | 785 | } |
786 | |||
787 | /* Keep a reference as the add_mtd_device worked */ | ||
788 | pci_dev_get(PCI_Device); | ||
789 | |||
786 | printk(KERN_NOTICE "Registered pmc551 memory device.\n"); | 790 | printk(KERN_NOTICE "Registered pmc551 memory device.\n"); |
787 | printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n", | 791 | printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n", |
788 | priv->asize>>20, | 792 | priv->asize>>20, |
@@ -797,6 +801,10 @@ static int __init init_pmc551(void) | |||
797 | found++; | 801 | found++; |
798 | } | 802 | } |
799 | 803 | ||
804 | /* Exited early, reference left over */ | ||
805 | if (PCI_Device) | ||
806 | pci_dev_put(PCI_Device); | ||
807 | |||
800 | if( !pmc551list ) { | 808 | if( !pmc551list ) { |
801 | printk(KERN_NOTICE "pmc551: not detected\n"); | 809 | printk(KERN_NOTICE "pmc551: not detected\n"); |
802 | return -ENODEV; | 810 | return -ENODEV; |
@@ -824,6 +832,7 @@ static void __exit cleanup_pmc551(void) | |||
824 | priv->asize>>20, priv->start); | 832 | priv->asize>>20, priv->start); |
825 | iounmap (priv->start); | 833 | iounmap (priv->start); |
826 | } | 834 | } |
835 | pci_dev_put(priv->dev); | ||
827 | 836 | ||
828 | kfree (mtd->priv); | 837 | kfree (mtd->priv); |
829 | del_mtd_device (mtd); | 838 | del_mtd_device (mtd); |