aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2017-04-06 12:35:53 -0700
committerDan Williams <dcbw@redhat.com>2017-04-07 10:31:10 -0500
commit031c753a00f3d4b491120df9d327459b4e7d9145 (patch)
tree37769d18a4b2f5cee716f125cefde35864767f75
parent9667d037fdd5d1cb07b1ff27d868e7398bb31ce0 (diff)
novatel: obtain MMPortProbe from GTask source object
The MMPortProbe object is already referenced by the GTask object for custom init. Instead of keeping another reference of MMPortProbe in the CustomInitContext, this patch changes the code to simply obtain it from the source object of GTask. See https://lists.freedesktop.org/archives/modemmanager-devel/2017-April/004420.html
-rw-r--r--plugins/novatel/mm-common-novatel.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/novatel/mm-common-novatel.c b/plugins/novatel/mm-common-novatel.c
index a8f2da90..96d845f1 100644
--- a/plugins/novatel/mm-common-novatel.c
+++ b/plugins/novatel/mm-common-novatel.c
@@ -20,7 +20,6 @@
/* Custom init */
typedef struct {
- MMPortProbe *probe;
MMPortSerialAt *port;
guint nwdmat_retries;
guint wait_time;
@@ -30,7 +29,6 @@ static void
custom_init_context_free (CustomInitContext *ctx)
{
g_object_unref (ctx->port);
- g_object_unref (ctx->probe);
g_slice_free (CustomInitContext, ctx);
}
@@ -84,6 +82,7 @@ static void
custom_init_step (GTask *task)
{
CustomInitContext *ctx;
+ MMPortProbe *probe;
ctx = g_task_get_task_data (task);
@@ -96,8 +95,10 @@ custom_init_step (GTask *task)
return;
}
+ probe = g_task_get_source_object (task);
+
/* If device has a QMI port, don't run $NWDMAT */
- if (mm_port_probe_list_has_qmi_port (mm_device_peek_port_probe_list (mm_port_probe_peek_device (ctx->probe)))) {
+ if (mm_port_probe_list_has_qmi_port (mm_device_peek_port_probe_list (mm_port_probe_peek_device (probe)))) {
mm_dbg ("(Novatel) no need to run custom init in (%s): device has QMI port",
mm_port_get_device (MM_PORT (ctx->port)));
g_task_return_boolean (task, TRUE);
@@ -142,7 +143,6 @@ mm_common_novatel_custom_init (MMPortProbe *probe,
GTask *task;
ctx = g_slice_new (CustomInitContext);
- ctx->probe = g_object_ref (probe);
ctx->port = g_object_ref (port);
ctx->nwdmat_retries = 3;
ctx->wait_time = 2;