[PATCH] novatel: obtain MMPortProbe from GTask source object

Dan Williams dcbw at redhat.com
Fri Apr 7 15:32:46 UTC 2017


On Thu, 2017-04-06 at 12:35 -0700, Ben Chan wrote:
> 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.

Pushed to git master, thanks!

Dan

> 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;


More information about the ModemManager-devel mailing list