broadband-modem-qmi: port modem_reset to use GTask

This commit is contained in:
Ben Chan
2018-04-28 15:27:31 -07:00
committed by Aleksander Morgado
parent 15ffa69d72
commit f52264d78a

View File

@@ -3393,24 +3393,23 @@ modem_reset_finish (MMIfaceModem *self,
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);
}
static void
modem_reset_power_cycle_ready (MMBroadbandModemQmi *self,
GAsyncResult *res,
GSimpleAsyncResult *simple)
GTask *task)
{
GError *error = NULL;
if (!power_cycle_finish (self, res, &error))
g_simple_async_result_take_error (simple, error);
g_task_return_error (task, error);
else
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
g_task_return_boolean (task, TRUE);
g_simple_async_result_complete (simple);
g_object_unref (simple);
g_object_unref (task);
}
@@ -3419,17 +3418,10 @@ modem_reset (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *result;
result = g_simple_async_result_new (G_OBJECT (self),
callback,
user_data,
modem_reset);
/* Power cycle the modem */
power_cycle (MM_BROADBAND_MODEM_QMI (self),
(GAsyncReadyCallback)modem_reset_power_cycle_ready,
result);
g_task_new (self, NULL, callback, user_data));
}
/*****************************************************************************/