lkml.org 
[lkml]   [2008]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] pci: Fixing drivers/pci/search.c compilation warning.
On Mon, Oct 27, 2008 at 11:18:43AM +0800, Zhao, Yu wrote:
> Matthew Wilcox wrote:
> >Yes, that's why pci_find_device() is deprecated. But it doesn't also
> >need to be buggy ;-)
>
> How about pci_get_bus_and_slot()? People would meet the problem with it
> anyway.

What problem with it? It's documented to return the device with an
increased refcount, and the implementation appears to do exactly that:

struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
{
struct pci_dev *dev = NULL;

while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
if (pci_domain_nr(dev->bus) == 0 &&
(dev->bus->number == bus && dev->devfn == devfn))
return dev;
}
return NULL;
}

Are you saying some users of it neglect to decrement the refcount before
disposing of the device?

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."


\
 
 \ /
  Last update: 2008-10-27 08:11    [W:0.040 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site