broadband-modem-qmi: port common_setup_cleanup_unsolicited_registration_events to use GTask

This commit is contained in:
Ben Chan
2018-06-02 17:56:59 +02:00
committed by Aleksander Morgado
parent df0d2f9552
commit 8ad01d31ac
+8 -13
View File
@@ -6353,7 +6353,7 @@ common_setup_cleanup_unsolicited_registration_events_finish (MMBroadbandModemQmi
GAsyncResult *res,
GError **error)
{
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
return g_task_propagate_boolean (G_TASK (res), error);
}
#if defined WITH_NEWEST_QMI_COMMANDS
@@ -6384,25 +6384,21 @@ common_setup_cleanup_unsolicited_registration_events (MMBroadbandModemQmi *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *result;
GTask *task;
QmiClient *client = NULL;
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
if (!assure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
QMI_SERVICE_NAS, &client,
callback, user_data))
return;
result = g_simple_async_result_new (G_OBJECT (self),
callback,
user_data,
common_setup_cleanup_unsolicited_registration_events);
task = g_task_new (self, NULL, callback, user_data);
if (enable == self->priv->unsolicited_registration_events_setup) {
mm_dbg ("Unsolicited registration events already %s; skipping",
enable ? "setup" : "cleanup");
g_simple_async_result_set_op_res_gboolean (result, TRUE);
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
g_task_return_boolean (task, TRUE);
g_object_unref (task);
return;
}
@@ -6443,9 +6439,8 @@ common_setup_cleanup_unsolicited_registration_events (MMBroadbandModemQmi *self,
}
}
g_simple_async_result_set_op_res_gboolean (result, TRUE);
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
/*****************************************************************************/