aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2018-04-26 17:37:55 -0700
committerAleksander Morgado <aleksander@aleksander.es>2018-06-02 17:56:59 +0200
commit641e1b8a43c253c0df94e1ecfbfb13e0e4af2513 (patch)
tree0deabaa347e7df3a64f05c8be5fcaec3aafbb018
parent0e770b13f8967d19f29784f72698f405f85c4d15 (diff)
broadband-modem-qmi: add a temporary assure_qmi_client() helper
ensure_qmi_client() uses g_simple_async_report_take_gerror_in_idle(), which can't be mixed with GTask. To allow migrating remaining MMBroadbandModemQmi code to use GTask in a series of smaller patches, this patch adds a temporary assure_qmi_client() helper, which mimics ensure_qmi_client() but uses g_task_report_new_error(). Once all the MMBroadbandModemQmi code is migrated to use GTask, we will drop the old ensure_qmi_client() and renames assure_qmi_client() back to ensure_qmi_client().
-rw-r--r--src/mm-broadband-modem-qmi.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index 898906c8..7df857ea 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -187,6 +187,26 @@ ensure_qmi_client (MMBroadbandModemQmi *self,
return TRUE;
}
+static gboolean
+assure_qmi_client (MMBroadbandModemQmi *self,
+ QmiService service,
+ QmiClient **o_client,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GError *error = NULL;
+ QmiClient *client;
+
+ client = peek_qmi_client (self, service, &error);
+ if (!client) {
+ g_task_report_error (self, callback, user_data, assure_qmi_client, error);
+ return FALSE;
+ }
+
+ *o_client = client;
+ return TRUE;
+}
+
/*****************************************************************************/
/* Power cycle */