broadband-modem-qmi: port common_setup_cleanup_oma_unsolicited_events to use GTask

This commit is contained in:
Ben Chan
2018-04-28 15:58:55 -07:00
committed by Aleksander Morgado
parent 456a09c655
commit fe46d2c7db

View File

@@ -9530,7 +9530,7 @@ common_oma_setup_cleanup_unsolicited_events_finish (MMIfaceModemOma *_self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); return g_task_propagate_boolean (G_TASK (res), error);
} }
static void static void
@@ -9539,25 +9539,21 @@ common_setup_cleanup_oma_unsolicited_events (MMBroadbandModemQmi *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *result; GTask *task;
QmiClient *client = NULL; QmiClient *client = NULL;
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self), if (!assure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
QMI_SERVICE_OMA, &client, QMI_SERVICE_OMA, &client,
callback, user_data)) callback, user_data))
return; return;
result = g_simple_async_result_new (G_OBJECT (self), task = g_task_new (self, NULL, callback, user_data);
callback,
user_data,
common_setup_cleanup_oma_unsolicited_events);
if (enable == self->priv->oma_unsolicited_events_setup) { if (enable == self->priv->oma_unsolicited_events_setup) {
mm_dbg ("OMA unsolicited events already %s; skipping", mm_dbg ("OMA unsolicited events already %s; skipping",
enable ? "setup" : "cleanup"); enable ? "setup" : "cleanup");
g_simple_async_result_set_op_res_gboolean (result, TRUE); g_task_return_boolean (task, TRUE);
g_simple_async_result_complete_in_idle (result); g_object_unref (task);
g_object_unref (result);
return; return;
} }
@@ -9578,9 +9574,8 @@ common_setup_cleanup_oma_unsolicited_events (MMBroadbandModemQmi *self,
self->priv->oma_event_report_indication_id = 0; self->priv->oma_event_report_indication_id = 0;
} }
g_simple_async_result_set_op_res_gboolean (result, TRUE); g_task_return_boolean (task, TRUE);
g_simple_async_result_complete_in_idle (result); g_object_unref (task);
g_object_unref (result);
} }
static void static void