in pci_lib/pci_lib.py [0:0]
def parent(self):
"""
Get this device's parent device.
@return a PCIDevice, or None if this device is a top-level device
"""
mypath = os.path.join(SYSFS_PCI_BUS_DEVICES, self.device_name)
mypath = realpath(mypath)
parentpath = realpath(os.path.join(mypath, '..'))
parentdev = os.path.basename(parentpath)
if not re.match(LONG_PCI_ADDR_REGEX, parentdev):
return None
return map_pci_device(parentdev)