any value in "pci_request_region_exclusive()" routine?
Robert P. J. Day
rpjday at crashcourse.ca
Tue Jun 25 07:22:06 EDT 2013
poking around in memory allocation code and ran across this in
drivers/pci/pci.c. first, there's this generic region request routine
that accepts a final parameter as to whether it's an "exclusive"
request:
static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name,
int exclusive)
{
struct pci_devres *dr;
...
and, not surprisingly, there are a couple more user-friendly routines
that wrap around it:
int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
{
return __pci_request_region(pdev, bar, res_name, 0);
}
... snip ...
int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
{
return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
}
the above would normally suggest that, since the generic routine's
name begins with "__", it's typically a lower-level routine that
wouldn't be called directly, and one would expect to see calls to the
wrapper routines:
* pci_request_reqion()
* pci_request_region_exclusive()
scattered throughout the kernel source tree.
there are certainly enough calls to the first (non-exclusive)
routine, but this is it for the second:
$ grep -rw pci_request_region_exclusive *
drivers/pci/pci.c: * pci_request_region_exclusive - Reserved PCI I/O and memory resource
drivers/pci/pci.c:int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
drivers/pci/pci.c:EXPORT_SYMBOL(pci_request_region_exclusive);
include/linux/pci.h:int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *);
$
in short, *nobody* appears to call that second routine for exclusive
access. am i missing something here? if you search for calls to the
generic routine, this is all you find:
$ grep -rw __pci_request_region *
drivers/pci/pci.c: * __pci_request_region - Reserved PCI I/O and memory resource
drivers/pci/pci.c:static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name,
drivers/pci/pci.c: return __pci_request_region(pdev, bar, res_name, 0);
drivers/pci/pci.c: return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
drivers/pci/pci.c: if (__pci_request_region(pdev, i, res_name, excl))
$
so what's the value of that "exclusive" wrapper routine?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
More information about the Kernelnewbies
mailing list