All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xend: pci: find_parent: should return string rather than int
@ 2009-06-17 11:02 Cui, Dexuan
  2009-06-17 11:31 ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Cui, Dexuan @ 2009-06-17 11:02 UTC (permalink / raw)
  To: Keir Fraser, Simon Horman; +Cc: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]

Using changeset 19783: 61ec78692b13, device assignment can't work: 
e.g., in find_the_uppermost_pci_bridge(), 
 parent = dev_parent.find_parent()
...
 dev_parent = PciDevice(parent),
we can see parent['domain'] is int and in PciDevice's __init__, int(dev['domain'], 16) would fail:
TypeError: int() can't convert non-string with explicit base

The patch fixes the issue.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>

diff -r 61ec78692b13 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py  Wed Jun 17 07:39:27 2009 +0100
+++ b/tools/python/xen/util/pci.py  Wed Jun 17 18:35:31 2009 +0800
@@ -547,12 +547,12 @@ class PciDevice:
             else:
                 dev = {}
                 lst = parent.split(':')
-                dev['domain'] = int(lst[0], 16)
-                dev['bus'] = int(lst[1], 16)
+                dev['domain'] = '%04x' % int(lst[0], 16)
+                dev['bus'] = '%02x' % int(lst[1], 16)
                 lst = lst[2]
                 lst = lst.split('.')
-                dev['slot'] = int(lst[0], 16)
-                dev['func'] = int(lst[1], 16)
+                dev['slot'] = '%02x' % int(lst[0], 16)
+                dev['func'] = '%x' % int(lst[1], 16)
             return dev
         except OSError, (errno, strerr):
             raise PciDeviceParseError('Can not locate the parent of %s',

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-17 12:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-17 11:02 [PATCH] xend: pci: find_parent: should return string rather than int Cui, Dexuan
2009-06-17 11:31 ` Simon Horman
2009-06-17 11:40   ` Cui, Dexuan
2009-06-17 12:07     ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.