[PATCH] PCIE: make bus_id for PCI Express devices unique
authorSergey Vlasov <vsu@altlinux.ru>
Mon, 14 Nov 2005 17:30:50 +0000 (20:30 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 Jan 2006 20:13:15 +0000 (12:13 -0800)
The bus_id string must be unique for all devices of that bus in the
system, not just for devices with the same parent - otherwise multiple
symlinks with identical names appear in /sys/bus/pci_express/devices.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/pcie/portdrv_core.c

index 467a4ceccf1066d02ea1cf0942cafc9e99fc20bc..e4e5f1e8d8168317edc6b1a0fc1fd3e455b172c8 100644 (file)
@@ -238,8 +238,8 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev,
        device->driver = NULL;
        device->driver_data = NULL;
        device->release = release_pcie_device;  /* callback to free pcie dev */
-       sprintf(&device->bus_id[0], "pcie%02x",
-               get_descriptor_id(port_type, service_type));
+       snprintf(device->bus_id, sizeof(device->bus_id), "%s:pcie%02x",
+                pci_name(parent), get_descriptor_id(port_type, service_type));
        device->parent = &parent->dev;
 }