[PATCH 08/15] vbox: Drop UIUSBCommon::GetEnabled()

Michal Privoznik mprivozn at redhat.com
Mon Jan 23 09:34:17 UTC 2023


The UIUSBCommon::GetEnabled() function is not needed really, as
it sets a boolean to true and always succeeds. We can live
without the function.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/vbox/vbox_common.c        | 6 ------
 src/vbox/vbox_tmpl.c          | 8 --------
 src/vbox/vbox_uniformed_api.h | 1 -
 3 files changed, 15 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 70a9ffbc0d..abe8598940 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -2946,7 +2946,6 @@ static void
 vboxHostDeviceGetXMLDesc(struct _vboxDriver *data, virDomainDef *def, IMachine *machine)
 {
     IUSBCommon *USBCommon = NULL;
-    PRBool enabled = PR_FALSE;
     vboxArray deviceFilters = VBOX_ARRAY_INITIALIZER;
     size_t i;
     PRUint32 USBFilterCount = 0;
@@ -2957,10 +2956,6 @@ vboxHostDeviceGetXMLDesc(struct _vboxDriver *data, virDomainDef *def, IMachine *
     if (!USBCommon)
         return;
 
-    gVBoxAPI.UIUSBCommon.GetEnabled(USBCommon, &enabled);
-    if (!enabled)
-        goto release_controller;
-
     gVBoxAPI.UArray.vboxArrayGet(&deviceFilters, USBCommon,
                                  gVBoxAPI.UArray.handleUSBGetDeviceFilters(USBCommon));
 
@@ -3035,7 +3030,6 @@ vboxHostDeviceGetXMLDesc(struct _vboxDriver *data, virDomainDef *def, IMachine *
 
  release_filters:
     gVBoxAPI.UArray.vboxArrayRelease(&deviceFilters);
- release_controller:
     VBOX_RELEASE(USBCommon);
     return;
 
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index e611412f7e..3dfdcd3fd6 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -1678,13 +1678,6 @@ _vrdeServerSetNetAddress(struct _vboxDriver *data,
     return rc;
 }
 
-static nsresult
-_usbCommonGetEnabled(IUSBCommon *USBCommon G_GNUC_UNUSED, PRBool *enabled)
-{
-    *enabled = true;
-    return 0;
-}
-
 static nsresult
 _usbCommonCreateDeviceFilter(IUSBCommon *USBCommon, PRUnichar *name,
                              IUSBDeviceFilter **filter)
@@ -2406,7 +2399,6 @@ static vboxUniformedIVRDEServer _UIVRDEServer = {
 };
 
 static vboxUniformedIUSBCommon _UIUSBCommon = {
-    .GetEnabled = _usbCommonGetEnabled,
     .CreateDeviceFilter = _usbCommonCreateDeviceFilter,
     .InsertDeviceFilter = _usbCommonInsertDeviceFilter,
 };
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 23fb769c37..9c820b8d24 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -354,7 +354,6 @@ typedef struct {
 
 /* Common Functions for IUSBController and IUSBDeviceFilters */
 typedef struct {
-    nsresult (*GetEnabled)(IUSBCommon *USBCommon, PRBool *enabled);
     nsresult (*CreateDeviceFilter)(IUSBCommon *USBCommon, PRUnichar *name,
                                    IUSBDeviceFilter **filter);
     nsresult (*InsertDeviceFilter)(IUSBCommon *USBCommon, PRUint32 position,
-- 
2.39.1



More information about the libvir-list mailing list