diff mbox series

qmimodem: Use l_queue instead of GList for pending service creation

Message ID 20240223165256.9541-1-steve.schrock@getcruise.com (mailing list archive)
State Accepted
Commit e6e58815c174d8cfcd88f6a1afe8f4dbebeebdd0
Headers show
Series qmimodem: Use l_queue instead of GList for pending service creation | expand

Commit Message

Steve Schrock Feb. 23, 2024, 4:52 p.m. UTC
---
 drivers/qmimodem/qmi.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

Comments

patchwork-bot+ofono@kernel.org Feb. 23, 2024, 5 p.m. UTC | #1
Hello:

This patch was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Fri, 23 Feb 2024 16:52:56 +0000 you wrote:
> ---
>  drivers/qmimodem/qmi.c | 29 ++++++++++++++---------------
>  1 file changed, 14 insertions(+), 15 deletions(-)

Here is the summary with links:
  - qmimodem: Use l_queue instead of GList for pending service creation
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=e6e58815c174

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 168dee1a..93e4991e 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -1386,20 +1386,19 @@  static void service_create_shared_pending_reply(struct qmi_device *device,
 						unsigned int type,
 						struct qmi_service *service)
 {
-	gpointer key = L_UINT_TO_PTR(type | 0x80000000);
-	GList **shared = l_hashmap_remove(device->service_list, key);
-	GList *l;
+	void *key = L_UINT_TO_PTR(type | 0x80000000);
+	struct l_queue *shared = l_hashmap_remove(device->service_list, key);
+	const struct l_queue_entry *entry;
 
-	for (l = *shared; l; l = l->next) {
-		struct service_create_shared_data *shared_data = l->data;
+	for (entry = l_queue_get_entries(shared); entry; entry = entry->next) {
+		struct service_create_shared_data *shared_data = entry->data;
 
 		shared_data->service = qmi_service_ref(service);
 		shared_data->idle = l_idle_create(service_create_shared_reply,
 							shared_data, NULL);
 	}
 
-	g_list_free(*shared);
-	l_free(shared);
+	l_queue_destroy(shared, NULL);
 }
 
 static void service_create_shared_data_free(gpointer user_data)
@@ -1699,14 +1698,14 @@  static int qmi_device_qmux_client_create(struct qmi_device *device,
 	unsigned char client_req[] = { 0x01, 0x01, 0x00, service_type };
 	struct qmi_request *req;
 	struct qmux_client_create_data *data;
-	GList **shared;
+	struct l_queue *shared;
 	unsigned int type_val = service_type;
 	int i;
 
 	if (!device->version_list)
 		return -ENOENT;
 
-	shared = l_new(GList *, 1);
+	shared = l_queue_new();
 	data = l_new(struct qmux_client_create_data, 1);
 
 	data->super.destroy = qmux_client_create_data_free;
@@ -2148,7 +2147,7 @@  bool qmi_service_create_shared(struct qmi_device *device, uint16_t type,
 			qmi_create_func_t func, void *user_data,
 			qmi_destroy_func_t destroy)
 {
-	GList **l = NULL;
+	struct l_queue *shared;
 	struct qmi_service *service = NULL;
 	unsigned int type_val = type;
 	int r;
@@ -2159,10 +2158,10 @@  bool qmi_service_create_shared(struct qmi_device *device, uint16_t type,
 	if (type == QMI_SERVICE_CONTROL)
 		return false;
 
-	l = l_hashmap_lookup(device->service_list,
-				L_UINT_TO_PTR(type_val | 0x80000000));
+	shared = l_hashmap_lookup(device->service_list,
+					L_UINT_TO_PTR(type_val | 0x80000000));
 
-	if (!l) {
+	if (!shared) {
 		/*
 		 * There is no way to find in an l_hashmap using a custom
 		 * function. Instead we use a temporary struct to store the
@@ -2179,7 +2178,7 @@  bool qmi_service_create_shared(struct qmi_device *device, uint16_t type,
 	} else
 		type_val |= 0x80000000;
 
-	if (l || service) {
+	if (shared || service) {
 		struct service_create_shared_data *data;
 
 		data = l_new(struct service_create_shared_data, 1);
@@ -2195,7 +2194,7 @@  bool qmi_service_create_shared(struct qmi_device *device, uint16_t type,
 			data->idle = l_idle_create(service_create_shared_reply,
 							data, NULL);
 		} else
-			*l = g_list_prepend(*l, data);
+			l_queue_push_head(shared, data);
 
 		__qmi_device_discovery_started(device, &data->super);