[PATCH spice-gtk v2 1/3] usb-backend: Cache isochronous value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allows to remove _SpiceUsbDevice structure.
_SpiceUsbDevice is only caching this value from SpiceUsbBackendDevice.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 src/usb-backend.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Changes since v1:
- use bool instead of bit fields

diff --git a/src/usb-backend.c b/src/usb-backend.c
index 3334f566..e61ec01f 100644
--- a/src/usb-backend.c
+++ b/src/usb-backend.c
@@ -50,6 +50,8 @@ struct _SpiceUsbBackendDevice
     gint ref_count;
     SpiceUsbBackendChannel *attached_to;
     UsbDeviceInformation device_info;
+    bool cached_isochronous_valid;
+    bool cached_isochronous;
 };
 
 struct _SpiceUsbBackend
@@ -346,6 +348,10 @@ gboolean spice_usb_backend_device_isoch(SpiceUsbBackendDevice *dev)
     gint i, j, k;
     int rc;
 
+    if (dev->cached_isochronous_valid) {
+        return dev->cached_isochronous;
+    }
+
     g_return_val_if_fail(libdev != NULL, 0);
 
     rc = libusb_get_active_config_descriptor(libdev, &conf_desc);
@@ -367,6 +373,9 @@ gboolean spice_usb_backend_device_isoch(SpiceUsbBackendDevice *dev)
         }
     }
 
+    dev->cached_isochronous_valid = true;
+    dev->cached_isochronous = isoc_found;
+
     libusb_free_config_descriptor(conf_desc);
     return isoc_found;
 }
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]