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/maps/l440gx.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/maps/l440gx.c')
-rw-r--r-- | drivers/mtd/maps/l440gx.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c index 6b784ef5ee70..67620adf4811 100644 --- a/drivers/mtd/maps/l440gx.c +++ b/drivers/mtd/maps/l440gx.c | |||
@@ -61,14 +61,17 @@ static int __init init_l440gx(void) | |||
61 | struct resource *pm_iobase; | 61 | struct resource *pm_iobase; |
62 | __u16 word; | 62 | __u16 word; |
63 | 63 | ||
64 | dev = pci_find_device(PCI_VENDOR_ID_INTEL, | 64 | dev = pci_get_device(PCI_VENDOR_ID_INTEL, |
65 | PCI_DEVICE_ID_INTEL_82371AB_0, NULL); | 65 | PCI_DEVICE_ID_INTEL_82371AB_0, NULL); |
66 | 66 | ||
67 | pm_dev = pci_find_device(PCI_VENDOR_ID_INTEL, | 67 | pm_dev = pci_get_device(PCI_VENDOR_ID_INTEL, |
68 | PCI_DEVICE_ID_INTEL_82371AB_3, NULL); | 68 | PCI_DEVICE_ID_INTEL_82371AB_3, NULL); |
69 | 69 | ||
70 | pci_dev_put(dev); | ||
71 | |||
70 | if (!dev || !pm_dev) { | 72 | if (!dev || !pm_dev) { |
71 | printk(KERN_NOTICE "L440GX flash mapping: failed to find PIIX4 ISA bridge, cannot continue\n"); | 73 | printk(KERN_NOTICE "L440GX flash mapping: failed to find PIIX4 ISA bridge, cannot continue\n"); |
74 | pci_dev_put(pm_dev); | ||
72 | return -ENODEV; | 75 | return -ENODEV; |
73 | } | 76 | } |
74 | 77 | ||
@@ -76,6 +79,7 @@ static int __init init_l440gx(void) | |||
76 | 79 | ||
77 | if (!l440gx_map.virt) { | 80 | if (!l440gx_map.virt) { |
78 | printk(KERN_WARNING "Failed to ioremap L440GX flash region\n"); | 81 | printk(KERN_WARNING "Failed to ioremap L440GX flash region\n"); |
82 | pci_dev_put(pm_dev); | ||
79 | return -ENOMEM; | 83 | return -ENOMEM; |
80 | } | 84 | } |
81 | simple_map_init(&l440gx_map); | 85 | simple_map_init(&l440gx_map); |
@@ -99,8 +103,12 @@ static int __init init_l440gx(void) | |||
99 | pm_iobase->start += iobase & ~1; | 103 | pm_iobase->start += iobase & ~1; |
100 | pm_iobase->end += iobase & ~1; | 104 | pm_iobase->end += iobase & ~1; |
101 | 105 | ||
106 | pci_dev_put(pm_dev); | ||
107 | |||
102 | /* Allocate the resource region */ | 108 | /* Allocate the resource region */ |
103 | if (pci_assign_resource(pm_dev, PIIXE_IOBASE_RESOURCE) != 0) { | 109 | if (pci_assign_resource(pm_dev, PIIXE_IOBASE_RESOURCE) != 0) { |
110 | pci_dev_put(dev); | ||
111 | pci_dev_put(pm_dev); | ||
104 | printk(KERN_WARNING "Could not allocate pm iobase resource\n"); | 112 | printk(KERN_WARNING "Could not allocate pm iobase resource\n"); |
105 | iounmap(l440gx_map.virt); | 113 | iounmap(l440gx_map.virt); |
106 | return -ENXIO; | 114 | return -ENXIO; |