[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: Fix the detection of the upmost bridge in the python function find_parent().



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1223629408 -3600
# Node ID a9be7b357b0bedc4b6292a6beae826caac5f07e7
# Parent  3c0862d49df7ae38cdafce520d81cf1f1c23c600
xend: Fix the detection of the upmost bridge in the python function 
find_parent().

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
 tools/python/xen/util/pci.py |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff -r 3c0862d49df7 -r a9be7b357b0b tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Fri Oct 10 10:01:10 2008 +0100
+++ b/tools/python/xen/util/pci.py      Fri Oct 10 10:03:28 2008 +0100
@@ -400,12 +400,8 @@ class PciDevice:
             lst = target.split('/')
             parent = lst[len(lst)-2]
             if parent[0:3] == 'pci':
-                parent = parent[3:]
-                lst = parent.split(':')
-                dom = int(lst[0], 16)
-                bus = int(lst[1], 16)
-                dev = 0
-                func = 0
+                # We have reached the upmost one.
+                return None
             else:
                 lst = parent.split(':')
                 dom = int(lst[0], 16)
@@ -424,7 +420,10 @@ class PciDevice:
         (dom, b, d, f) = self.find_parent()
         dev = dev_parent = PciDevice(dom, b, d, f)
         while dev_parent.dev_type != DEV_TYPE_PCIe_BRIDGE:
-            (dom, b, d, f) = dev_parent.find_parent()
+            parent = dev_parent.find_parent()
+            if parent is None:
+                break
+            (dom, b, d, f) = parent
             dev = dev_parent
             dev_parent = PciDevice(dom, b, d, f)
         return dev

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.