]> xenbits.xen.org Git - xenclient/ioemu.git/commitdiff
passthrough: Register dpci_infos.php_devs.pt_dev in a common location
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 25 Mar 2009 11:35:42 +0000 (11:35 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 25 Mar 2009 11:35:42 +0000 (11:35 +0000)
Currently power_on_php_slot() sets dpci_infos.php_devs[i].pt_dev itself
after the call to register_real_device(). While pt_init relies on
power_on_php_slot() to set this pointer.

It seems sensible to use the same behaviour for both callers.

There are no other callers of register_real_device()

Signed-off-by: Simon Horman <horms@verge.net.au>
hw/pass-through.c

index 260cb8d643992bee1041005f9e6ec6fde19d34f9..8a63dceed0daf48fabd322056e9b8da7245ce4a6 100644 (file)
@@ -3621,7 +3621,7 @@ static struct pt_dev * register_real_device(PCIBus *e_bus,
     struct pci_dev *pci_dev;
     uint8_t e_device, e_intx;
     struct pci_config_cf8 machine_bdf;
-    int free_slot = -1;
+    int free_slot;
     char *key, *val;
     int msi_translate, power_mgmt;
 
@@ -3709,8 +3709,7 @@ static struct pt_dev * register_real_device(PCIBus *e_bus,
         return NULL;
     }
 
-    if ( free_slot > 0 )
-        dpci_infos.php_devs[free_slot].pt_dev = assigned_device;
+    dpci_infos.php_devs[PCI_SLOT(e_devfn)].pt_dev = assigned_device;
 
     assigned_device->pci_dev = pci_dev;
     assigned_device->msi_trans_cap = msi_translate;
@@ -3891,8 +3890,6 @@ int power_on_php_slot(int slot)
 
     php_dev->opt = NULL;
 
-    php_dev->pt_dev = pt_dev;
-
     return 0;
 
 }