From patchwork Wed Feb 21 21:22:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13566370 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.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 7D9341272DF for ; Wed, 21 Feb 2024 21:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550610; cv=none; b=hobK9ocvuqM+kd7Bu0wng1PX/7KFq4vXTc5OcLqgU+r7aOAXVM7MTG6V6UcmXesw6jtIDUUzLF1oSRbnF3vocOa3GGIGzrDoU+1oBnCPcdhSldQylOsasz1RnsCr9LGDjYIUFHjEeLjHwoACJKzu7LsMX9aJzyWLSalQoKVMaHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550610; c=relaxed/simple; bh=qYtF0+IosNPOvoPqI2SorHakXCCvrp24hoOnYoaxGUw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=WuXxJGv1goFIRvyT5yBN0oNNyiraFsOBAVBO1tb7zaphCc9W+jCvthJFaUUnfR0rBuImzH3rP+cghwnUr0f7zyrxAE6qk+rUayr/oAxz5kSfCqQWkrX0YBx9uJVO4dG/Rc26Pgvgmp9cXHLxN/9OGSMDZsjHqCedxAXIQH//w8o= 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=DAZ4Ck4h; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=kxuInYSb; arc=none smtp.client-ip=205.220.169.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="DAZ4Ck4h"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="kxuInYSb" Received: from pps.filterd (m0286615.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41LFwIaI025536 for ; Wed, 21 Feb 2024 13:23:27 -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=5XJqQ9AJQ+tf5XeyCQVo1hDFkBJCXmQFNo+r5XxF3fo=; b=D AZ4Ck4h5uUn/glMNez0F6YYIKXfD4YGxZepPW4/aOVimEf5us0BeK/bHJ5ojzr44 nsm3BwwU2Btipk7nd9HXCw1EQN4gqkLSXy7LU3hG/3k8G4lshMnFG52MqAoYXvlm Jl5CfJbxtBOrf9jis9vbDwjhn0BNpw6yzNW3jrPo2StpcX0i/AkzQ223yUNwZXR0 PxtRMX8rwkFqKkOtFe10LKoMnH5X75veDf6wpyg8512BRzh5om68ndSQe91U7LVm MR4VcAjYOoS+wwldHynQhspj/xaIhk5dySbdywVai9qd/VpQV4fQJ5Aa/TGMN5s/ oIzVLupc2ueItLSQCpS9w== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd563s0gs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 21 Feb 2024 13:23:27 -0800 (PST) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-78771ee4ca4so147996285a.0 for ; Wed, 21 Feb 2024 13:23:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708550606; x=1709155406; darn=lists.linux.dev; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=5XJqQ9AJQ+tf5XeyCQVo1hDFkBJCXmQFNo+r5XxF3fo=; b=kxuInYSbZybjLTdPopH+PV+g3+7+vm64tzSldyfIHwCxjJZtEmkWe/Be4xBScYWKaE 4V2mZDLeThhYJbu3v9cbH1rRBeMKC/o6HI6jpcyk03pmZHLVdu9X8tpfYfQE8GWEB+hU VvOiXaoV9P/8i/h80N1t+DN6pJFn8ZHYXKqXySsR+JEfckh8+yUkBtpHR/fS0BxUeODr 7Qf7R+Cn14jpa1jJIQyKboV79n+E2T+BLb7qoK6UOZQ/pU3bYMUlXEivvYMp6a3p7D7U lJMK+77HreASWGrb8dHrjt4CdvdX7rhxDzCxJj6fygLBkw7aeHI/2cwzyEZck1yZ3x1r jVNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550606; x=1709155406; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5XJqQ9AJQ+tf5XeyCQVo1hDFkBJCXmQFNo+r5XxF3fo=; b=RGQRVp4y8Bwm/EFJIuKbA/jHBQUTUfkWC9q9V1TprnsuUhVBZSF6ZfBPL41kKO/lO/ FXrlkHs3f4PtFqWcm9mi95kbflKZw9ykL1DBkE0jTbZYAfTf7gvPMScSlc8f/k35Nk9+ XDP6/UIqBMm7gJDRIuYCa5fmGlajsOl6W9kTOvg9+ZdD9RkjBbM0cOROI3zw+dzZQQno dZSnYgoNv8PuayjNUZNkq4QnOQ4ezcHtxmcS7p4pgctDL22moA2HuBC0tvV5cyyuH3+Y jNdf7cJdBH76M3A6XLOeYJGbC3kbJ2SHeIGDE/USxb1N0E3/IUcmhiqc2RvenP8XPazX +ZVA== X-Gm-Message-State: AOJu0Yzngq5yasNVUle/51nUDEaDI9vUsZ7r95kQ3yk8Znc6fu/cYQ1O mg8Uz+h2iGo6ZSShcl/jXYKutUfuYRA0tijz2jTvPOi9f3Ot6HulVnXOKoyhSrvA56XkFPidazl ZmGCU93CCADtNhq5HfaRWF5jvFgyWqyrGkofrTULsaEpDRTV+LBSi5ih0VvlWU1QNciu6dpDo9u VApN63V8Rxbqc4apk7aqvNKDIiyhuRq8f7KJC7bgYaIRI2eVM= X-Received: by 2002:a05:620a:55a3:b0:787:240f:f438 with SMTP id vr3-20020a05620a55a300b00787240ff438mr19289280qkn.22.1708550605905; Wed, 21 Feb 2024 13:23:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFldhPXXTLYbUi/TZxK09RJj3kC/UEGfmtoZvMMtCsJSfONUnZo89z0m+VdJHSsOlUnL5KVGA== X-Received: by 2002:a05:620a:55a3:b0:787:240f:f438 with SMTP id vr3-20020a05620a55a300b00787240ff438mr19289268qkn.22.1708550605527; Wed, 21 Feb 2024 13:23:25 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id v14-20020a05620a122e00b007874e3ae338sm4486186qkj.21.2024.02.21.13.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:25 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 1/7] qmimodem: Use l_queue_remove_if to eliminate double lookup Date: Wed, 21 Feb 2024 21:22:06 +0000 Message-Id: <20240221212212.181401-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-GUID: NDCUGXsCLLJ6kMMMdpoXUUwXTlP4eAB- X-Proofpoint-ORIG-GUID: NDCUGXsCLLJ6kMMMdpoXUUwXTlP4eAB- 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-21_08,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 impostorscore=0 spamscore=0 mlxlogscore=938 lowpriorityscore=0 clxscore=1015 suspectscore=0 bulkscore=0 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402210166 --- drivers/qmimodem/qmi.c | 50 ++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index a2f5902f..d2d4eefa 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -793,12 +793,9 @@ static void handle_packet(struct qmi_device *device, return; } - req = l_queue_find(device->control_queue, __request_compare, - GUINT_TO_POINTER(tid)); - if (!req) - return; - - l_queue_remove(device->control_queue, req); + req = l_queue_remove_if(device->control_queue, + __request_compare, + GUINT_TO_POINTER(tid)); } else { const struct qmi_service_hdr *service = buf; const struct qmi_message_hdr *msg; @@ -819,14 +816,14 @@ static void handle_packet(struct qmi_device *device, return; } - req = l_queue_find(device->service_queue, __request_compare, - GUINT_TO_POINTER(tid)); - if (!req) - return; - - l_queue_remove(device->service_queue, req); + req = l_queue_remove_if(device->service_queue, + __request_compare, + GUINT_TO_POINTER(tid)); } + if (!req) + return; + if (req->callback) req->callback(message, length, data, req->user_data); @@ -1244,19 +1241,13 @@ static struct qmi_request *find_control_request(struct qmi_device *device, unsigned int _tid = tid; if (_tid != 0) { - req = l_queue_find(device->req_queue, __request_compare, - GUINT_TO_POINTER(_tid)); - - if (req) - l_queue_remove(device->req_queue, req); - else { - req = l_queue_find(device->control_queue, - __request_compare, + req = l_queue_remove_if(device->req_queue, __request_compare, GUINT_TO_POINTER(_tid)); - if (req) - l_queue_remove(device->control_queue, req); - } + if (!req) + req = l_queue_remove_if(device->control_queue, + __request_compare, + GUINT_TO_POINTER(_tid)); } return req; @@ -2375,17 +2366,14 @@ bool qmi_service_cancel(struct qmi_service *service, uint16_t id) if (!device) return false; - req = l_queue_find(device->req_queue, __request_compare, - GUINT_TO_POINTER(tid)); - if (req) - l_queue_remove(device->req_queue, req); - else { - req = l_queue_find(device->service_queue, __request_compare, + req = l_queue_remove_if(device->req_queue, __request_compare, GUINT_TO_POINTER(tid)); + if (!req) { + req = l_queue_remove_if(device->service_queue, + __request_compare, + GUINT_TO_POINTER(tid)); if (!req) return false; - - l_queue_remove(device->service_queue, req); } service_send_free(req->user_data); From patchwork Wed Feb 21 21:22:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13566371 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 E6336126F00 for ; Wed, 21 Feb 2024 21:23:28 +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=1708550610; cv=none; b=c5sGRtsQgDj29MSnmUZzv/tmcWnOGkg0uWYoiv1o1k52e0WLohV6dD7MJwQmwLsrP1+j+G9v1b9O9btQPIkAUUUIh/+OIlH5hfuHkTkvCr5imjii5U1vUDZnnPszEyv08TA0TWXVpNp3dt/r0qALe8ObszpGkppd/HYB6rW15CI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550610; c=relaxed/simple; bh=jr30E/c46f7AjE4GFTnA42tUXCkNMW55T6CAt+b+u94=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=A426jD6o87NRms0ZRXMK2NQUZ9yw05OJoX5w6QaGPLKUjajMXKQh/zMuIO0UTTgKOh8Pc/XHMzfsShdq+8XQ1yb5r5MVQ7TW/EVJCYdEWektcsNFKJf1XLk76Z5UrVMjdCbMueKlP3+0DLsrKpGMnHslZvFWt5sGjb6mF9mCSk0= 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=JL/ftckd; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=mKbJs95U; 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="JL/ftckd"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="mKbJs95U" 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 41LF0NBD030938 for ; Wed, 21 Feb 2024 13:23:27 -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=4x57i+ppK4O34TdFWwHcB3 Li3d+v19z5RmetLDuwL6U=; b=JL/ftckdZmLa3wEaXH3AKVzGTYwyPw9GGkbQCb hneJsjiFmg0AIxixJL+ilbNLbbpLIQzPY7/HOlWbBrmv5H5W+vFHPvknHXDPYr1R hkwtd+yxzGYoME0RlY6wvxqkUXacPTG74+2x6i/wtXOJPsiuvTj6pctN3dwhdowE yJX5wHISciPclaTtXrwI6YQPkSU3ehmjqgcwzns/eJAjMD7zKrJ17CpUtH6464WN eCqiLSoCJUxHF2ev5zV/y315XNuO0TirqANo83aevJ3iYZjY/hMYN/SdsNsw6vX/ pNgmDl5xm2flES80P99yrc+VOeoc2LGiL15MGMX6zD+TvOqg== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd58hs0bg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 21 Feb 2024 13:23:27 -0800 (PST) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7816e45f957so173040185a.1 for ; Wed, 21 Feb 2024 13:23:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708550606; x=1709155406; 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=4x57i+ppK4O34TdFWwHcB3Li3d+v19z5RmetLDuwL6U=; b=mKbJs95U9cbws1BimZ36D/sEw6nVYmXeOCsKJ6+YSlKC+7v3IUaMqvNBqxy6sDM8Qd CVKK84yDUWZ27BA1/bBBGjcCeKo++cNIo89oNDIN8TqjBp1yPa1NrE2+aHXaOhUI4XuL Fe+lcxfyc5xq/D2av7H2dL07Bilx5rSdueDfasr4KPqjQBE5+oWgFuzk7sVZJ00FuwyF xtTSofMwLhndIo2RkrOoYqWnyOwTQ0qJWWcVCRRdUB7GYYxvLn4/qrYv39HHcIjsWbC/ eXJWFCRZY3j+ASlCIQtF2GYqBlE9zGJtpAcznOPrjhJzV13CbX9AnbCaFu4pwa+KcEkg gbpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550606; x=1709155406; 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=4x57i+ppK4O34TdFWwHcB3Li3d+v19z5RmetLDuwL6U=; b=Ljg1Yh6spO7ImrMU/eEcgBzdZDy8WpzC3V+CNmNcWa/oETJcZ288cJRqS5AKNQr+7o lj5dunN4exnjAf5m3wQW+TTmb3NEcS0cNBVhCK3oqyPQYxC+5lozROZYngXXFxVCq+vk tRYcs34uDaDvGdZGTnHaLFu5CdTFT9flOcqfsBQd55JXPu4vPY3jQgb5p17JJx5jkBL0 qkGnjUkujbevhgOUJzlxVVx1xH5YWBt/c6nVL4AaV1/6hHp653tIUOGWsneM3niUFRgi 9nX+C4wU1p7Wx7bC/nJzAQn9lMb7VLdU8z9WS6NOEMkzgAAKofCHINXfEiJVseSYqu39 XvRg== X-Gm-Message-State: AOJu0Ywnl2nGp1ky8bUYNXYXJP6X+Zw36//MwOC2WtrMgTGMe2gfXkEl E/YB++p3OsMu+ujJMiLNx5orhGYU4K1bl5wECHQ5cf3IAB9Fs4pt97+U0O+iFupULXymwbbzEzc va/xLi4jNnQ803k2XR1/Ir8KDaM7hUnJpdQnIMn7GRzEaesEKJR9QliiMbNqtY7wZb2Nk5DGelD bzLvcM0l6icPNwMBhl4Q0r60VrJX932WyWmn6DcKfVHUojmpc= X-Received: by 2002:a05:620a:4056:b0:787:83b3:2283 with SMTP id i22-20020a05620a405600b0078783b32283mr4690539qko.23.1708550606367; Wed, 21 Feb 2024 13:23:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IH26xAQQ4K3BEwDXzoaZi/nWHsZrDfc3IXN0ehuh+d/hn0RnQzV4MNeAITujR3QPX/u4P8PBQ== X-Received: by 2002:a05:620a:4056:b0:787:83b3:2283 with SMTP id i22-20020a05620a405600b0078783b32283mr4690519qko.23.1708550606007; Wed, 21 Feb 2024 13:23:26 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id v14-20020a05620a122e00b007874e3ae338sm4486186qkj.21.2024.02.21.13.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:25 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 2/7] qmimodem: Use l_timeout for discovery Date: Wed, 21 Feb 2024 21:22:07 +0000 Message-Id: <20240221212212.181401-2-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240221212212.181401-1-steve.schrock@getcruise.com> References: <20240221212212.181401-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-GUID: k0z6XUVmdkT0jaRMbozJU9GGPNxVFhw_ X-Proofpoint-ORIG-GUID: k0z6XUVmdkT0jaRMbozJU9GGPNxVFhw_ 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-21_09,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 bulkscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402210167 --- drivers/qmimodem/qmi.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index d2d4eefa..5694b927 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1101,17 +1101,15 @@ struct discover_data { void *user_data; qmi_destroy_func_t destroy; uint16_t tid; - guint timeout; + struct l_timeout *timeout; }; -static void discover_data_free(gpointer user_data) +static void discover_data_free(void *user_data) { struct discover_data *data = user_data; - if (data->timeout) { - g_source_remove(data->timeout); - data->timeout = 0; - } + if (data->timeout) + l_timeout_remove(data->timeout); if (data->destroy) data->destroy(data->user_data); @@ -1253,7 +1251,7 @@ static struct qmi_request *find_control_request(struct qmi_device *device, return req; } -static gboolean discover_reply(gpointer user_data) +static void discover_reply(struct l_timeout *timeout, void *user_data) { struct discover_data *data = user_data; struct qmi_device *device = data->device; @@ -1262,8 +1260,6 @@ static gboolean discover_reply(gpointer user_data) /* remove request from queues */ req = find_control_request(device, data->tid); - data->timeout = 0; - if (data->func) data->func(data->user_data); @@ -1271,8 +1267,6 @@ static gboolean discover_reply(gpointer user_data) if (req) __request_free(req); - - return FALSE; } bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func, @@ -1295,7 +1289,7 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func, data->destroy = destroy; if (device->version_list) { - data->timeout = g_timeout_add_seconds(0, discover_reply, data); + data->timeout = l_timeout_create(0, discover_reply, data, NULL); __qmi_device_discovery_started(device, &data->super); return true; } @@ -1305,7 +1299,7 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func, NULL, 0, discover_callback, data); data->tid = __request_submit(device, req); - data->timeout = g_timeout_add_seconds(5, discover_reply, data); + data->timeout = l_timeout_create(5, discover_reply, data, NULL); __qmi_device_discovery_started(device, &data->super); From patchwork Wed Feb 21 21:22:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13566372 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.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 DB59C127B40 for ; Wed, 21 Feb 2024 21:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550611; cv=none; b=GocXsk10ItES+e7fzy5jJKQn6E6pUcoKAWdM8RX5NnOA2Jl3ePjwwL3ds60IjDFS+Z4krHzKo1sccjbzLTL56bIYMg60VqH+pfoGEh88/CNSDWi0rDbhGB/5iLxBDVSlgwZE73ALPX2Td10dW2z2IuYO8p2H4ZXXqgku0e93Znk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550611; c=relaxed/simple; bh=Z8MaP/hf52AjK17eiXi0tTi7CRO2UH/rx1DP6UEQ2Go=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=aMBTSoYpCx6XviTfT1zeujjLK6snT9YnbcUhJlReKpMhzTpybkY/pZyLPwRJ7Za0WWWM6zPbClptFd6xsOl1oVfU9ZmOk33/bxnEBRfq00RDPrA+OcmvjitA/OjLFLs/mBCUhYPYhd0v0RouQ5ACnuTlVUBe1BuviyI6nxUNncY= 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=cSWcwEvf; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=TddQiF4Z; arc=none smtp.client-ip=205.220.169.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="cSWcwEvf"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="TddQiF4Z" Received: from pps.filterd (m0286614.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41LF1OJM001528 for ; Wed, 21 Feb 2024 13:23:29 -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=3J+RqhC2Hlg8tfAZGBBwOp zUlme1I5rntBeRjuBGBVw=; b=cSWcwEvf/IvlKTKolumeQU1upWic9dScpU/2eU BM0w+dmLUAxq/ewCsBaMBFBxwIUmDtTWecqIVzs+UPj3BHvXOB4mgc3LizAGEg+Z zmOEpSE7KgD3nl9hszvarH/zynxQio/aSLUXZkS5k8sktLkvfIOqT3YIH9zMIENW J4ykDvbVYQItIUBro+oUmRami0CZ3pcaaL0DvPOsq6Ful/DO9fsiscerb/6RGCPi mX4hsB6n8zl2Un07KjurTam2yxIsd/mM/pOW1Fz7xozulq3lqZROQJyMMgueOb/9 7m38WGep3Tk0wO6a3xLB+UnbiYEqfr/WnplvRwAmjWEtv14Q== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd565h0d4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 21 Feb 2024 13:23:28 -0800 (PST) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7876620c02aso413075585a.3 for ; Wed, 21 Feb 2024 13:23:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708550607; x=1709155407; 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=3J+RqhC2Hlg8tfAZGBBwOpzUlme1I5rntBeRjuBGBVw=; b=TddQiF4ZDNPqty8ReNgPFPiOuvL3+39j1MeNBs9G8uBgt4z6CeuHtCc6gYgTzqWonz s8U0C3AZPA40s5hXmCklc68UlNJPkgUDdNay2X+ffguNEozpGLdKWq+31ynFG8n1SGEw N68IAMQgxr87F/yPCCW5BkbTzTqdcscMGga5clUrrDqz7d6xITMMYltS7sAoRfzn3Mgg aFn+fi5WryvFNVjJhj1SJOan/q8bhwiP1ZPCdyybJodnzQNENM/xpqA+K4sTpkCRg0Sx eIrCHDchFtmLYdgtf8FlqF1X4X6YrzhD4vC1I6cCahBRlk7/PmXAKZsYZPCrOMcnoB3a BaUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550607; x=1709155407; 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=3J+RqhC2Hlg8tfAZGBBwOpzUlme1I5rntBeRjuBGBVw=; b=BNcG8wCQH0rGnvPu3Hsb2nivik6uJ2YybcFKlKLBj5ftqqO12/r4xR3w2qSqpIomst o7u77FFep9I4U1xGjvyJWXhG5ta66Bd6HgQSL2w4nuXaJrBFivctEX59c3IO7VZ4HEoc F17rPEhvHAsEU8x+Tvlw3QmDU2VzvKUDKMjcHj1AuhFns/J7JxtPMIXh0iNXf2Rpm1xL y65n4fJz5FJvgm3xqa6sZslCk/1RqLYntc9YCFPpHabpagGXi35cOSiW08upKcWm4/p4 zPyixDJhMsz3V6tgfgmLnTy1NLd2fORVkfhJ1aJpzw9t82AYaC03YwCvF/3JRViPxxK4 AEdA== X-Gm-Message-State: AOJu0Yxiu4HW06b1A8UJ+nU6bZtKM6n4C3m3/yvzMgE2zHmnU5wrdHut bgGyaa2orZILzvSAoy0SzZv/pihZvU+UYi6rwzQo1uLGvyURMaO6OQz91HsYP6ldm10aUkQOsEm CbvIRJD2nxx+zVJ0CFDgjcMZaZoyzsHHeIwPlElFqLURN9VktFOUoz54mBIdCej3+sVHtvfzw4S Q3qcrUhfI6D4R0QV2JFryMn8K4XpzVwu61rS6son9sfbEWxz8= X-Received: by 2002:a05:620a:14b1:b0:787:6a71:56e4 with SMTP id x17-20020a05620a14b100b007876a7156e4mr9562033qkj.55.1708550607161; Wed, 21 Feb 2024 13:23:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6ZYMy4XykDvdCZJUmhk8oaNEhIzpatuSsjzi1BD5ksWT6TgwRZqvMbQaaF+Ilt1C9jzFfiQ== X-Received: by 2002:a05:620a:14b1:b0:787:6a71:56e4 with SMTP id x17-20020a05620a14b100b007876a7156e4mr9562015qkj.55.1708550606803; Wed, 21 Feb 2024 13:23:26 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id v14-20020a05620a122e00b007874e3ae338sm4486186qkj.21.2024.02.21.13.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:26 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 3/7] qmimodem: Use l_idle for shutdown instead of g_timeout Date: Wed, 21 Feb 2024 21:22:08 +0000 Message-Id: <20240221212212.181401-3-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240221212212.181401-1-steve.schrock@getcruise.com> References: <20240221212212.181401-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-GUID: 9ukW-rFlbT-zocewFguM12HTxjPVm7fB X-Proofpoint-ORIG-GUID: 9ukW-rFlbT-zocewFguM12HTxjPVm7fB 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-21_09,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402210166 --- drivers/qmimodem/qmi.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 5694b927..eed69178 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 { @@ -1529,24 +1529,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; @@ -1555,7 +1555,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, @@ -1566,15 +1566,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; @@ -1589,8 +1589,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); From patchwork Wed Feb 21 21:22:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13566373 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.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 80853127B50 for ; Wed, 21 Feb 2024 21:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550612; cv=none; b=OBEc3mDxsUqNrdUATUj4wTUAYohfYuGN8NuXOQxlUctrZ9/ZEHYQmDhud8YObwSFDr8NVjFPIzXfa7W+kOhb4zl4K4R44HG6kSj+zxz5+Y29exk+QzXiQguUdLWVF5jycckKoAICWia7U8xe6E1SZpfhJ5YlhYCvUNh8b9F9oC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550612; c=relaxed/simple; bh=WniWKL3o+Lw9aUcS7REGARPFErGoEMeQVi2aUhEULC8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=RRO7SPRtVoZu7Lh24o6w74Mx1xh9mPHhmmC9SIFMHl7rXjwOF2XMVdUOyM74vzTV06hgkMiSeBmCa/Px2Qf6AZlmGMCIa1vj65694q2K7H+tN4X3AIw6uYYFP0cYumG2baGs1pjo/hxQ8Sn2xhz7lbmj3Zeel6T9vkARUMwNP8w= 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=Mb89JjtG; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=c7EycesX; arc=none smtp.client-ip=205.220.169.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="Mb89JjtG"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="c7EycesX" Received: from pps.filterd (m0286617.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41LEvwwu031180 for ; Wed, 21 Feb 2024 13:23:29 -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=s2Vy1Eua0fbApHAroqAH/9 JyCMxf3BUZfBn2lcvCuJg=; b=Mb89JjtG8GWv/eki29TSIylKBHMTFUXRJExMva mCyCe0yS1/PYZoSKy8TlD9pQXY7GZ4s3u9zAxGuE+jKpk76sNHXAw1ahqF95DmFq Ja2hhsdWkCnt4ZDYFgbMEb46nytHf/w905cX6IsTcfZToA/OOAIE7TSlOeHSw9Hm Y0cRVXbqk8hHDM7o0/9QKoIpnC0Nkj6p6oMJmaxjHsMTakRTa8kZLeIYma809RFb tdGY2Lq+j1cvkNDsql5g47UoMlN/QjRXWZ2jTp3ySk2hGG/wSSpXtMCn/ZIsmX2m r9SM/mrxjdL2MYr2p1Eq7oN37ehoA0sSSEj8YqRTJ4o+e0Vg== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd56490fv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 21 Feb 2024 13:23:29 -0800 (PST) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-78794e4b233so34530685a.0 for ; Wed, 21 Feb 2024 13:23:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708550608; x=1709155408; 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=s2Vy1Eua0fbApHAroqAH/9JyCMxf3BUZfBn2lcvCuJg=; b=c7EycesX+ZFoi/eNaDCUDFjY/3EIa64iidoYz7ZXmCsGkb/OWjxHdS3AYR28u3YPT5 gWOc3LJWvbWTPsjWBrtrKnOQfhx8/eGKJkpjBBsNq7hrN0VBWcxCA9Z81aoGFSvdHZMu YccjLdMVSdH2VFrGZaeOxD9Qj1Mib1NEuExxSEX9T5KLoY0p7c6R8AouHc6+wI3EqxyC pyAUGkt4q//1siZB6oMP6whFrG1mM1ut/TcKQw1TKxqkVZIvevwzWtxs3lu/mq8FKzLa OJLTMa2ZSbia+RwpAZzt28IghFUyKTV1WNVV+ylR3voUg64P4QMLN2sxbeaxhOJQSoFm GJiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550608; x=1709155408; 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=s2Vy1Eua0fbApHAroqAH/9JyCMxf3BUZfBn2lcvCuJg=; b=tdFFZ3GSCIlPiSvTvT3YiISmVAI24O3+RAttlp7CLMqLnxIx0Lr1NeZ0dD63cqg7bg k0t8/FQXv4LaujRRt/UdwKVKlgZdA808IIfNjmz02JifBT7QhtJ7PgEFt2+r+lLN+TzP zs/P/hvxfZoMRCzhWSnIePDVIUeiy+00gI1VF/x7LTPX1RfPfq7SE2n4WRGe9eXUlgTS 5RxbRzpWvNAc+fbNNfu34V8mUBt8AqWhwOVjCkdQOojKOth2ywWQTmJvV79ZnFqeqjjW gj9nz0w7IxgZP5TzSs6v7Bq70zkJqX8pRZmnZjgqoYw64o7gx+P4pGwqez9pJ1A1N8H6 nyvQ== X-Gm-Message-State: AOJu0Yxik4CoIVFFtJxLI4MAYC6ltJ826m4gbRDwNWjLjlRxowJDIang tXBtUovUrHMV5qYNtlwMTEzJRD8vknVFQCEpgJGdL7YU7o7h41N97NwIb/6yNQAm4gB0zPvXMb1 OU9I2Pyzgp/f/PpztmOnCwxUUlLt1TBIYRQGk/Om9gMyIj80umyW7TqxXE0cZoab06S/f21dPVX DUstRskx0UKpmwNp5MBbhNGcY8k5cSNDhiUx9Ei1dS32jztp4= X-Received: by 2002:a37:c408:0:b0:785:b88a:1437 with SMTP id d8-20020a37c408000000b00785b88a1437mr20516442qki.37.1708550607891; Wed, 21 Feb 2024 13:23:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWD3y/S/z36qBmDdQhMHhWsiPL4v6Ojr+DSBNhuSHyeylI8s79D93wKU6BgcJKonaA88atdQ== X-Received: by 2002:a37:c408:0:b0:785:b88a:1437 with SMTP id d8-20020a37c408000000b00785b88a1437mr20516423qki.37.1708550607306; Wed, 21 Feb 2024 13:23:27 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id v14-20020a05620a122e00b007874e3ae338sm4486186qkj.21.2024.02.21.13.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:27 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 4/7] qmimodem: Use l_idle and l_timeout for service creation Date: Wed, 21 Feb 2024 21:22:09 +0000 Message-Id: <20240221212212.181401-4-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240221212212.181401-1-steve.schrock@getcruise.com> References: <20240221212212.181401-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-GUID: bpYMsIthJ3bCr7ceJkbSbf_8yqE13-tL X-Proofpoint-ORIG-GUID: bpYMsIthJ3bCr7ceJkbSbf_8yqE13-tL 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-21_08,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=930 spamscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402210166 --- drivers/qmimodem/qmi.c | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index eed69178..5f050742 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1908,7 +1908,7 @@ struct service_create_data { qmi_create_func_t func; void *user_data; qmi_destroy_func_t destroy; - guint timeout; + struct l_timeout *timeout; uint16_t tid; }; @@ -1916,10 +1916,8 @@ static void service_create_data_free(gpointer user_data) { struct service_create_data *data = user_data; - if (data->timeout) { - g_source_remove(data->timeout); - data->timeout = 0; - } + if (data->timeout) + l_timeout_remove(data->timeout); if (data->destroy) data->destroy(data->user_data); @@ -1934,19 +1932,18 @@ struct service_create_shared_data { qmi_create_func_t func; void *user_data; qmi_destroy_func_t destroy; - guint timeout; + struct l_idle *idle; }; -static gboolean service_create_shared_reply(gpointer user_data) +static void service_create_shared_reply(struct l_idle *idle, void *user_data) { struct service_create_shared_data *data = user_data; - data->timeout = 0; + l_idle_remove(data->idle); + data->idle = NULL; data->func(data->service, data->user_data); __qmi_device_discovery_complete(data->device, &data->super); - - return FALSE; } static void service_create_shared_pending_reply(struct qmi_device *device, @@ -1961,26 +1958,29 @@ static void service_create_shared_pending_reply(struct qmi_device *device, struct service_create_shared_data *shared_data = l->data; shared_data->service = qmi_service_ref(service); - shared_data->timeout = g_timeout_add( - 0, service_create_shared_reply, shared_data); + shared_data->idle = l_idle_create(service_create_shared_reply, + shared_data, NULL); } g_list_free(*shared); l_free(shared); } -static gboolean service_create_reply(gpointer user_data) +static void service_create_reply(struct l_timeout *timeout, void *user_data) { struct service_create_data *data = user_data; struct qmi_device *device = data->device; struct qmi_request *req; + DBG(""); + service_create_shared_pending_reply(device, data->type, NULL); /* remove request from queues */ req = find_control_request(device, data->tid); - data->timeout = 0; + l_timeout_remove(data->timeout); + data->timeout = NULL; if (data->func) data->func(NULL, data->user_data); @@ -1989,8 +1989,6 @@ static gboolean service_create_reply(gpointer user_data) if (req) __request_free(req); - - return FALSE; } static void service_create_callback(uint16_t message, uint16_t length, @@ -2093,7 +2091,7 @@ static bool service_create(struct qmi_device *device, service_create_callback, data); data->tid = __request_submit(device, req); - data->timeout = g_timeout_add_seconds(8, service_create_reply, data); + data->timeout = l_timeout_create(8, service_create_reply, data, NULL); __qmi_device_discovery_started(device, &data->super); @@ -2108,10 +2106,8 @@ static void service_create_shared_data_free(gpointer user_data) { struct service_create_shared_data *data = user_data; - if (data->timeout) { - g_source_remove(data->timeout); - data->timeout = 0; - } + if (data->idle) + l_idle_remove(data->idle); qmi_service_unref(data->service); @@ -2168,8 +2164,8 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, if (!(type_val & 0x80000000)) { data->service = qmi_service_ref(service); - data->timeout = g_timeout_add( - 0, service_create_shared_reply, data); + data->idle = l_idle_create(service_create_shared_reply, + data, NULL); } else *l = g_list_prepend(*l, data); From patchwork Wed Feb 21 21:22:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13566374 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.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 0F0A3126F00 for ; Wed, 21 Feb 2024 21:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550612; cv=none; b=uVQJcWhYsg+nWuXvhmW+gLJeZnhzkkdlLPMRi5YBkCKycjbj0/SOQLrs0cbqR9B7ydA+E1uzCD5Vze50aqMY2RGe/GSSIVtn81Wa2Nw+XkGes5TuMqcygv5VItYK1pdPiPv2x4uNY3vDegvmMLDzsd5PZjZejsfzKUHjAcAaCIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550612; c=relaxed/simple; bh=+ypoEyGoDUGht3YEWxu3nv7msC2bD4DiWgSKpA7/r/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=SC34grMxZMNpixRZNoSynMg1CTYpNb5l9223eihzZI7CyvSocEDN2GxBR5M1Blcb1feukjUFlKaMzwxPD9fX24lOD3ielpLQGZDz2ln2Z+X6qzTBBfI6+155i2sC6c74QCxVGdvqfCu/wztiYPxctCl7AeYaTws40ftYI4V2ZUY= 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=Y6e9nWMb; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=owcRzvhU; arc=none smtp.client-ip=205.220.169.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="Y6e9nWMb"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="owcRzvhU" Received: from pps.filterd (m0286617.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41LFjO2Y009797 for ; Wed, 21 Feb 2024 13:23:30 -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=GMqOZMHN/Ksu/N1TkKtrYW jBHhq8OBbpFZFw1OFzGa4=; b=Y6e9nWMbDN+DqEv5pfH0QJkQbfJhuqzHRoRY4Y EFS4QRhc2K8hrqLZ3+Sf7HUic1OIquJlN0Jtu4Xt80woGFi3AR3HGI7+nVqXdzyL Yng7G12kczVx3Jrlf5iBqcCUhkbAGVF4kfFqGpUrW04er5Abme4nRXubpRUAhRSf 6EQnJ25sMz+gWFtgCjUT8e2W3Q+YMrc9N0E4AdVi4+9EZYsSFXwq8WkVDhoKxOA+ EU/vKAMLiVLH/UjxgLdJDfuvXFG7Bs0V55b1Sm30TbVcGl7L88gQqCwElpFEm1pX RdOJ+xpMTqb0OA6BaRSiug5uxLjtXZKizQB70xBEsj0fCEiw== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd56490fw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 21 Feb 2024 13:23:30 -0800 (PST) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-78771ee4ca4so147998985a.0 for ; Wed, 21 Feb 2024 13:23:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708550608; x=1709155408; 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=GMqOZMHN/Ksu/N1TkKtrYWjBHhq8OBbpFZFw1OFzGa4=; b=owcRzvhUFre41lAhm9FVO1WQPGQueumQy92XJcH4AwYPNOOTBNYgW3mCF5E9QzZG4O 8w+sotdE3+/YKwF4+5gGAPBTEw9dIyUtQLwC2f4g3Es0veaLvFmYsc+qz2flrFu2Qfsf +jGxynzw18yThbRwPfSdT6VNeMVYq3v4Viu3c45BS3I0iAuTwgoUThTTggDuy2GhI1co YTtJiaolRGWfUb13AJ2z1Rx7StRu0OUbjQkDewh+Kpwyh9WNJgodtn3CDzHaAi+sEVlA ebN+JivZVJwFLRI9rGjYRZdZmuJybQ/fBLX0sHC6ZHAZZxS/58MJGTrAVGceAt80/UT/ SArA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550608; x=1709155408; 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=GMqOZMHN/Ksu/N1TkKtrYWjBHhq8OBbpFZFw1OFzGa4=; b=ecDVgmLvunmprVmWvZI/s+rmyIj9DhKM7yjxcAGiJMbV/XUoGp5TdeJ5tnlR2OEAPN 0kbGWKFFz8Fh9uLPax4sWCJ0mesUg/zEwcM2jVr/tiU8OmfXCkWk3uhj7EwbPZJXXwpL FvAoubYuhdhEP2nxB9WU5G1el23I1/P0b+fTP7jQACeDQnC+mh1Tab9Hda1WLy7M8dk5 U92QBBo7BUgEF3GHyIpTG3acjUDDRKkWLb/dRoT8fHDIs0P6glR7WNBM8WigQ6Q4B91g nUGCkwwfRhKQGP6L0TrN2SIt8VlCUbZ7uh5lNCC31dKUet+DqiAu1jDa1+odeoBM0jEg r6cQ== X-Gm-Message-State: AOJu0YzVGAalaz9qmxQ804ZOAdKhRvWVLY73ZDQDCb9SgedBF2UYBpEE cLynBbymm8JgbyH/fZmbX2do50I++lJ10Mlp4u56ViFtTt5caGsSNtvOMHtjAOM06ghjvFjWPcU ciminWgXHrgviYcoi8myVmC13mpG3HMF3kNR9y4+odNErcNKS31xn0T7znMRVdKyN+O7QipgeaN HJEXvSo2Q/xxSeocB0Rx5plwKj2wGJQTdsK2kQ7l4q1M5TZYY= X-Received: by 2002:ae9:e509:0:b0:787:425a:cdf1 with SMTP id w9-20020ae9e509000000b00787425acdf1mr16370969qkf.65.1708550608389; Wed, 21 Feb 2024 13:23:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVA/07kk4hyp+hq1cuFaLbV4yp66zG+89kIguIUWtDKAc/PbbU5jA9KR0hevLSPhc0rKuSDA== X-Received: by 2002:ae9:e509:0:b0:787:425a:cdf1 with SMTP id w9-20020ae9e509000000b00787425acdf1mr16370955qkf.65.1708550607972; Wed, 21 Feb 2024 13:23:27 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id v14-20020a05620a122e00b007874e3ae338sm4486186qkj.21.2024.02.21.13.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:27 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 5/7] qmimodem: Use l_idle for discovery when timeout is 0 Date: Wed, 21 Feb 2024 21:22:10 +0000 Message-Id: <20240221212212.181401-5-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240221212212.181401-1-steve.schrock@getcruise.com> References: <20240221212212.181401-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-GUID: -QzqrIkooFUPrtEKwSJZrxcxtosPhyVB X-Proofpoint-ORIG-GUID: -QzqrIkooFUPrtEKwSJZrxcxtosPhyVB 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-21_08,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402210166 l_timeout_create does not call the callback when the timeout is set to 0 seconds. The Idle API must be used in this case. --- drivers/qmimodem/qmi.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 5f050742..150fd343 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1102,6 +1102,7 @@ struct discover_data { qmi_destroy_func_t destroy; uint16_t tid; struct l_timeout *timeout; + struct l_idle *idle; }; static void discover_data_free(void *user_data) @@ -1111,6 +1112,9 @@ static void discover_data_free(void *user_data) if (data->timeout) l_timeout_remove(data->timeout); + if (data->idle) + l_idle_remove(data->idle); + if (data->destroy) data->destroy(data->user_data); @@ -1251,12 +1255,30 @@ static struct qmi_request *find_control_request(struct qmi_device *device, return req; } -static void discover_reply(struct l_timeout *timeout, void *user_data) + +static void discover_reply_idle(struct l_idle *idle, void *user_data) +{ + struct discover_data *data = user_data; + struct qmi_device *device = data->device; + + l_idle_remove(data->idle); + data->idle = NULL; + + if (data->func) + data->func(data->user_data); + + __qmi_device_discovery_complete(device, &data->super); +} + +static void discover_reply_timeout(struct l_timeout *timeout, void *user_data) { struct discover_data *data = user_data; struct qmi_device *device = data->device; struct qmi_request *req; + l_timeout_remove(data->timeout); + data->timeout = NULL; + /* remove request from queues */ req = find_control_request(device, data->tid); @@ -1289,7 +1311,7 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func, data->destroy = destroy; if (device->version_list) { - data->timeout = l_timeout_create(0, discover_reply, data, NULL); + data->idle = l_idle_create(discover_reply_idle, data, NULL); __qmi_device_discovery_started(device, &data->super); return true; } @@ -1299,7 +1321,7 @@ bool qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func, NULL, 0, discover_callback, data); data->tid = __request_submit(device, req); - data->timeout = l_timeout_create(5, discover_reply, data, NULL); + data->timeout = l_timeout_create(5, discover_reply_timeout, data, NULL); __qmi_device_discovery_started(device, &data->super); From patchwork Wed Feb 21 21:22:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13566376 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.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 DC848127B58 for ; Wed, 21 Feb 2024 21:23:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550613; cv=none; b=hkYUv3fS25OJ6S5HpYLr9zPc2iWb62sVbFSw5Bg2P65/FTzvogtVZO9ysAoi5f2Ysg6+O17yU3oOJoRT7ekEyZhwl2CASKARPv6rpNuj57lHG2sGGh4y+g9kCdS31Zul2s8P3QQ0EsPDa0kF0W69z14Vsp3e8hFMjKwQuFeTv0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550613; c=relaxed/simple; bh=44uUTdUYrFFhoo2p/+W3DjT5KxVPP3UerMDQquKt+0E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=fc9xGrAtrVmyBb71HY7CnQpUBQG39H7p1/W03QaMWMu1qLZTWgE+HJMVf/Lm1/yt1PDc8Rw1IuBKiYob6mDwdkh3X/kqFcCEt3wlC/gsbfXg1rsWHVSc1C0MACQsEeVPMBqmwfi2uflemqMU4/FIqtudcu+ZAtXFTGq3e8AllEE= 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=CUgmw168; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=BL1sYZ+W; arc=none smtp.client-ip=205.220.169.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="CUgmw168"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="BL1sYZ+W" Received: from pps.filterd (m0286614.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41LEvuKX025485 for ; Wed, 21 Feb 2024 13:23:31 -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=CzASE58b3pdGttu0/4S1tA SkjVB2JL9ItqfqsLJBfNE=; b=CUgmw168Srcda+RL7dJ1AnC/6jos8/WUWBBfZU OQGBYLn8exBPHZRkMAP3w6FVzn1m8SXMO8C/1rYgZjSxHyh80y7tcZSuUI/woxrT 6ffcYpMk2hIyDXMUHCgx/yaXc+M6uX0GY4W6FFaaq9GMb/u7piYAnPeL/s9iTJMi sTP5WRtIpwlwtxujb4d48qMCaUXNqpMegzN/Xc/3gjehAOQGsoQYkgzPz7Qr5BNH rPi+4FXFUumaOrJFM6bfHOLVgekyw3Lgne7U+Z0QLZ8i868vLeO8Lmr7zd2aMzae D7St4uqGafe6QngSv89D0+OSC8e+8CC+hxhn8cVpQYFLD+hg== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd565h0d5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 21 Feb 2024 13:23:30 -0800 (PST) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7816e45f957so173045185a.1 for ; Wed, 21 Feb 2024 13:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708550609; x=1709155409; 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=CzASE58b3pdGttu0/4S1tASkjVB2JL9ItqfqsLJBfNE=; b=BL1sYZ+WmtzoxbMtUGgUaKnANfIcRSOVXmCgc72jfw6lvgoggGL7BFdvgGx54/NMT8 zUJErRfKdMCOqv4FxBYeGHTYDYY+Ygdc7mNjVsg/mBSkQROLNlR5Ikr2/rBfnnkFkg50 kpLdb3rM+EiFXyis26O1GigjZeLe5wdJv2jB/Y6p0V2mvNRAZ3HMkuXQ/yjW7W3zecyA gzCG3w3oM6Uk8UMVB2IJBjFp07GyY/l6quMAE3NukZy18Yfj5znW624E3AxYLxGHBRHF QkpI6wwIP1eVBkVt+QloKBZCnUb91KJsRK5VBlDPTHg+S88be9OuHZfylBgi5c353p9w zXxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550609; x=1709155409; 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=CzASE58b3pdGttu0/4S1tASkjVB2JL9ItqfqsLJBfNE=; b=Rb9BSaAK1iLWhuuhVKZNPuSlEn07zpmFgILUoLP2hlPpfIaE4+LsaoqnfpmYjXGLUU PFgAo90vmx5ZwMTrwq0I6PIJJHL6UifAUrkaenCtZdOUkkGOvi8aiMbjSORboP/qnu2c U0UaeOfIolUWdKf5QKtQBGoBbNVn0Vit4GAnoNu3gYhPy7yhsgIBZ6AMmplUm6w8NtM2 R6P/e0hCrrmqIXe+fY/yIZcVo1T3HHFteEBy3Tr23v91QF5FoQZ674Kt2RwpjU85dn86 qGITtXWJn5gB+2GND4v/cHtT/c0f/69wCOhVPuQE9f7eRQM/6ko9oZmJrDeC8BXis+i6 mowQ== X-Gm-Message-State: AOJu0YyV0jZX+AalzkPrDR7hQiWqja6FbVPtJU8OZTPYk+AhLW5ACorj BpoeiM72cc3wCq83yj4JLLCIPqr40uXl+tl0SkISMHV748U5fodKHL4LY4WYUTEGyUi3Za4nY4T b6rdxp7fG2D1613lHInINtfEpu7saosRgIF8EQ2bXm23a03WSKWmTtRv22SX9xbqT3sqPVisN1J aS76ozNCrsr+VYpbZLcvjQJKOm9wmqT+UTJD/lqB4l6f6SIV8= X-Received: by 2002:a37:f502:0:b0:787:1ccd:feda with SMTP id l2-20020a37f502000000b007871ccdfedamr22386771qkk.77.1708550609062; Wed, 21 Feb 2024 13:23:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkvpbnNQdvF1FzGw5vMBizeSCgGxKeS6ElI2iNPzdzEnfNpXMgQQVGrlt1jAkIypiLf//pSA== X-Received: by 2002:a37:f502:0:b0:787:1ccd:feda with SMTP id l2-20020a37f502000000b007871ccdfedamr22386756qkk.77.1708550608624; Wed, 21 Feb 2024 13:23:28 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id v14-20020a05620a122e00b007874e3ae338sm4486186qkj.21.2024.02.21.13.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:28 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 6/7] qmimodem: Eliminate glib macros Date: Wed, 21 Feb 2024 21:22:11 +0000 Message-Id: <20240221212212.181401-6-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240221212212.181401-1-steve.schrock@getcruise.com> References: <20240221212212.181401-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-GUID: DnuE8W-OKVvFSkjvLsf3xOc_StkCGQqU X-Proofpoint-ORIG-GUID: DnuE8W-OKVvFSkjvLsf3xOc_StkCGQqU 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-21_09,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402210166 --- drivers/qmimodem/qmi.c | 100 ++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 150fd343..ba6ae0d2 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -204,15 +204,15 @@ static struct qmi_request *__request_alloc(uint8_t service, hdr = req->buf; hdr->frame = 0x01; - hdr->length = GUINT16_TO_LE(req->len - 1); + hdr->length = L_CPU_TO_LE16(req->len - 1); hdr->flags = 0x00; hdr->service = service; hdr->client = client; msg = req->buf + QMI_MUX_HDR_SIZE + headroom; - msg->message = GUINT16_TO_LE(message); - msg->length = GUINT16_TO_LE(length); + msg->message = L_CPU_TO_LE16(message); + msg->length = L_CPU_TO_LE16(length); if (data && length > 0) memcpy(req->buf + QMI_MUX_HDR_SIZE + headroom + @@ -235,7 +235,7 @@ static void __request_free(void *data) static bool __request_compare(const void *a, const void *b) { const struct qmi_request *req = a; - uint16_t tid = GPOINTER_TO_UINT(b); + uint16_t tid = L_PTR_TO_UINT(b); return req->tid == tid; } @@ -261,7 +261,7 @@ static void __notify_free(gpointer data, gpointer user_data) static gint __notify_compare(gconstpointer a, gconstpointer b) { const struct qmi_notify *notify = a; - uint16_t id = GPOINTER_TO_UINT(b); + uint16_t id = L_PTR_TO_UINT(b); return notify->id - id; } @@ -278,7 +278,7 @@ static void __service_find_by_type(const void *key, void *value, struct service_find_by_type_data *data = user_data; /* ignore those that are in process of creation */ - if (GPOINTER_TO_UINT(key) & 0x80000000) + if (L_PTR_TO_UINT(key) & 0x80000000) return; if (service->type == data->type) @@ -515,13 +515,13 @@ static void __debug_msg(const char dir, const void *buf, size_t len, } str += sprintf(str, "%s msg=%d len=%d", type, - GUINT16_FROM_LE(msg->message), - GUINT16_FROM_LE(msg->length)); + L_LE16_TO_CPU(msg->message), + L_LE16_TO_CPU(msg->length)); str += sprintf(str, " [client=%d,type=%d,tid=%d,len=%d]", hdr->client, ctl->type, ctl->transaction, - GUINT16_FROM_LE(hdr->length)); + L_LE16_TO_CPU(hdr->length)); } else { const struct qmi_service_hdr *srv; const char *type; @@ -547,13 +547,13 @@ static void __debug_msg(const char dir, const void *buf, size_t len, } str += sprintf(str, "%s msg=%d len=%d", type, - GUINT16_FROM_LE(msg->message), - GUINT16_FROM_LE(msg->length)); + L_LE16_TO_CPU(msg->message), + L_LE16_TO_CPU(msg->length)); str += sprintf(str, " [client=%d,type=%d,tid=%d,len=%d]", hdr->client, srv->type, - GUINT16_FROM_LE(srv->transaction), - GUINT16_FROM_LE(hdr->length)); + L_LE16_TO_CPU(srv->transaction), + L_LE16_TO_CPU(hdr->length)); } function(strbuf, user_data); @@ -565,14 +565,14 @@ static void __debug_msg(const char dir, const void *buf, size_t len, str += sprintf(str, " "); offset = 0; - while (offset + QMI_TLV_HDR_SIZE < GUINT16_FROM_LE(msg->length)) { + while (offset + QMI_TLV_HDR_SIZE < L_LE16_TO_CPU(msg->length)) { const struct qmi_tlv_hdr *tlv = ptr + offset; - uint16_t tlv_length = GUINT16_FROM_LE(tlv->length); + uint16_t tlv_length = L_LE16_TO_CPU(tlv->length); if (tlv->type == 0x02 && tlv_length == QMI_RESULT_CODE_SIZE) { const struct qmi_result_code *result = ptr + offset + QMI_TLV_HDR_SIZE; - uint16_t error = GUINT16_FROM_LE(result->error); + uint16_t error = L_LE16_TO_CPU(result->error); const char *error_str; error_str = __error_to_string(error); @@ -716,7 +716,7 @@ static void service_notify(const void *key, void *value, void *user_data) GList *list; /* ignore those that are in process of creation */ - if (GPOINTER_TO_UINT(key) & 0x80000000) + if (L_PTR_TO_UINT(key) & 0x80000000) return; for (list = g_list_first(service->notify_list); list; @@ -754,7 +754,7 @@ static void handle_indication(struct qmi_device *device, hash_id = service_type | (client_id << 8); service = l_hashmap_lookup(device->service_list, - GUINT_TO_POINTER(hash_id)); + L_UINT_TO_PTR(hash_id)); if (!service) return; @@ -780,8 +780,8 @@ static void handle_packet(struct qmi_device *device, msg = buf + QMI_CONTROL_HDR_SIZE; - message = GUINT16_FROM_LE(msg->message); - length = GUINT16_FROM_LE(msg->length); + message = L_LE16_TO_CPU(msg->message); + length = L_LE16_TO_CPU(msg->length); data = buf + QMI_CONTROL_HDR_SIZE + QMI_MESSAGE_HDR_SIZE; @@ -795,7 +795,7 @@ static void handle_packet(struct qmi_device *device, req = l_queue_remove_if(device->control_queue, __request_compare, - GUINT_TO_POINTER(tid)); + L_UINT_TO_PTR(tid)); } else { const struct qmi_service_hdr *service = buf; const struct qmi_message_hdr *msg; @@ -803,12 +803,12 @@ static void handle_packet(struct qmi_device *device, msg = buf + QMI_SERVICE_HDR_SIZE; - message = GUINT16_FROM_LE(msg->message); - length = GUINT16_FROM_LE(msg->length); + message = L_LE16_TO_CPU(msg->message); + length = L_LE16_TO_CPU(msg->length); data = buf + QMI_SERVICE_HDR_SIZE + QMI_MESSAGE_HDR_SIZE; - tid = GUINT16_FROM_LE(service->transaction); + tid = L_LE16_TO_CPU(service->transaction); if (service->type == 0x04) { handle_indication(device, hdr->service, hdr->client, @@ -818,7 +818,7 @@ static void handle_packet(struct qmi_device *device, req = l_queue_remove_if(device->service_queue, __request_compare, - GUINT_TO_POINTER(tid)); + L_UINT_TO_PTR(tid)); } if (!req) @@ -864,7 +864,7 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, if (hdr->frame != 0x01 || hdr->flags != 0x80) break; - len = GUINT16_FROM_LE(hdr->length) + 1; + len = L_LE16_TO_CPU(hdr->length) + 1; /* Check that packet size matches frame size */ if (bytes_read - offset < len) @@ -1027,7 +1027,7 @@ void qmi_result_print_tlvs(struct qmi_result *result) while (len > QMI_TLV_HDR_SIZE) { const struct qmi_tlv_hdr *tlv = ptr; - uint16_t tlv_length = GUINT16_FROM_LE(tlv->length); + uint16_t tlv_length = L_LE16_TO_CPU(tlv->length); DBG("tlv: 0x%02x len 0x%04x", tlv->type, tlv->length); @@ -1044,7 +1044,7 @@ static const void *tlv_get(const void *data, uint16_t size, while (len > QMI_TLV_HDR_SIZE) { const struct qmi_tlv_hdr *tlv = ptr; - uint16_t tlv_length = GUINT16_FROM_LE(tlv->length); + uint16_t tlv_length = L_LE16_TO_CPU(tlv->length); if (tlv->type == type) { if (length) @@ -1185,9 +1185,9 @@ static void discover_callback(uint16_t message, uint16_t length, for (i = 0; i < service_list->count; i++) { uint16_t major = - GUINT16_FROM_LE(service_list->services[i].major); + L_LE16_TO_CPU(service_list->services[i].major); uint16_t minor = - GUINT16_FROM_LE(service_list->services[i].minor); + L_LE16_TO_CPU(service_list->services[i].minor); uint8_t type = service_list->services[i].type; const char *name = __service_type_to_string(type); @@ -1244,12 +1244,12 @@ static struct qmi_request *find_control_request(struct qmi_device *device, if (_tid != 0) { req = l_queue_remove_if(device->req_queue, __request_compare, - GUINT_TO_POINTER(_tid)); + L_UINT_TO_PTR(_tid)); if (!req) req = l_queue_remove_if(device->control_queue, __request_compare, - GUINT_TO_POINTER(_tid)); + L_UINT_TO_PTR(_tid)); } return req; @@ -1423,7 +1423,7 @@ static char *get_device_interface(struct qmi_device *device) file_name = basename(file_path); - for (i = 0; i < G_N_ELEMENTS(driver_names) && !interface; i++) { + for (i = 0; i < L_ARRAY_SIZE(driver_names) && !interface; i++) { gchar *sysfs_path; sysfs_path = l_strdup_printf("/sys/class/%s/%s/device/net/", @@ -1687,7 +1687,7 @@ bool qmi_param_append(struct qmi_param *param, uint8_t type, tlv = ptr + param->length; tlv->type = type; - tlv->length = GUINT16_TO_LE(length); + tlv->length = L_CPU_TO_LE16(length); memcpy(tlv->value, data, length); param->data = ptr; @@ -1851,7 +1851,7 @@ bool qmi_result_get_int16(struct qmi_result *result, uint8_t type, memcpy(&tmp, ptr, 2); if (value) - *value = GINT16_FROM_LE(tmp); + *value = L_LE16_TO_CPU(tmp); return true; } @@ -1872,7 +1872,7 @@ bool qmi_result_get_uint16(struct qmi_result *result, uint8_t type, memcpy(&tmp, ptr, 2); if (value) - *value = GUINT16_FROM_LE(tmp); + *value = L_LE16_TO_CPU(tmp); return true; } @@ -1894,7 +1894,7 @@ bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type, memcpy(&tmp, ptr, 4); if (value) - *value = GUINT32_FROM_LE(tmp); + *value = L_LE32_TO_CPU(tmp); return true; } @@ -1916,7 +1916,7 @@ bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type, memcpy(&tmp, ptr, 8); if (value) - *value = GUINT64_FROM_LE(tmp); + *value = L_LE64_TO_CPU(tmp); return true; } @@ -1972,7 +1972,7 @@ static void service_create_shared_pending_reply(struct qmi_device *device, unsigned int type, struct qmi_service *service) { - gpointer key = GUINT_TO_POINTER(type | 0x80000000); + gpointer key = L_UINT_TO_PTR(type | 0x80000000); GList **shared = l_hashmap_remove(device->service_list, key); GList *l; @@ -2058,7 +2058,7 @@ static void service_create_callback(uint16_t message, uint16_t length, hash_id = service->type | (service->client_id << 8); - l_hashmap_replace(device->service_list, GUINT_TO_POINTER(hash_id), + l_hashmap_replace(device->service_list, L_UINT_TO_PTR(hash_id), service, (void **) &old_service); if (old_service) @@ -2119,7 +2119,7 @@ static bool service_create(struct qmi_device *device, /* Mark service creation as pending */ l_hashmap_insert(device->service_list, - GUINT_TO_POINTER(type_val | 0x80000000), shared); + L_UINT_TO_PTR(type_val | 0x80000000), shared); return true; } @@ -2154,7 +2154,7 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, return false; l = l_hashmap_lookup(device->service_list, - GUINT_TO_POINTER(type_val | 0x80000000)); + L_UINT_TO_PTR(type_val | 0x80000000)); if (!l) { /* @@ -2249,7 +2249,7 @@ void qmi_service_unref(struct qmi_service *service) hash_id = service->type | (service->client_id << 8); l_hashmap_remove(service->device->service_list, - GUINT_TO_POINTER(hash_id)); + L_UINT_TO_PTR(hash_id)); service->device->release_users++; @@ -2313,8 +2313,8 @@ static void service_send_callback(uint16_t message, uint16_t length, if (len != QMI_RESULT_CODE_SIZE) goto done; - result.result = GUINT16_FROM_LE(result_code->result); - result.error = GUINT16_FROM_LE(result_code->error); + result.result = L_LE16_TO_CPU(result_code->result); + result.error = L_LE16_TO_CPU(result_code->error); done: if (data->func) @@ -2379,11 +2379,11 @@ bool qmi_service_cancel(struct qmi_service *service, uint16_t id) return false; req = l_queue_remove_if(device->req_queue, __request_compare, - GUINT_TO_POINTER(tid)); + L_UINT_TO_PTR(tid)); if (!req) { req = l_queue_remove_if(device->service_queue, __request_compare, - GUINT_TO_POINTER(tid)); + L_UINT_TO_PTR(tid)); if (!req) return false; } @@ -2398,7 +2398,7 @@ bool qmi_service_cancel(struct qmi_service *service, uint16_t id) static bool remove_req_if_match(void *data, void *user_data) { struct qmi_request *req = data; - uint8_t client = GPOINTER_TO_UINT(user_data); + uint8_t client = L_PTR_TO_UINT(user_data); if (!req->client || req->client != client) return false; @@ -2412,7 +2412,7 @@ static bool remove_req_if_match(void *data, void *user_data) static void remove_client(struct l_queue *queue, uint8_t client) { l_queue_foreach_remove(queue, remove_req_if_match, - GUINT_TO_POINTER(client)); + L_UINT_TO_PTR(client)); } bool qmi_service_cancel_all(struct qmi_service *service) @@ -2470,7 +2470,7 @@ bool qmi_service_unregister(struct qmi_service *service, uint16_t id) return false; list = g_list_find_custom(service->notify_list, - GUINT_TO_POINTER(nid), __notify_compare); + L_UINT_TO_PTR(nid), __notify_compare); if (!list) return false; From patchwork Wed Feb 21 21:22:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13566375 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.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 04E4B127B40 for ; Wed, 21 Feb 2024 21:23:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550613; cv=none; b=p15OZxipXR7ldddAc1Yg7udDw7r4jlZfRS/apfMXla90bcqOr7HmdXTekhL81PAPBNbJwHjPLXp+XCjup1bv+PFKtioeFdjXdNx/ALOx5uZ7IzWspD3RL3/s3n2UERpzuf/xWPG4WnGRHyIsenEx/+SGkpbZlelrPua/hgTrumg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550613; c=relaxed/simple; bh=eaNxKsskYzRAojtR6WaTxgx7bBipa3Q3nIGXaWh482c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=uuK77PfhK05KNRr5c6r5PS3Et1ikruQfVoGHLhg3yM/hoeemudsKBmLFP7wTfqewMk9nmhV2eVADGjGlgc9MXLzHiH5IaEXPFN2LNM5cinKjjlF6MazJYCtcB9BbquDrmSvRtXvyBVN6MI/lur4yAD1AIAieRYh6sEJ8fue3j+E= 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=FDRwM+iQ; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=lvSaDek/; arc=none smtp.client-ip=205.220.169.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="FDRwM+iQ"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="lvSaDek/" Received: from pps.filterd (m0286614.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41LDLfqg008503 for ; Wed, 21 Feb 2024 13:23:31 -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=+jkFU4CPOL9gXqUUldK/2c sDbrDYut4XoKncxGKTOw8=; b=FDRwM+iQC5y+1LAL9Bl1lDiHq+/oVcEEynvyyV 5bT6gL/sSdd04kYdEPtUx2ghZ6e7xX6ccTwiKyXLW3bffM2YwmTsDO1MYCN4ffCb Im7tsftLWsfRFGuxxn5yqWX+3irVbf1wq0DLows8KfZZ427d/+5852iVXuEQ0cpt InWPhy6BByUDVbke0HjnTK0ewZSJ6zhGF+DZWhsBVStFtYUYpOsNPtDtfdnGJ5eb O3oX6n2M7vJsYXC+aFhfxrwzBLHm8Xl/wAKBi+kuP0i0aZ5+y1nhTova70jgQ7Fv wCs8GpzZOYwh0rq+PNSYWlNDDV/qxmGaMsoYe5z2mEMOt+5w== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wd565h0d7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 21 Feb 2024 13:23:31 -0800 (PST) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-78794e4b140so35244985a.1 for ; Wed, 21 Feb 2024 13:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1708550609; x=1709155409; 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=+jkFU4CPOL9gXqUUldK/2csDbrDYut4XoKncxGKTOw8=; b=lvSaDek/zAHNj1bDiVgFW+cdMJC2dhmGxvW83HSg68XioAimyFwz2MhD88GCaT9ZcT ExwgTXtpNa3KcUBZrT/us7JVpWm1kk++JilKJafPoafSVpatEN0G35LegPitQnaZyyF9 6gDGy2oayxpT/tz5iZ/bTzC6cYpG3AaHDB9KFH/CP6b4tdyUV2Bf5HzQWTau1Nmm2uq/ rUaRr6Rdnl2G4RZUmKLc3VutWxXhGppt2VhaPVNQhsPtEovJX9Qs4PyhnvcImG4CGTQi rYBC93rLCTa6cuG4nrlC1eEj6aZcfLMBnNViewZIOLnAIzvxyx7Nhne9++mof96bXBRi tryQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550609; x=1709155409; 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=+jkFU4CPOL9gXqUUldK/2csDbrDYut4XoKncxGKTOw8=; b=LdrS8WVihxOgD1Xoi2zpM80EqRGtJBaVuTra3Ghht4fNRY/DUMtQXbd8xSQryVVEKB Bc1Au8N9n2ZvtSWwOGBfOQQhEY2+NUdOeePgcaS4Jp/et7/YWv/uqAq+kAPtWKZO94vY tseiW3VmuMefx9UpXQGWvY06aIjiI4+3o+MuWVU/fFKbWTpg/AXe7rYu5yuvndyy25kD OxFYa6wXBPLamn47Zy9jwzpbbGXYJy4Sh0G0hcUrRkJBTI8zW46HuEbVM7aaXqFm3eY5 sd8HtF9Gbu2EuYdiz1nDstkQoGCSKWC0k1QEPvAWN6++oBzWUWwY9Yx/vv/Qpa8BpGcj 7p3w== X-Gm-Message-State: AOJu0Yx30CkLCRk6ekFZXYsEsTVisSzmO5GYqoJRtjNlBqIeKTr3jzA3 uKditSuYU4HqaqxDE09QLKG2a7Pwg+iTI06SULxDcFkc5yzIjYZ34NxWVDadozhRkO0DeyiDv86 4guRRDXooTK+JXmAsxcOmVuIbMwcjHIgPEQgVuNyL/5lzuq9lWE+Ub17LZ25qc3yeNILqZISjc2 0NH5YU+Rc0exLgq+Gwoz2k+/5xU1vv8WPVjUtKc3rCe42j+xc= X-Received: by 2002:a05:620a:2450:b0:787:25ca:dddb with SMTP id h16-20020a05620a245000b0078725cadddbmr24001410qkn.2.1708550609694; Wed, 21 Feb 2024 13:23:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6wDWZvTNj1hk1GEqqRTr9ixdbhP3AH8HZgwrOjW0y6XHOaiGDz5uwroyVxuLn8gzuBYmlSQ== X-Received: by 2002:a05:620a:2450:b0:787:25ca:dddb with SMTP id h16-20020a05620a245000b0078725cadddbmr24001394qkn.2.1708550609315; Wed, 21 Feb 2024 13:23:29 -0800 (PST) Received: from localhost.localdomain ([140.177.180.84]) by smtp.gmail.com with ESMTPSA id v14-20020a05620a122e00b007874e3ae338sm4486186qkj.21.2024.02.21.13.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:28 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 7/7] qmimodem: Use l_free in qmi_free for consistency Date: Wed, 21 Feb 2024 21:22:12 +0000 Message-Id: <20240221212212.181401-7-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240221212212.181401-1-steve.schrock@getcruise.com> References: <20240221212212.181401-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-GUID: 0UHFTh6MzQU-dMxa0HwDVN6iUqRzGNni X-Proofpoint-ORIG-GUID: 0UHFTh6MzQU-dMxa0HwDVN6iUqRzGNni 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-21_09,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 mlxlogscore=878 lowpriorityscore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402210166 Eliminate the final gchar* as well. --- drivers/qmimodem/qmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index ba6ae0d2..52a8e57c 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -174,7 +174,7 @@ struct qmi_tlv_hdr { void qmi_free(void *ptr) { - free(ptr); + l_free(ptr); } static struct qmi_request *__request_alloc(uint8_t service, @@ -1424,7 +1424,7 @@ static char *get_device_interface(struct qmi_device *device) file_name = basename(file_path); for (i = 0; i < L_ARRAY_SIZE(driver_names) && !interface; i++) { - gchar *sysfs_path; + char *sysfs_path; sysfs_path = l_strdup_printf("/sys/class/%s/%s/device/net/", driver_names[i], file_name); @@ -1813,7 +1813,7 @@ char *qmi_result_get_string(struct qmi_result *result, uint8_t type) if (!ptr) return NULL; - return strndup(ptr, len); + return l_strndup(ptr, len); } bool qmi_result_get_uint8(struct qmi_result *result, uint8_t type,