Commit 50b8e9b3 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Greg Kroah-Hartman

[PATCH] PCI documentation

Update the PCI Documentation to reflect some of the functions which have
recently been added and removed.

Index: Documentation/pci.txt
===================================================================
RCS file: /var/cvs/linux-2.5/Documentation/pci.txt,v
retrieving revision 1.4
parent 16cd04d6
...@@ -155,17 +155,11 @@ Searching by both vendor/device and subsystem vendor/device ID: ...@@ -155,17 +155,11 @@ Searching by both vendor/device and subsystem vendor/device ID:
VENDOR_ID or DEVICE_ID. This allows searching for any device from a VENDOR_ID or DEVICE_ID. This allows searching for any device from a
specific vendor, for example. specific vendor, for example.
In case you need to decide according to some more complex criteria, Note that these functions are not hotplug-safe. Their hotplug-safe
you can walk the list of all known PCI devices yourself: replacements are pci_get_device(), pci_get_class() and pci_get_subsys().
They increment the reference count on the pci_dev that they return.
struct pci_dev *dev; You must eventually (possibly at module unload) decrement the reference
pci_for_each_dev(dev) { count on these devices by calling pci_dev_put().
... do anything you want with dev ...
}
For compatibility with device ordering in older kernels, you can also
use pci_for_each_dev_reverse(dev) for walking the list in the opposite
direction.
3. Enabling devices 3. Enabling devices
...@@ -193,6 +187,10 @@ when successful or an error code (PCIBIOS_...) which can be translated to a text ...@@ -193,6 +187,10 @@ when successful or an error code (PCIBIOS_...) which can be translated to a text
string by pcibios_strerror. Most drivers expect that accesses to valid PCI string by pcibios_strerror. Most drivers expect that accesses to valid PCI
devices don't fail. devices don't fail.
If you don't have a struct pci_dev available, you can call
pci_bus_(read|write)_config_(byte|word|dword) to access a given device
and function on that bus.
If you access fields in the standard portion of the config header, please If you access fields in the standard portion of the config header, please
use symbolic names of locations and bits declared in <linux/pci.h>. use symbolic names of locations and bits declared in <linux/pci.h>.
...@@ -253,14 +251,23 @@ Documentation/DMA-mapping.txt. ...@@ -253,14 +251,23 @@ Documentation/DMA-mapping.txt.
8. Obsolete functions 8. Obsolete functions
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
There are several functions kept only for compatibility with old drivers There are several functions which you might come across when trying to
not updated to the new PCI interface. Please don't use them in new code. port an old driver to the new PCI interface. They are no longer present
in the kernel as they aren't compatible with hotplug or PCI domains or
having sane locking.
pcibios_present() Since ages, you don't need to test presence pcibios_present() and Since ages, you don't need to test presence
of PCI subsystem when trying to talk with it. pci_present() of PCI subsystem when trying to talk to it.
If it's not there, the list of PCI devices If it's not there, the list of PCI devices
is empty and all functions for searching for is empty and all functions for searching for
devices just return NULL. devices just return NULL.
pcibios_(read|write)_* Superseded by their pci_(read|write)_* pcibios_(read|write)_* Superseded by their pci_(read|write)_*
counterparts. counterparts.
pcibios_find_* Superseded by their pci_find_* counterparts. pcibios_find_* Superseded by their pci_find_* counterparts.
pci_for_each_dev() Superseded by pci_find_device()
pci_for_each_dev_reverse() Superseded by pci_find_device_reverse()
pci_for_each_bus() Superseded by pci_find_next_bus()
pci_find_device() Superseded by pci_get_device()
pci_find_subsys() Superseded by pci_get_subsys()
pcibios_find_class() Superseded by pci_find_class()
pci_(read|write)_*_nodev() Superseded by pci_bus_(read|write)_*()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment