From c8bcab90066b68592d4a233a2aa7bef799996713 Mon Sep 17 00:00:00 2001 From: Shiqing Gao Date: Tue, 24 Sep 2019 11:42:20 +0800 Subject: [PATCH] hv: pci: update function "bdf_is_equal" - update the function argument type to union Declaring argument as pointer is not necessary since it only does the comparison. Tracked-On: #1842 Signed-off-by: Shiqing Gao --- hypervisor/arch/x86/configs/pci_dev.c | 2 +- hypervisor/dm/vpci/vdev.c | 2 +- hypervisor/include/hw/pci.h | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hypervisor/arch/x86/configs/pci_dev.c b/hypervisor/arch/x86/configs/pci_dev.c index 22b216971..9f7426641 100644 --- a/hypervisor/arch/x86/configs/pci_dev.c +++ b/hypervisor/arch/x86/configs/pci_dev.c @@ -37,7 +37,7 @@ static bool is_allocated_to_prelaunched_vm(struct pci_pdev *pdev) for (pci_idx = 0U; pci_idx < vm_config->pci_dev_num; pci_idx++) { dev_config = &vm_config->pci_devs[pci_idx]; if ((dev_config->emu_type == PCI_DEV_TYPE_PTDEV) && - bdf_is_equal(&dev_config->pbdf, &pdev->bdf)) { + bdf_is_equal(dev_config->pbdf, pdev->bdf)) { dev_config->pdev = pdev; found = true; break; diff --git a/hypervisor/dm/vpci/vdev.c b/hypervisor/dm/vpci/vdev.c index 73a27291c..b5683a4be 100644 --- a/hypervisor/dm/vpci/vdev.c +++ b/hypervisor/dm/vpci/vdev.c @@ -83,7 +83,7 @@ struct pci_vdev *pci_find_vdev(const struct acrn_vpci *vpci, union pci_bdf vbdf) for (i = 0U; i < vpci->pci_vdev_cnt; i++) { tmp = (struct pci_vdev *)&(vpci->pci_vdevs[i]); - if (bdf_is_equal(&(tmp->bdf), &vbdf)) { + if (bdf_is_equal(tmp->bdf, vbdf)) { vdev = tmp; break; } diff --git a/hypervisor/include/hw/pci.h b/hypervisor/include/hw/pci.h index 82281a298..e2571121c 100644 --- a/hypervisor/include/hw/pci.h +++ b/hypervisor/include/hw/pci.h @@ -282,13 +282,9 @@ static inline uint64_t git_size_masked_bar_base(uint64_t size, uint64_t val) return (mask & val); } -/** - * @pre a != NULL - * @pre b != NULL - */ -static inline bool bdf_is_equal(const union pci_bdf *a, const union pci_bdf *b) +static inline bool bdf_is_equal(union pci_bdf a, union pci_bdf b) { - return (a->value == b->value); + return (a.value == b.value); } uint32_t pci_pdev_read_cfg(union pci_bdf bdf, uint32_t offset, uint32_t bytes);