A complete re-implementation of fakephp is necessary if it is topresent its former interface (pre-2.6.27, when it broke). Thereason is that PCI hotplug drivers call pci_hp_register(), whichenforces the rule that only one /sys/bus/pci/slots/ file may becreated per physical slot.

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

It puts entries in /sys/bus/pci/slots with the names of all PCIdevices/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 attributehas worked.

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

The new implementation overcomes these limitations. As aconsequence, removing a bridge with other devices behind it nowworks as well, which is something else old fakephp couldn't dopreviously.

This duplicates a tiny bit of the code in the PCI core that doesthis same function. Re-using that code ends up being morecomplex than duplicating it, and it makes code in the PCI coremore ugly just to support this legacy fakephp interfacecompatibility layer.