aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-10-03 04:14:35 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:09 -0400
commit652aa16291095911640137155063a5c6ea9bad74 (patch)
tree6c463c8da82045e9ecdbb1e7e3242c12b4be6bae /drivers/ide
parenta4bea10eca68152e84ffc4eaeb9d20ec2ac34664 (diff)
[PATCH] IDE: more pci_find cleanup
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/pci/cs5530.c13
-rw-r--r--drivers/ide/pci/cy82c693.c5
-rw-r--r--drivers/ide/pci/via82cxxx.c5
3 files changed, 15 insertions, 8 deletions
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 380bb28c7c54..ae405fa32236 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -222,23 +222,23 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
222 unsigned long flags; 222 unsigned long flags;
223 223
224 dev = NULL; 224 dev = NULL;
225 while ((dev = pci_find_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { 225 while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) {
226 switch (dev->device) { 226 switch (dev->device) {
227 case PCI_DEVICE_ID_CYRIX_PCI_MASTER: 227 case PCI_DEVICE_ID_CYRIX_PCI_MASTER:
228 master_0 = dev; 228 master_0 = pci_dev_get(dev);
229 break; 229 break;
230 case PCI_DEVICE_ID_CYRIX_5530_LEGACY: 230 case PCI_DEVICE_ID_CYRIX_5530_LEGACY:
231 cs5530_0 = dev; 231 cs5530_0 = pci_dev_get(dev);
232 break; 232 break;
233 } 233 }
234 } 234 }
235 if (!master_0) { 235 if (!master_0) {
236 printk(KERN_ERR "%s: unable to locate PCI MASTER function\n", name); 236 printk(KERN_ERR "%s: unable to locate PCI MASTER function\n", name);
237 return 0; 237 goto out;
238 } 238 }
239 if (!cs5530_0) { 239 if (!cs5530_0) {
240 printk(KERN_ERR "%s: unable to locate CS5530 LEGACY function\n", name); 240 printk(KERN_ERR "%s: unable to locate CS5530 LEGACY function\n", name);
241 return 0; 241 goto out;
242 } 242 }
243 243
244 spin_lock_irqsave(&ide_lock, flags); 244 spin_lock_irqsave(&ide_lock, flags);
@@ -296,6 +296,9 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
296 296
297 spin_unlock_irqrestore(&ide_lock, flags); 297 spin_unlock_irqrestore(&ide_lock, flags);
298 298
299out:
300 pci_dev_put(master_0);
301 pci_dev_put(cs5530_0);
299 return 0; 302 return 0;
300} 303}
301 304
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 120929fbe7a3..64330c459bd4 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -281,7 +281,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio)
281 281
282 /* select primary or secondary channel */ 282 /* select primary or secondary channel */
283 if (hwif->index > 0) { /* drive is on the secondary channel */ 283 if (hwif->index > 0) { /* drive is on the secondary channel */
284 dev = pci_find_slot(dev->bus->number, dev->devfn+1); 284 dev = pci_get_slot(dev->bus, dev->devfn+1);
285 if (!dev) { 285 if (!dev) {
286 printk(KERN_ERR "%s: tune_drive: " 286 printk(KERN_ERR "%s: tune_drive: "
287 "Cannot find secondary interface!\n", 287 "Cannot find secondary interface!\n",
@@ -500,8 +500,9 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev
500 Function 1 is primary IDE channel, function 2 - secondary. */ 500 Function 1 is primary IDE channel, function 2 - secondary. */
501 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && 501 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
502 PCI_FUNC(dev->devfn) == 1) { 502 PCI_FUNC(dev->devfn) == 1) {
503 dev2 = pci_find_slot(dev->bus->number, dev->devfn + 1); 503 dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
504 ret = ide_setup_pci_devices(dev, dev2, d); 504 ret = ide_setup_pci_devices(dev, dev2, d);
505 /* We leak pci refs here but thats ok - we can't be unloaded */
505 } 506 }
506 return ret; 507 return ret;
507} 508}
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 9b7589e8e93e..2af634d7acf4 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -248,7 +248,7 @@ static struct via_isa_bridge *via_config_find(struct pci_dev **isa)
248 u8 t; 248 u8 t;
249 249
250 for (via_config = via_isa_bridges; via_config->id; via_config++) 250 for (via_config = via_isa_bridges; via_config->id; via_config++)
251 if ((*isa = pci_find_device(PCI_VENDOR_ID_VIA + 251 if ((*isa = pci_get_device(PCI_VENDOR_ID_VIA +
252 !!(via_config->flags & VIA_BAD_ID), 252 !!(via_config->flags & VIA_BAD_ID),
253 via_config->id, NULL))) { 253 via_config->id, NULL))) {
254 254
@@ -256,6 +256,7 @@ static struct via_isa_bridge *via_config_find(struct pci_dev **isa)
256 if (t >= via_config->rev_min && 256 if (t >= via_config->rev_min &&
257 t <= via_config->rev_max) 257 t <= via_config->rev_max)
258 break; 258 break;
259 pci_dev_put(*isa);
259 } 260 }
260 261
261 return via_config; 262 return via_config;
@@ -283,6 +284,7 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const
283 via_config = via_config_find(&isa); 284 via_config = via_config_find(&isa);
284 if (!via_config->id) { 285 if (!via_config->id) {
285 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); 286 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n");
287 pci_dev_put(isa);
286 return -ENODEV; 288 return -ENODEV;
287 } 289 }
288 290
@@ -361,6 +363,7 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const
361 via_dma[via_config->flags & VIA_UDMA], 363 via_dma[via_config->flags & VIA_UDMA],
362 pci_name(dev)); 364 pci_name(dev));
363 365
366 pci_dev_put(isa);
364 return 0; 367 return 0;
365} 368}
366 369