HV: extract common code blocks to has_msi_cap and has_msix_cap functions

Define has_msi_cap and has_msix_cap inline functions to do sanity checking for
msi and msix ops, the corresponding code block in existing code is replaced with
a call to these new functions.

A few minor coding style fix.

Tracked-On: #2534
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
dongshen
2019-03-05 17:31:57 -08:00
committed by wenlingz
parent 79cfb1cf58
commit 5767d1e141
3 changed files with 48 additions and 23 deletions

View File

@@ -152,15 +152,13 @@ static int32_t sharing_mode_vpci_init(const struct acrn_vm *vm)
{
struct pci_vdev *vdev;
uint32_t i, j;
int32_t ret;
int32_t ret = -ENODEV;
/*
* Only set up IO bitmap for SOS.
* IO/MMIO requests from non-sos_vm guests will be injected to device model.
*/
if (!is_sos_vm(vm)) {
ret = -ENODEV;
} else {
if (is_sos_vm(vm)) {
/* Build up vdev array for sos_vm */
pci_pdev_foreach(init_vdev_for_pdev, vm);