[libvirt] [PATCH] virpci: Drop duplicate function

Michal Privoznik posted 1 patch 4 years, 9 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/24dedc32c5664f5b14112c810040a6aa99d8475a.1563523762.git.mprivozn@redhat.com
src/util/virpci.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
[libvirt] [PATCH] virpci: Drop duplicate function
Posted by Michal Privoznik 4 years, 9 months ago
We have two functions: virPCIDeviceAddressIsEqual() defined only
on Linux and virPCIDeviceAddressEqual() defined everywhere. And
both of them do the same. Drop the former in favour of the
latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/util/virpci.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/src/util/virpci.c b/src/util/virpci.c
index ae3a0fa886..6dc0a2711c 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -2590,19 +2590,6 @@ virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr)
 
 #ifdef __linux__
 
-/*
- * returns true if equal
- */
-static bool
-virPCIDeviceAddressIsEqual(virPCIDeviceAddressPtr bdf1,
-                           virPCIDeviceAddressPtr bdf2)
-{
-    return ((bdf1->domain == bdf2->domain) &&
-            (bdf1->bus == bdf2->bus) &&
-            (bdf1->slot == bdf2->slot) &&
-            (bdf1->function == bdf2->function));
-}
-
 virPCIDeviceAddressPtr
 virPCIGetDeviceAddressFromSysfsLink(const char *device_link)
 {
@@ -2787,7 +2774,7 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
     }
 
     for (i = 0; i < num_virt_fns; i++) {
-        if (virPCIDeviceAddressIsEqual(vf_bdf, virt_fns[i])) {
+        if (virPCIDeviceAddressEqual(vf_bdf, virt_fns[i])) {
             *vf_index = i;
             ret = 0;
             break;
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virpci: Drop duplicate function
Posted by Erik Skultety 4 years, 9 months ago
On Fri, Jul 19, 2019 at 10:09:22AM +0200, Michal Privoznik wrote:
> We have two functions: virPCIDeviceAddressIsEqual() defined only
> on Linux and virPCIDeviceAddressEqual() defined everywhere. And
> both of them do the same. Drop the former in favour of the
> latter.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
Trivial.

Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list