From owner-linux-pci@atrey.karlin.mff.cuni.cz Mon Nov 14 09:20:35 2005 Date: Mon, 14 Nov 2005 20:30:50 +0300 From: Sergey Vlasov To: linux-pci@atrey.karlin.mff.cuni.cz Subject: [PATCH] PCIE: make bus_id for PCI Express devices unique Message-ID: <20051114173050.GB24496@master.mivlgu.local> Content-Disposition: inline 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 Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pcie/portdrv_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- gregkh-2.6.orig/drivers/pci/pcie/portdrv_core.c +++ gregkh-2.6/drivers/pci/pcie/portdrv_core.c @@ -238,8 +238,8 @@ static void pcie_device_init(struct pci_ 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; }