Commit cb2ea63d authored by Matthew Wilcox's avatar Matthew Wilcox Committed by David Mosberger

[PATCH] PCI: Unconfuse /proc

If we are to cope with multiple domains with clashing PCI bus numbers,
we must refrain from creating two directories of the same name in
/proc/bus/pci.  This is one solution to the problem; busses with a
non-zero domain number get it prepended.

Alternative solutions include cowardly refusing to create non-domain-zero
bus directories, refusing to create directories with clashing names, and
sticking our heads in the sand and pretending the problem doesn't exist.
parent 0e4e6063
...@@ -383,7 +383,11 @@ int pci_proc_attach_device(struct pci_dev *dev) ...@@ -383,7 +383,11 @@ int pci_proc_attach_device(struct pci_dev *dev)
return -EACCES; return -EACCES;
if (!(de = bus->procdir)) { if (!(de = bus->procdir)) {
if (pci_domain_nr(bus) == 0) {
sprintf(name, "%02x", bus->number); sprintf(name, "%02x", bus->number);
} else {
sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number);
}
de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir); de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir);
if (!de) if (!de)
return -ENOMEM; return -ENOMEM;
......
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