From fa7010d3af682b31a20489f21687b4d1d1709b8a Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sun, 26 Jun 2005 15:35:36 +0000 Subject: [PATCH] patch from abbotti@mev.co.uk (Ian Abbott): At the end of February (or possibly the beginning of March, depending on your timezone!) I submitted a patch to remove pci_find_device and use pci_get_device and pci_dev_put (and occasionally pci_dev_get) instead. I messed up on the amplc_pc262 and cb_pcidas drivers as I forgot to replace pci_find_device with pci_get_device, but added the calls to pci_dev_put, so the PCI reference counts would go negative when the device was detached. The attached patch corrects this problem and also fixes an unrelated gcc warning in the cb_pcidas driver about a possibly ambiguous 'else' requiring braces (my fault again!). --- comedi/drivers/amplc_pc263.c | 4 ++-- comedi/drivers/cb_pcidas.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/comedi/drivers/amplc_pc263.c b/comedi/drivers/amplc_pc263.c index 1309c5a7..bfd5e1e6 100644 --- a/comedi/drivers/amplc_pc263.c +++ b/comedi/drivers/amplc_pc263.c @@ -169,9 +169,9 @@ static int pc263_attach(comedi_device *dev,comedi_devconfig *it) } /* Look for matching PCI device. */ - for(pci_dev = pci_find_device(pci_id->vendor, pci_id->device, + for(pci_dev = pci_get_device(pci_id->vendor, pci_id->device, NULL); pci_dev != NULL; - pci_dev = pci_find_device(pci_id->vendor, + pci_dev = pci_get_device(pci_id->vendor, pci_id->device, pci_dev)) { /* If bus/slot specified, check them. */ if (bus || slot) { diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index 0f7a1283..2420ff80 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -525,8 +525,8 @@ static int cb_pcidas_attach(comedi_device *dev, comedi_devconfig *it) */ printk("\n"); - for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ; - pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) + for(pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ; + pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { // is it not a computer boards card? if(pcidev->vendor != PCI_VENDOR_ID_CB) @@ -592,10 +592,12 @@ found: else err++; if(thisboard->ao_nchan) + { if(request_region(ao_registers, AO_SIZE, "cb_pcidas")) devpriv->ao_registers = ao_registers; else err++; + } if(err) { printk(" I/O port conflict\n"); -- 2.26.2