diff options
author | Jan Beulich <jbeulich@suse.com> | 2013-08-28 10:12:36 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-08-28 10:12:36 +0200 |
commit | aa4b2aea4fa300341668971e50fbfd16b1ed925d (patch) | |
tree | 58cc54354404464bc163272fbc696ce858c06b36 /xen/drivers/passthrough | |
parent | dcbff3aeac6020cdf1f5bd0f0eb0d329fc55d939 (diff) | |
download | xen-aa4b2aea4fa300341668971e50fbfd16b1ed925d.tar.gz xen-aa4b2aea4fa300341668971e50fbfd16b1ed925d.tar.bz2 xen-aa4b2aea4fa300341668971e50fbfd16b1ed925d.zip |
PCI: centralize parsing of device coordinates in command line options
With yet another case to come in a subsequent patch, it seems time to
do this in a single place rather than hand crafting it in various
scattered around locations.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/drivers/passthrough')
-rw-r--r-- | xen/drivers/passthrough/pci.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index b488e2ae18..e9f2a56dbc 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -127,29 +127,20 @@ static unsigned int nr_phantom_devs; static void __init parse_phantom_dev(char *str) { const char *s = str; + unsigned int seg, bus, slot; struct phantom_dev phantom; if ( !s || !*s || nr_phantom_devs >= ARRAY_SIZE(phantom_devs) ) return; - phantom.seg = simple_strtol(s, &s, 16); - if ( *s != ':' ) + s = parse_pci(s, &seg, &bus, &slot, NULL); + if ( !s || *s != ',' ) return; - phantom.bus = simple_strtol(s + 1, &s, 16); - if ( *s == ',' ) - { - phantom.slot = phantom.bus; - phantom.bus = phantom.seg; - phantom.seg = 0; - } - else if ( *s == ':' ) - phantom.slot = simple_strtol(s + 1, &s, 16); - else - return; + phantom.seg = seg; + phantom.bus = bus; + phantom.slot = slot; - if ( *s != ',' ) - return; switch ( phantom.stride = simple_strtol(s + 1, &s, 0) ) { case 1: case 2: case 4: |