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/scx200_docflash.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/scx200_docflash.c')
-rw-r--r-- | drivers/mtd/maps/scx200_docflash.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mtd/maps/scx200_docflash.c b/drivers/mtd/maps/scx200_docflash.c index 7391fd544e86..5e2bce22f37c 100644 --- a/drivers/mtd/maps/scx200_docflash.c +++ b/drivers/mtd/maps/scx200_docflash.c | |||
@@ -87,19 +87,23 @@ static int __init init_scx200_docflash(void) | |||
87 | 87 | ||
88 | printk(KERN_DEBUG NAME ": NatSemi SCx200 DOCCS Flash Driver\n"); | 88 | printk(KERN_DEBUG NAME ": NatSemi SCx200 DOCCS Flash Driver\n"); |
89 | 89 | ||
90 | if ((bridge = pci_find_device(PCI_VENDOR_ID_NS, | 90 | if ((bridge = pci_get_device(PCI_VENDOR_ID_NS, |
91 | PCI_DEVICE_ID_NS_SCx200_BRIDGE, | 91 | PCI_DEVICE_ID_NS_SCx200_BRIDGE, |
92 | NULL)) == NULL) | 92 | NULL)) == NULL) |
93 | return -ENODEV; | 93 | return -ENODEV; |
94 | 94 | ||
95 | /* check that we have found the configuration block */ | 95 | /* check that we have found the configuration block */ |
96 | if (!scx200_cb_present()) | 96 | if (!scx200_cb_present()) { |
97 | pci_dev_put(bridge); | ||
97 | return -ENODEV; | 98 | return -ENODEV; |
99 | } | ||
98 | 100 | ||
99 | if (probe) { | 101 | if (probe) { |
100 | /* Try to use the present flash mapping if any */ | 102 | /* Try to use the present flash mapping if any */ |
101 | pci_read_config_dword(bridge, SCx200_DOCCS_BASE, &base); | 103 | pci_read_config_dword(bridge, SCx200_DOCCS_BASE, &base); |
102 | pci_read_config_dword(bridge, SCx200_DOCCS_CTRL, &ctrl); | 104 | pci_read_config_dword(bridge, SCx200_DOCCS_CTRL, &ctrl); |
105 | pci_dev_put(bridge); | ||
106 | |||
103 | pmr = inl(scx200_cb_base + SCx200_PMR); | 107 | pmr = inl(scx200_cb_base + SCx200_PMR); |
104 | 108 | ||
105 | if (base == 0 | 109 | if (base == 0 |
@@ -127,6 +131,7 @@ static int __init init_scx200_docflash(void) | |||
127 | return -ENOMEM; | 131 | return -ENOMEM; |
128 | } | 132 | } |
129 | } else { | 133 | } else { |
134 | pci_dev_put(bridge); | ||
130 | for (u = size; u > 1; u >>= 1) | 135 | for (u = size; u > 1; u >>= 1) |
131 | ; | 136 | ; |
132 | if (u != 1) { | 137 | if (u != 1) { |