From patchwork Thu Feb 22 23:53:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13568351 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0027214036B for ; Thu, 22 Feb 2024 23:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708646123; cv=none; b=ABGKKr0zOqZD4El9l4StQdRQvSvbIK4uZQgi+RMXntfvhFXf5M46UAPduMqq//san89lxV8mZH59GipWPWnu95f/KLt7iQJuDoTNwX0jsUe6SChUmlEXa76hLfCPwXK8f0kWYSdg657ZcUJIKCYCpzjWXoniLafra5AG+xY//X4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708646123; c=relaxed/simple; bh=rKzMM7maBnwAvWtxkOcZFSgbEbW8YkFqKOqoU+IzxcI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=pzpm9DZvlkm28WHoWvNumC3Ct4Wi5crkLjHYDcN7sJwSC7h7xAT0ZgsRgZMBF0jQtu9Ok2HjUl/e6xc5+6adIZFPCt/YF6nzdDZnpAE5fiS/rozi/alMy5qf0LbkBp6GnKKO32GBNQSVn/Zd30gjFSEFsSgX9EobPRQC+uF9XOA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=LDpN2qcX; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=Vqqyfvy/; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="LDpN2qcX"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="Vqqyfvy/" Received: from pps.filterd (m0286620.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41MM1wtt006985 for ; Thu, 22 Feb 2024 15:55:14 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:mime-version:content-type; s=ppemail; bh=RiJ6gfmlZJp8Xt6pGxeN2Lw5UTJG8k1h4/56jLvwu1k=; b=L DpN2qcXVjfUKPmIdyH/4b9akDesmD/q9px7W3rT/FRfay2MKRY6qnG/9bEb3OPe2 HYTnc1L6ExXjE1tAk1QPTU1ZEMzKky2FRW66wjVzMeSJAiRzPIe+ctXvWXd4KmUC O+ykT+it2ke/2xyX4DsN7numVGZCdlCEBrd1bTBpBtY1DCt5/4cKXNYrT4vHt92N sabwu8g95CClxX8X6jA+wesgmJWtvDoWyfSBWqSiemP27h/g647nQTe/nOfD22sR hhCaUr0CAyil1AIJ9mKbskrj0BzniooR8Me7hpGeljBLysZSlrMAw39mmcbb/5Ah nBZecAcF350VkGdR8nYog== Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3weeq284a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 22 Feb 2024 15:55:13 -0800 (PST) Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-68f992cd47bso4672166d6.3 for ; Thu, 22 Feb 2024 15:55:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708646112; x=1709250912; darn=lists.linux.dev; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=RiJ6gfmlZJp8Xt6pGxeN2Lw5UTJG8k1h4/56jLvwu1k=; b=Vqqyfvy/TcoMAotV/etu2cSCLYRB+tXBP9DPzt8RkQ2IcavVGPz/0h2mF9Biopbxie NMPXx4FvcndDkcAnDZ7xuQcm5s1HKJi0l16pPBPgvKK41yAlidIW//8ia0CQ7STof4F7 F297wH4Xw7n2Fqvu49NlxsyDnzXxNpeDSSKpyiKLARs68QmO1XAq3E25nRSB1FFlQGJZ GQKDyMDiSADkAfzAXM6K5TJBStRre3Ofgjw7iu+jesmPqb9LYgwCLbVpGirh6AxndyAI MWnlGYJF8eL8H09AunGbt5OsxUttZH/xvHR9XCcZkcR1kjss0rVjNVcvWRXc54n7ifsG UKzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708646112; x=1709250912; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RiJ6gfmlZJp8Xt6pGxeN2Lw5UTJG8k1h4/56jLvwu1k=; b=tg3espfPxsu20zJy0XlDAI86VZB/NgXFDEhUWq53e5YHMUsRQ27g3BMLPjCdnkEG5h r9hRve4e8QVaaKRJ6wDzXUmFjsU/rmm4Xt4xlJ57CM4hvcrpHDl+0EJPX4ysz/8HNuQ5 TNMHlPBTiFv/IdOsVOPR0MJRskIXZ9YwvwNvjr1045qMuIYR4HI6jlVOUbrbIa4ZzvDP YC4jSUydHpn9W1zipZpVOqWLUnUoxQjyMjkMjyTTa3PdHrEbvS8bhXlMSIH/PhAfyaOp c1yznUF6zs0bJbMEYj8rfVVVUjIab46I+g1t1S9kidOSl2oHVawMJnDDeVioJlPOghTI 2xmg== X-Gm-Message-State: AOJu0Yz+U9pFI7D6Auilr0RwY0mmZaJxxWY6h1bQGKHxfyKR4J5/Z+y/ /DU8QjmdXLhdfxrtV0Wuc+jFI8for/u4gJIZNCAQZ5w8yWE5okOrn5cyb6uvH8bYGD3PUtApeSZ jcQJBqbkiNRxmS8p4V0N4oDMqTA1xh2/ojDhndNLocYzMZJP2/LftdA5dJKdAr9cFogNvDIBbK4 kHNRrvBNJQD+dVMhOKklBJtsTsn1QwZrMV2BO92YY4AyA6RHM= X-Received: by 2002:a0c:de03:0:b0:68f:8d9d:cca6 with SMTP id t3-20020a0cde03000000b0068f8d9dcca6mr648021qvk.63.1708646112567; Thu, 22 Feb 2024 15:55:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtj+6hAUi61X7oytNGyfxXHXw5TdDyYx5VdY9MU5CMKAPrpkg9TUwNa83EZX2qcvLFQ3pr9g== X-Received: by 2002:a0c:de03:0:b0:68f:8d9d:cca6 with SMTP id t3-20020a0cde03000000b0068f8d9dcca6mr648004qvk.63.1708646112181; Thu, 22 Feb 2024 15:55:12 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id ny13-20020a056214398d00b006862b537412sm7473837qvb.123.2024.02.22.15.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 15:55:11 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 1/2] qmimodem: Use l_queue instead of GList for notifications Date: Thu, 22 Feb 2024 23:53:55 +0000 Message-Id: <20240222235356.32485-1-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: E4tQXYVZyB8eIivxOVVXR3QOS62NjkI9 X-Proofpoint-GUID: E4tQXYVZyB8eIivxOVVXR3QOS62NjkI9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_15,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 bulkscore=0 malwarescore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 spamscore=0 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402220184 --- drivers/qmimodem/qmi.c | 52 ++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 268db1f7..168dee1a 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -112,7 +112,7 @@ struct qmi_service { uint16_t minor; uint8_t client_id; uint16_t next_notify_id; - GList *notify_list; + struct l_queue *notify_list; }; struct qmi_param { @@ -256,7 +256,7 @@ static void __discovery_free(void *data) destroy(d); } -static void __notify_free(gpointer data, gpointer user_data) +static void __notify_free(void *data) { struct qmi_notify *notify = data; @@ -266,12 +266,12 @@ static void __notify_free(gpointer data, gpointer user_data) l_free(notify); } -static gint __notify_compare(gconstpointer a, gconstpointer b) +static bool __notify_compare(const void *data, const void *user_data) { - const struct qmi_notify *notify = a; - uint16_t id = L_PTR_TO_UINT(b); + const struct qmi_notify *notify = data; + uint16_t id = L_PTR_TO_UINT(user_data); - return notify->id - id; + return notify->id == id; } struct service_find_by_type_data { @@ -717,23 +717,26 @@ static uint16_t __request_submit(struct qmi_device *device, return req->tid; } +static void service_notify_if_message_matches(void *data, void *user_data) +{ + struct qmi_notify *notify = data; + struct qmi_result *result = user_data; + + if (notify->message == result->message) + notify->callback(result, notify->user_data); +} + static void service_notify(const void *key, void *value, void *user_data) { struct qmi_service *service = value; struct qmi_result *result = user_data; - GList *list; /* ignore those that are in process of creation */ if (L_PTR_TO_UINT(key) & 0x80000000) return; - for (list = g_list_first(service->notify_list); list; - list = g_list_next(list)) { - struct qmi_notify *notify = list->data; - - if (notify->message == result->message) - notify->callback(result, notify->user_data); - } + l_queue_foreach(service->notify_list, service_notify_if_message_matches, + result); } static void handle_indication(struct qmi_device *device, @@ -1666,6 +1669,7 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, service->minor = data->minor; service->client_id = client_id->client; + service->notify_list = l_queue_new(); __debug_device(device, "service created [client=%d,type=%d]", service->client_id, service->type); @@ -2452,7 +2456,7 @@ uint16_t qmi_service_register(struct qmi_service *service, notify->user_data = user_data; notify->destroy = destroy; - service->notify_list = g_list_append(service->notify_list, notify); + l_queue_push_tail(service->notify_list, notify); return notify->id; } @@ -2461,21 +2465,17 @@ bool qmi_service_unregister(struct qmi_service *service, uint16_t id) { unsigned int nid = id; struct qmi_notify *notify; - GList *list; if (!service || !id) return false; - list = g_list_find_custom(service->notify_list, - L_UINT_TO_PTR(nid), __notify_compare); - if (!list) - return false; - - notify = list->data; + notify = l_queue_remove_if(service->notify_list, __notify_compare, + L_UINT_TO_PTR(nid)); - service->notify_list = g_list_delete_link(service->notify_list, list); + if (!notify) + return false; - __notify_free(notify, NULL); + __notify_free(notify); return true; } @@ -2485,9 +2485,7 @@ bool qmi_service_unregister_all(struct qmi_service *service) if (!service) return false; - g_list_foreach(service->notify_list, __notify_free, NULL); - g_list_free(service->notify_list); - + l_queue_destroy(service->notify_list, __notify_free); service->notify_list = NULL; return true; From patchwork Thu Feb 22 23:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13568350 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0023314036A for ; Thu, 22 Feb 2024 23:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708646122; cv=none; b=esE+RUy1v30/g5Qf3rniccfUx4dr9Ti4JCGOPBCrGZUQNlkRuF+0DWqFar14kKLCYrpk3sO0Dctx24bwmgLNouBTq1nRWP2j9yzUDVnAP//iaP59Hn8XyNIbBKauA1TN8eWyEpMC47ktWFtGZ63l2RP7CQWtVDqjykUf/2k4Kac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708646122; c=relaxed/simple; bh=DVkdYBEpaJ49DQQ2oFWdTU7OIJjpVv86L6rmsXBvzC4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=q919ygeaaD46DcT+8D8d+Mo2h4Gd3hWW4WCuTb+aSHmVZYo/znxhOqT6SwaUDz4wue8bWHajfbS62sU3lUNGFdhAGIKeuitUt7Iu7BdE8fCsJoV0yoSJu7jNlGFQzri6a5zyygnPTwdUE5lNdASWfCeninryVGgN4fcJZkWw0ck= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=QL1VW9VW; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=c7EQePeE; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="QL1VW9VW"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="c7EQePeE" Received: from pps.filterd (m0286618.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41MKwIvh007635 for ; Thu, 22 Feb 2024 15:55:14 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=biLhsYLCEEM4n5Cjtlt1jP lucDUy26914M3S3r83TbQ=; b=QL1VW9VWA4LUqwf9hpBXaw3lswmKzD7mOy9qrQ xDD57D9zPYLRdbeLxkITwTZSc0Jkt0B2W5krEbKyhCK5NPHWF4szjckOWkPPKpfr 9M1TbDfpN6W/J24LboWDUZLNegUD7d+jbd+b3TcZrf5jvi/086hluK2M6EJCrjGL hVQcN6wN6XrLKklkKFJ1DOWBJos9/txpALML2/mKzcklNqqfbXwPwKgrsfwUe/ti Amgzj2trv3APE/UyCzv1lLnYvQDYAlQHS1QEkzO8trGFkHktla48N4oLGLXv9fGx Z8ZQor6y/JccdutXVDeP4qdBuDhef8e4+Rg20CwcDPq8H9pw== Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd563a1wa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 22 Feb 2024 15:55:14 -0800 (PST) Received: by mail-vk1-f200.google.com with SMTP id 71dfb90a1353d-4b92015b9dcso216087e0c.2 for ; Thu, 22 Feb 2024 15:55:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708646113; x=1709250913; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=biLhsYLCEEM4n5Cjtlt1jPlucDUy26914M3S3r83TbQ=; b=c7EQePeE3MGRNCJSULTpySFKNxHAoiCD/hb99yGDx/3FenBfByj4cPdt+f53mE2O+C 4GchoinVf5uCnM9O+njeM1scID8LgJ0SvbI/RdYRRx0rnNID2Y/V378I/eexpZXigtkV 7oLe78rAYKbdFtEBywUD2ArT1WJqqPifmxrUuUCrKTmVM5NyvZXgq6HFTiHUJv1ATNg7 c+lcuH4zhWIH5MDFMOu2Pgq1IrN+ava5c47XFLDr28kB/qW6YgTcvlsjjbdICWdSTZ5o ilTRHuxExmv5Nk8gruE6wnVFWgsSUCnXZAqYYNW/xGLgZemAFaVGVhrzcDN5lJaoltyI Ki0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708646113; x=1709250913; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=biLhsYLCEEM4n5Cjtlt1jPlucDUy26914M3S3r83TbQ=; b=UaMgM3zPc0fHcRybXWt2noOt0R9f3/mjG1+R6mp+yBXFdkQf3crQZ5yYQuNsh94u07 +V6gfUMlu9sY0+NAt2iXeoIxTmp+bqQ1GkCbUybkpH3dgfD42PiZS9zZhLem/sliLoYQ eP9vIaRutASqmjuA4l2XROQ+t/ZLKoFcr9ITqf9D7ZBuiHHDQnphdcxl0wp7AOT3ZeC2 VI3yF8O5THOwF+n4mdYF3aopaVTbpvPgaALDfeiryeLCi36hk/HySBNyuOrzHy0M8Tj8 +jfKw3ff7V7rgLcWpMRDGB69dvl/zada4uuJF1UfptaA7c/OESIWxhrqik4G0Qi8pwWP OwfQ== X-Gm-Message-State: AOJu0Yzc1XNfzvVbCRjwnFxlnYQDYdjk6dVMLigiOS0Kdm9nR6F6Sb8f 9fJ7lNMZOjdXMcYNusaM3CJNg/dHj0NL3sNXWPNeBFurKC7hUmO+6qr9INsSJDuG2Gb0lPi1Dji EugnRTlMgBGJ5ZrqJ2d24iGlVj/hfA6u448TlwKPY46t4IcsIrArCPs3Br2y9UqIEY71aNm2rGB Wo3UYdi47QQJV2Fel0I5q/pd1ke2Z3lin1p6tpfKNPEvDQmiQ= X-Received: by 2002:a1f:e044:0:b0:4c8:8025:f451 with SMTP id x65-20020a1fe044000000b004c88025f451mr537365vkg.12.1708646113115; Thu, 22 Feb 2024 15:55:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFv8ZwrF7z8+fjKLrqtRPMVfA8PO0SN6fiymYqe1WoxUp8awffvDGG8CjX/Oe0tXLDs/MOx5g== X-Received: by 2002:a1f:e044:0:b0:4c8:8025:f451 with SMTP id x65-20020a1fe044000000b004c88025f451mr537351vkg.12.1708646112692; Thu, 22 Feb 2024 15:55:12 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id ny13-20020a056214398d00b006862b537412sm7473837qvb.123.2024.02.22.15.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 15:55:12 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 2/2] qmimodem: Use l_queue instead of GList for pending service creation Date: Thu, 22 Feb 2024 23:53:56 +0000 Message-Id: <20240222235356.32485-2-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240222235356.32485-1-steve.schrock@getcruise.com> References: <20240222235356.32485-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: G8GRiMIV1-n2FK5DHzhxZIXE5bttlT_u X-Proofpoint-GUID: G8GRiMIV1-n2FK5DHzhxZIXE5bttlT_u X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_15,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 mlxscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=710 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402220184 --- drivers/qmimodem/qmi.c | 43 ++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 168dee1a..99b3d84d 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1382,24 +1382,27 @@ static void service_create_shared_reply(struct l_idle *idle, void *user_data) __qmi_device_discovery_complete(data->device, &data->super); } +static void service_create_shared_schedule_callback(void *data, void *user_data) +{ + struct service_create_shared_data *shared_data = data; + struct qmi_service *service = user_data; + + shared_data->service = qmi_service_ref(service); + shared_data->idle = l_idle_create(service_create_shared_reply, + shared_data, NULL); + +} + 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; - - for (l = *shared; l; l = l->next) { - struct service_create_shared_data *shared_data = l->data; - - shared_data->service = qmi_service_ref(service); - shared_data->idle = l_idle_create(service_create_shared_reply, - shared_data, NULL); - } + void *key = L_UINT_TO_PTR(type | 0x80000000); + struct l_queue *shared = l_hashmap_remove(device->service_list, key); - g_list_free(*shared); - l_free(shared); + l_queue_foreach(shared, service_create_shared_schedule_callback, + service); + l_queue_destroy(shared, NULL); } static void service_create_shared_data_free(gpointer user_data) @@ -1699,14 +1702,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 +2151,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 = NULL; struct qmi_service *service = NULL; unsigned int type_val = type; int r; @@ -2159,10 +2162,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, + 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 +2182,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 +2198,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);