All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: "Cui, Dexuan" <dexuan.cui@intel.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: [PATCH] xend: pci: find_parent: should return string rather than int
Date: Wed, 17 Jun 2009 21:31:08 +1000	[thread overview]
Message-ID: <20090617113102.GA3504@verge.net.au> (raw)
In-Reply-To: <EADF0A36011179459010BDF5142A457501C9E2AFB5@pdsmsx502.ccr.corp.intel.com>

On Wed, Jun 17, 2009 at 07:02:27PM +0800, Cui, Dexuan wrote:
> 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.

Hi Dexuan,

sorry about that. The fix looks good to me.

Could you tell me a bit about what config/command you
ran to produce this problem? I'd like to add something
to the tests that I run.

Acked-by: Simon Horman <horms@verge.net.au>

> 
> 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',

  reply	other threads:[~2009-06-17 11:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2009-06-17 11:40   ` Cui, Dexuan
2009-06-17 12:07     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090617113102.GA3504@verge.net.au \
    --to=horms@verge.net.au \
    --cc=dexuan.cui@intel.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.