diff options
author | Steve Schrock <steve.schrock@getcruise.com> | 2024-02-21 22:17:22 +0000 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2024-02-21 16:22:45 -0600 |
commit | 4947c7980add2dffaf0f43e622fae609362b3bbb (patch) | |
tree | 252b35267a01b28a4faac37f31b7825b7dad304b | |
parent | ae0392353d8f15a1d20578ec1a9b60d6d7123770 (diff) | |
download | ofono-4947c7980add2dffaf0f43e622fae609362b3bbb.tar.gz |
qmimodem: Use l_idle for shutdown instead of g_timeout
-rw-r--r-- | drivers/qmimodem/qmi.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 6880dc450..1e127d605 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -93,7 +93,7 @@ struct qmi_device_qmux { qmi_shutdown_func_t shutdown_func; void *shutdown_user_data; qmi_destroy_func_t shutdown_destroy; - guint shutdown_source; + struct l_idle *shutdown_idle; }; struct qmi_service { @@ -1551,24 +1551,24 @@ done: return res; } -static void qmux_shutdown_destroy(gpointer user_data) +static void qmux_shutdown_destroy(void *user_data) { struct qmi_device_qmux *qmux = user_data; if (qmux->shutdown_destroy) qmux->shutdown_destroy(qmux->shutdown_user_data); - qmux->shutdown_source = 0; + qmux->shutdown_idle = NULL; __qmi_device_shutdown_finished(&qmux->super); } -static gboolean qmux_shutdown_callback(gpointer user_data) +static void qmux_shutdown_callback(struct l_idle *idle, void *user_data) { struct qmi_device_qmux *qmux = user_data; if (qmux->super.release_users > 0) - return TRUE; + return; qmux->super.shutting_down = true; @@ -1577,7 +1577,7 @@ static gboolean qmux_shutdown_callback(gpointer user_data) qmux->super.shutting_down = false; - return FALSE; + l_idle_remove(qmux->shutdown_idle); } static int qmi_device_qmux_shutdown(struct qmi_device *device, @@ -1588,15 +1588,15 @@ static int qmi_device_qmux_shutdown(struct qmi_device *device, struct qmi_device_qmux *qmux = l_container_of(device, struct qmi_device_qmux, super); - if (qmux->shutdown_source > 0) + if (qmux->shutdown_idle) return -EALREADY; __debug_device(&qmux->super, "device %p shutdown", &qmux->super); - qmux->shutdown_source = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT, - 0, qmux_shutdown_callback, - qmux, qmux_shutdown_destroy); - if (qmux->shutdown_source == 0) + qmux->shutdown_idle = l_idle_create(qmux_shutdown_callback, qmux, + qmux_shutdown_destroy); + + if (!qmux->shutdown_idle) return -EIO; qmux->shutdown_func = func; @@ -1611,8 +1611,8 @@ static void qmi_device_qmux_destroy(struct qmi_device *device) struct qmi_device_qmux *qmux = l_container_of(device, struct qmi_device_qmux, super); - if (qmux->shutdown_source) - g_source_remove(qmux->shutdown_source); + if (qmux->shutdown_idle) + l_idle_remove(qmux->shutdown_idle); l_free(qmux->version_str); l_free(qmux); |