From: Benjamin Berg Date: Fri, 23 Apr 2021 10:58:46 +0200 Subject: goodixmoc: Remove internal cancellable The driver has an internal cancellable that simply forwards the external cancellation in the cancel callback. This is not really needed, we can instead just use the external cancellable directly by fetching it using fpi_device_get_cancellable(). --- libfprint/drivers/goodixmoc/goodix.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/libfprint/drivers/goodixmoc/goodix.c b/libfprint/drivers/goodixmoc/goodix.c index d67d392..38b6ff4 100644 --- a/libfprint/drivers/goodixmoc/goodix.c +++ b/libfprint/drivers/goodixmoc/goodix.c @@ -54,7 +54,6 @@ struct _FpiDeviceGoodixMoc gint enroll_stage; gint max_enroll_stage; gint max_stored_prints; - GCancellable *cancellable; GPtrArray *list_result; guint8 template_id[TEMPLATE_ID_SIZE]; gboolean is_enroll_identify; @@ -220,7 +219,7 @@ fp_cmd_run_state (FpiSsm *ssm, fpi_usb_transfer_fill_bulk (transfer, EP_IN, EP_IN_MAX_BUF_SIZE); fpi_usb_transfer_submit (transfer, self->cmd_cancelable ? 0 : DATA_TIMEOUT, - self->cmd_cancelable ? self->cancellable : NULL, + self->cmd_cancelable ? fpi_device_get_cancellable (dev) : NULL, fp_cmd_receive_cb, fpi_ssm_get_data (ssm)); break; @@ -1348,8 +1347,6 @@ gx_fp_init (FpDevice *device) self->max_stored_prints = FP_MAX_FINGERNUM; self->is_power_button_shield_on = false; - self->cancellable = g_cancellable_new (); - self->sensorcfg = g_new0 (gxfp_sensor_cfg_t, 1); ret = gx_proto_init_sensor_config (self->sensorcfg); @@ -1387,7 +1384,6 @@ gx_fp_release_interface (FpiDeviceGoodixMoc *self, { g_autoptr(GError) release_error = NULL; - g_clear_object (&self->cancellable); g_clear_pointer (&self->sensorcfg, g_free); /* Release usb interface */ @@ -1533,20 +1529,6 @@ fpi_device_goodixmoc_init (FpiDeviceGoodixMoc *self) } -static void -gx_fp_cancel (FpDevice *device) -{ - FpiDeviceGoodixMoc *self = FPI_DEVICE_GOODIXMOC (device); - - /* Cancel any current interrupt transfer (resulting us to go into - * response reading mode again); then create a new cancellable - * for the next transfers. */ - g_cancellable_cancel (self->cancellable); - g_clear_object (&self->cancellable); - self->cancellable = g_cancellable_new (); - -} - static const FpIdEntry id_table[] = { { .vid = 0x27c6, .pid = 0x5840, }, { .vid = 0x27c6, .pid = 0x6496, }, @@ -1577,7 +1559,6 @@ fpi_device_goodixmoc_class_init (FpiDeviceGoodixMocClass *klass) dev_class->enroll = gx_fp_enroll; dev_class->delete = gx_fp_template_delete; dev_class->list = gx_fp_template_list; - dev_class->cancel = gx_fp_cancel; dev_class->verify = gx_fp_verify_identify; dev_class->identify = gx_fp_verify_identify; }