[PATCH] novatel: obtain MMPortProbe from GTask source object
Ben Chan
benchan at chromium.org
Thu Apr 6 19:35:53 UTC 2017
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
---
plugins/novatel/mm-common-novatel.c | 8 ++++----
1 file 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;
--
2.12.2.715.g7642488e1d-goog
More information about the ModemManager-devel
mailing list