[Spice-devel] [PATCH spice-gtk 4/4] usb: remove disconnect_device() deprecation warning

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Fri Jan 27 11:17:46 UTC 2017


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Use a static function instead of the deprecated public function.

The usage of the function seems to be fine for sync case, since the
device was already removed, but I added a TODO just in case someone
looks at this code.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/usb-device-manager.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 7f0b263..4d0b93d 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -207,6 +207,9 @@ static
 void _connect_device_async_cb(GObject *gobject,
                               GAsyncResult *channel_res,
                               gpointer user_data);
+static
+void disconnect_device_sync(SpiceUsbDeviceManager *self,
+                            SpiceUsbDevice *device);
 
 G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device,
                     (GBoxedCopyFunc)spice_usb_device_ref,
@@ -983,7 +986,8 @@ static void spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,
         return;
     }
 
-    spice_usb_device_manager_disconnect_device(self, device);
+    /* TODO: check usage of the sync version is ok here */
+    disconnect_device_sync(self, device);
 
     SPICE_DEBUG("device removed %04x:%04x (%p)",
                 spice_usb_device_get_vid(device),
@@ -1542,15 +1546,8 @@ void _connect_device_async_cb(GObject *gobject,
 }
 #endif
 
-/**
- * spice_usb_device_manager_disconnect_device:
- * @manager: the #SpiceUsbDeviceManager manager
- * @device: a #SpiceUsbDevice to disconnect
- *
- * Disconnects the @device.
- */
-void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
-                                                SpiceUsbDevice *device)
+static void disconnect_device_sync(SpiceUsbDeviceManager *self,
+                                   SpiceUsbDevice *device)
 {
     g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));
     g_return_if_fail(device != NULL);
@@ -1567,6 +1564,19 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
 #endif
 }
 
+/**
+ * spice_usb_device_manager_disconnect_device:
+ * @manager: the #SpiceUsbDeviceManager manager
+ * @device: a #SpiceUsbDevice to disconnect
+ *
+ * Disconnects the @device.
+ */
+void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
+                                                SpiceUsbDevice *device)
+{
+    disconnect_device_sync(self, device);
+}
+
 typedef struct _disconnect_cb_data
 {
     SpiceUsbDeviceManager  *self;
-- 
2.11.0.295.gd7dffce1c.dirty



More information about the Spice-devel mailing list