]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
PCI Hotplug: restore fakephp interface with complete reimplementation
authorTrent Piepho <xyzzy@speakeasy.org>
Fri, 20 Mar 2009 20:56:46 +0000 (14:56 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 20 Mar 2009 21:59:25 +0000 (14:59 -0700)
commit83dbf66f04b96e65c6c18436c16d40f9cf8630aa
tree0c3ffcc7d34aea8cd8983f3863bae67ef7f72029
parent738a6396c223b486304dda778119dbbca563f019
PCI Hotplug: restore fakephp interface with complete reimplementation

A complete re-implementation of fakephp is necessary if it is to
present its former interface (pre-2.6.27, when it broke). The
reason is that PCI hotplug drivers call pci_hp_register(), which
enforces the rule that only one /sys/bus/pci/slots/ file may be
created per physical slot.

The change breaks the old fakephp's assumption that it could
create a file per function. So we re-implement fakephp to avoid
using the standard PCI hotplug API so that we can restore the old
fakephp user interface.

It puts entries in /sys/bus/pci/slots with the names of all PCI
devices/functions, exactly symmetrical to what is shown in
/sys/bus/pci/devices. Each slots/ entry has a "power" attribute,
which works the same way as the fakephp driver's power attribute
has worked.

There are a few improvements over old fakephp, which couldn't handle
PCI devices being added or removed via a means outside of
fakephp's knowledge.  If a device was added another way, old fakephp
didn't notice and didn't create the fake slot for it.  If a
device was removed another way, old fakephp didn't delete the fake
slot for it (and accessing the stale slot caused an oops).

The new implementation overcomes these limitations. As a
consequence, removing a bridge with other devices behind it now
works as well, which is something else old fakephp couldn't do
previously.

This duplicates a tiny bit of the code in the PCI core that does
this same function.  Re-using that code ends up being more
complex than duplicating it, and it makes code in the PCI core
more ugly just to support this legacy fakephp interface
compatibility layer.

Reviewed-by: James Cameron <qz@hp.com>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/hotplug/Makefile
drivers/pci/hotplug/fakephp.c [deleted file]
drivers/pci/hotplug/legacy_fakephp.c [new file with mode: 0644]