From patchwork Fri Jun 7 22:47:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690697 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 748FF19D8B5 for ; Fri, 7 Jun 2024 22:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800471; cv=none; b=qpDdZ5rZR2HIpHBsurSEbD5vUTGGOeF+w/x1ZZaylrVgUyK/FsPDpEqGT0mkZe8wM2Lc5TM9hggb/Ceuq8XrXc8M58KxrPhaO3cFq2Qm0OFSi7XKqhXyciyydbrtOpP9QweyK0dzTMD7SnDO/WiQJXApueKQblLFV3XRWx2XhxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800471; c=relaxed/simple; bh=1/80gbTjlXgIk8OT+kBLx/h+8UXTiTYj8iudPBpGZpY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fOwXS6IC2OoN/yMFc9BQdhost4i8GRtsqn22LMf0pq650xgwC79HRtraUcN6OVBIbwJit5FVm0sUAdYxH2Ewf4rlcThVEHwoYvkAWyUhJMDMpXUYXNXHmoKL4YFd5+ZHnyK4pnBUbax1VAFkWgj/+vqsg7nS9ZW5gxdVl/P5X1Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bFXrKFhC; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bFXrKFhC" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5ba6c41e1a7so1583810eaf.2 for ; Fri, 07 Jun 2024 15:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800469; x=1718405269; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qXBWSp+cdx6ohzTPdD8kho+bMxW8OHv04nQZYgxczAs=; b=bFXrKFhCsB77cHqUVXMiDoxcOHiWhR+DVCnqwoYvXUCRcBNEJMxTbwpOwElCicov7p UYR2MaUSYRdV5EQvzYkMXRUpcLp28arovLBgf980xUbvLrEg17yAtb8YuLF5qbjxMFsj rPEFWHkwe44s3wMGAY4YOasSMei1On4yqfUcdgcvhfuHFdmad775Nseqmkuv6XEEfXBx ktPTivHtS8C/zEWa642qFdtKDMPRBTbo7Y/OCmO8nDO1A+bcMiqeTCj4BULFLZqrn1en E2aDCX/zR1TRf9R92NUNSF8Ho8cEDMWW+k1S64g2lS4SOSq85VRRm/0Qr5oc1tASSWet ic6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800469; x=1718405269; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qXBWSp+cdx6ohzTPdD8kho+bMxW8OHv04nQZYgxczAs=; b=LZWn4KZnR7qe1haamuxQzgYMZVCTrudHx7kSH+LARJbYsUYu+U7bcfbHUBy491e6/j T4mZ68rDAIpTaFEsl3a9AABcqiXDBUEdAUBi+Ap4YnA/Ft1p2+Bm85hAC/RF4IMeotXB J+M0ZrBrN0NvUmVMhi5bMDyIpc++Ru1AMuqhoEmjgHQKTF+zZsT0Jdhdr7IIryCcO2Lp 8+lIxfOWO08rsYrSgj5OO9Ejba44qUuL6DakP3eoccxjGqgjKp5UrbHtOQFkx7MXdRbI 4vOUqjrdyCn6Vj3nLrX1U0nzYXSUXkIjOOIJHqJahqCO6Q7AQocPmKfmuD4RPXfaDsBK PnkQ== X-Gm-Message-State: AOJu0YyKUeh9qBLG1TRN+wYGZlJsTgT9z260pIHRn7gzeIkvRFIGmE0m VNO5Lip1pEKL4a1yJbRW6hQfVaBVbzW+v1MLxneQThwIhbNJhkAF1EOF+g== X-Google-Smtp-Source: AGHT+IG2PgTfrA9fDxG5AFCjye4D/eNR++O8uKblDSkUEPhiI9NvdQPoqeIpBux/N7YL1fkTjZZbkg== X-Received: by 2002:a05:6820:1c85:b0:5ba:ccd2:2bb0 with SMTP id 006d021491bc7-5baccd22edamr2174161eaf.1.1717800469206; Fri, 07 Jun 2024 15:47:49 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:48 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 01/23] gobi: Remove phonebook and stk atom creation Date: Fri, 7 Jun 2024 17:47:01 -0500 Message-ID: <20240607224746.903769-1-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 These atoms do not exist in the current qmimodem driver. Remove them until they're added back in. --- plugins/gobi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index 7c105eef992a..147f572a799a 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -748,14 +748,6 @@ static void gobi_post_sim(struct ofono_modem *modem) ofono_lte_create(modem, 0, "qmimodem", data->device); - if (data->features & GOBI_CAT) - ofono_stk_create(modem, 0, "qmimodem", data->device); - else if (data->features & GOBI_CAT_OLD) - ofono_stk_create(modem, 1, "qmimodem", data->device); - - if (data->features & GOBI_PBM) - ofono_phonebook_create(modem, 0, "qmimodem", data->device); - if (data->features & GOBI_NAS) ofono_radio_settings_create(modem, 0, "qmimodem", data->device); From patchwork Fri Jun 7 22:47:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690698 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 493871CAB5 for ; Fri, 7 Jun 2024 22:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800472; cv=none; b=teiJjec54Y5TNUPeQwD0gUw8+tj1jA1d2Jjl68IFAr7r3xgPIB6Dj2wdqBECHuoLnN/zPjL/lIAFqobWlqJh8E3oWVvFxfzaDn6xGqKMqu5zjZsKURFYNTaStoecWKGGcuo7NUWVqbjhHlBSBuz8t5J/L4txKfSbqhXm/HWSpgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800472; c=relaxed/simple; bh=QBF+sciQyaGmQX8QMmhepIuCOAVjsoEDOP/io7RtMAM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j7FyuV8fREdPpsQ9VWlr1wOsUh4jV0RKBrKofz5SMWVrHqTwhB9QUd9IzeQU2aL6SfjTHfqEakCnfMtPNYyZ/3Sru+V6E+Uk3KLoYiS/gRqd/gk5T8muKbChzSfQ088u74qJ4N2ClQN02fpM0Ex808nPDxcgaSLXWcj3XcnCq1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lFbN8RgD; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lFbN8RgD" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5b970e90ab8so1537477eaf.3 for ; Fri, 07 Jun 2024 15:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800470; x=1718405270; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7tIEe+wwLE2x1wnF43/mr+uxIejVrRX6mo7zzHX7PxA=; b=lFbN8RgD82r+5rIDM9w8H6Md1YOT2gxJ2+6z59T72WjOtQwZLn8AP8OxP0GZKTOhQu y+owRZ1qTWSYAVu55dy81VmMmZ963cmekTmKiZGGZ+LumnHeHP0twDxceVN7nO671vkg 8fsg9tudK0iRVRoiHZpUKnTWtrmn4N3eJVBDeDQ1lIovvCHuRzp0OUJyJJV+onUSceKT k62ZZxZZCN45EfCMkJ6HqWGNm9CkDEzFGYYIifH6vcI8SQh4FDJaZGYb/g9gRqwP4lj8 8XNGz7TYrvDQOe0iU6XWD7xZs4Amkzgw8ROtO9LsyKNez83Z9sh8VmO81OtY8aaoc1rw 1z0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800470; x=1718405270; h=content-transfer-encoding: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=7tIEe+wwLE2x1wnF43/mr+uxIejVrRX6mo7zzHX7PxA=; b=JQ8Q1bWabuwG7CeWgT1CW9AQ78QGMLPlls1cWKPtOumXGkCtX2Uhv74ELi7hQ99Zqs 1vJqY8cIQVGqa7quVQAnwC1xCmK0etbZTB0t42Q8eI1x7nhJQbPwmL3ZLHQ8O6vq+bIX 575juRmgx58KRQAJdGhqcCGiEScS3o71SdF6eYmAs5HxBuf4fwJ0s+GoS3x1WNIcSOim I+uxhDrbPwtyEKIhuzq+EEb6GT8dSGnGGu1a3dDJ7qD7QyDGlWXLTerWv2PKgI+bW1U5 QiShWd/Dn0ASkSbYv6ZrKRu5jxakzoqx7sw1p3Yb/Xf0/7feMeLTisXsEnO8D28uK4EK 482g== X-Gm-Message-State: AOJu0YxyEYV7kY9SxzbOvi1wHp4tzbr+IPUzUZ5a4HgdTsAplS7qxiRY bb3GNRsJ6D+jBZZqFrwKCLg33sJTYJaQjTHQS0Dzg3aP6Nlu3A6fzulBkQ== X-Google-Smtp-Source: AGHT+IF3Fg8eH7rlqs44adW7fIEFI70cbviotW8o2rtlD/KCDidlxRwnY2a1U6McTwTUTHpnPayqag== X-Received: by 2002:a05:6820:1ad3:b0:5b7:3502:6543 with SMTP id 006d021491bc7-5baae780cfamr4649177eaf.7.1717800470031; Fri, 07 Jun 2024 15:47:50 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:49 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 02/23] qmi: lookup shared family directly by type Date: Fri, 7 Jun 2024 17:47:02 -0500 Message-ID: <20240607224746.903769-2-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since it is currently no longer possible to create dedicated clients for a given service type, use the service type as the key to the family_list hashtable. For QMUX, this allows the service family to be looked up directly instead of iterating over the entire hash table. The hash table entry at key=service_type will always point to the shared service family. --- drivers/qmimodem/qmi.c | 61 +++++++++--------------------------------- 1 file changed, 13 insertions(+), 48 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index dfcf46a6e35e..1b3fa34f685c 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -330,21 +330,6 @@ static bool __notify_compare(const void *data, const void *user_data) notify->service_handle == details->service_handle; } -struct service_find_by_type_data { - unsigned int type; - struct service_family *found_family; -}; - -static void __family_find_by_type(const void *key, void *value, - void *user_data) -{ - struct service_family *family = value; - struct service_find_by_type_data *data = user_data; - - if (family->info.service_type == data->type) - data->found_family = family; -} - static const char *__service_type_to_string(uint8_t type) { switch (type) { @@ -1403,7 +1388,6 @@ static struct service_family *service_family_ref(struct service_family *family) static void service_family_unref(struct service_family *family) { struct qmi_device *device; - unsigned int hash_id; if (--family->ref_count) return; @@ -1412,9 +1396,15 @@ static void service_family_unref(struct service_family *family) if (!device) goto done; - hash_id = family_list_create_hash(family->info.service_type, + if (family->client_id) { + unsigned int hash_id = + family_list_create_hash(family->info.service_type, family->client_id); - l_hashmap_remove(device->family_list, L_UINT_TO_PTR(hash_id)); + l_hashmap_remove(device->family_list, L_UINT_TO_PTR(hash_id)); + } + + l_hashmap_remove(device->family_list, + L_UINT_TO_PTR(family->info.service_type)); if (device->ops->client_release) device->ops->client_release(device, family->info.service_type, @@ -1799,7 +1789,6 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, struct qmi_device_qmux *qmux = l_container_of(device, struct qmi_device_qmux, super); struct service_family *family = NULL; - struct service_family *old_family = NULL; struct qmi_service_info info; const struct qmi_result_code *result_code; const struct qmi_client_id *client_id; @@ -1829,16 +1818,13 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, info.minor = data->minor; family = service_family_create(device, &info, client_id->client); - + family = service_family_ref(family); hash_id = family_list_create_hash(family->info.service_type, family->client_id); - l_hashmap_replace(device->family_list, L_UINT_TO_PTR(hash_id), - family, (void **) &old_family); - - if (old_family) - family_destroy(old_family); - - family = service_family_ref(family); + l_hashmap_insert(device->family_list, L_UINT_TO_PTR(hash_id), family); + l_hashmap_insert(device->family_list, + L_UINT_TO_PTR(family->info.service_type), + family); done: service_create_shared_pending_reply(qmux, data->type, family); if (family) @@ -2636,28 +2622,7 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, if (type == QMI_SERVICE_CONTROL) return false; - /* - * First check to see if the bare type is in the hashmap. If it is not - * the family might exist already, but have the client id included in - * the hash id. - */ family = l_hashmap_lookup(device->family_list, L_UINT_TO_PTR(type)); - - if (!family) { - struct service_find_by_type_data find_data; - - /* - * There is no way to find in an l_hashmap using a custom - * function. Instead we use a temporary struct to store the - * found service family. - */ - find_data.type = type; - find_data.found_family = NULL; - l_hashmap_foreach(device->family_list, __family_find_by_type, - &find_data); - family = find_data.found_family; - } - if (!family) { const struct qmi_service_info *info; From patchwork Fri Jun 7 22:47:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690700 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6244919D8B5 for ; Fri, 7 Jun 2024 22:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800474; cv=none; b=j85hJsaq0nij2hCLtx5ZXpjqsGmjpSyIBbKdsMNn43H0+zioVLrMtBJcQW0bfrT8C1bxweVzQhhCqSXawXdrA+hteAythR8l1Y1VzbwQPDhnZQVFDQlJZMvnox+rLaPulLqclmWbaE1Lr2LpvMjrpBtQ+5tcMaM40sfNnUUU8mc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800474; c=relaxed/simple; bh=v3NYrCIbc8O3gNo5zAII2decMYYYS0rNP05Ofuq3Hrk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hqDn6TYRcuwKXsMn514+KWbnnhidAsaFNDCU+GfTUikxPeAM+M/mPJeRpx5PKYnReTRniCFvH7rO90QrEDO9tU3kXNuS7KJ9NoFVavIY7sqVEgFg1h0FH+Kcp5Bt2sBnFQnhQ6BwkKL1CX8JuKBlMN9UIiw12kdby+9/lU2vfnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QwrVRkkX; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QwrVRkkX" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5ba74c25fb3so1450873eaf.0 for ; Fri, 07 Jun 2024 15:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800471; x=1718405271; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wz3oV2SPzU8qCiEWnTf29QXcGiJ7UaZ8jkvFO5aa0QU=; b=QwrVRkkXBCl+TTz/QAyuOiJnBMi6vUfHt8jME9Ecq/6BMuQ5EvzVTLKcfW0ILPH6vU mrfLCu79b89FiFhFkiGMLZMIp8/oBqVP+2YsqZIsDgIjmauoMHPIB+CuohDEklawSSCb nN+q8dcdRDk9aBGYsQdNA63sYBMOo2DeC9N4Gf3mNIr13O4gPIF+pJz3r22sgffofa+T cGqVbPzdjXrXpJRkuoVEYyTC/uVyQz8V5S/gcnPz6RUpidDtMH54olzflN9WkKrCG+Il LMUdHCgOy/J3Vipkph48UZd/GeMfZfKrCRcyiS/B6PkxywP/FbUZiE2e8Wro76IO4AaH sJFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800471; x=1718405271; h=content-transfer-encoding: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=Wz3oV2SPzU8qCiEWnTf29QXcGiJ7UaZ8jkvFO5aa0QU=; b=I33voSKPRjmvBGTOR/i/RyyPF0Dv7V/EwVxl7MvHzJJzlYIUZr5dfxuJvOTOIFsWX6 BGEQ0zYgBv2CIFcEZz3cjjdgcVjMXfZDvvFW0qfobZONNwEWiwbF2tdTzuDCH4XoSTeN NXTLy/vx0fj5XAeqkC2lMf1e7HGYU6EzybYh3o1ge+qwuzW6x25U8dgCc/bsxEnfZc+M 2RAe51MWKfy84cv+IY5t3H8xBNWC3X8ZW7kmcFw14B593DlFZxQcx4SNhqtHL2Ke4E6X 3AZdOUmqsTqRiiDAVm5YnTtPVk1yRnkWwOTW+nA7MYNmgHixQsRY7xd72EI2mXtm0Esc ARTw== X-Gm-Message-State: AOJu0YzfreHKaijLz0Ym2sSv7KaAn12O954vV5BknJJcPcjgjwBoEwtS vrS0QgmpP04Wj0zuDx716kwBUAo755FfWqBjBXYy5nlNmN4gG9ZA5ERaSw== X-Google-Smtp-Source: AGHT+IFjMklrrppcdqOQlahxSm6as5Zf6zsBDzmYOVnqpHi2GJfmH/1+MqC3c4ZPTQj7iw0UseP+mQ== X-Received: by 2002:a05:6820:1609:b0:5b2:f2e5:a8c8 with SMTP id 006d021491bc7-5baae8c3542mr5039928eaf.8.1717800470844; Fri, 07 Jun 2024 15:47:50 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:50 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 03/23] core: allow multiple args in atom constructors Date: Fri, 7 Jun 2024 17:47:03 -0500 Message-ID: <20240607224746.903769-3-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It would be useful to send multiple arguments to atom probe() functions without having to define / create an intermediate structure. To that end, add the ability to send multiple arguments to all atom constructors. To keep backwards compatibility, the probe() method is invoked with a single void * argument. --- include/audio-settings.h | 6 +++++- include/call-barring.h | 6 +++++- include/call-forwarding.h | 6 +++++- include/call-meter.h | 6 +++++- include/call-settings.h | 6 +++++- include/call-volume.h | 6 +++++- include/cbs.h | 5 ++++- include/ctm.h | 5 ++++- include/devinfo.h | 6 +++++- include/gnss.h | 6 +++++- include/gprs-context.h | 6 +++++- include/gprs.h | 6 +++++- include/handsfree.h | 6 +++++- include/ims.h | 5 ++++- include/location-reporting.h | 6 +++++- include/lte.h | 5 ++++- include/netmon.h | 6 +++++- include/netreg.h | 7 +++++-- include/phonebook.h | 6 +++++- include/radio-settings.h | 6 +++++- include/sim.h | 5 ++++- include/siri.h | 6 +++++- include/sms.h | 5 ++++- include/stk.h | 5 ++++- include/ussd.h | 6 +++++- include/voicecall.h | 6 +++++- src/ofono.h | 16 +++++++++++++--- 27 files changed, 136 insertions(+), 30 deletions(-) diff --git a/include/audio-settings.h b/include/audio-settings.h index 797f6e3780ec..452d7e73632d 100644 --- a/include/audio-settings.h +++ b/include/audio-settings.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_audio_settings; @@ -19,6 +21,8 @@ struct ofono_audio_settings; struct ofono_audio_settings_driver { int (*probe)(struct ofono_audio_settings *as, unsigned int vendor, void *data); + int (*probev)(struct ofono_audio_settings *as, + unsigned int vendor, va_list args); void (*remove)(struct ofono_audio_settings *as); }; @@ -30,7 +34,7 @@ void ofono_audio_settings_mode_notify(struct ofono_audio_settings *as, struct ofono_audio_settings *ofono_audio_settings_create( struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_audio_settings_register(struct ofono_audio_settings *as); void ofono_audio_settings_remove(struct ofono_audio_settings *as); diff --git a/include/call-barring.h b/include/call-barring.h index 05df4270543b..99e2764e64da 100644 --- a/include/call-barring.h +++ b/include/call-barring.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_call_barring; @@ -24,6 +26,8 @@ typedef void (*ofono_call_barring_query_cb_t)(const struct ofono_error *error, struct ofono_call_barring_driver { int (*probe)(struct ofono_call_barring *cb, unsigned int vendor, void *data); + int (*probev)(struct ofono_call_barring *cb, unsigned int vendor, + va_list args); void (*remove)(struct ofono_call_barring *cb); void (*set)(struct ofono_call_barring *barr, const char *lock, int enable, const char *passwd, int cls, @@ -38,7 +42,7 @@ struct ofono_call_barring_driver { struct ofono_call_barring *ofono_call_barring_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data); + ...); void ofono_call_barring_register(struct ofono_call_barring *cb); void ofono_call_barring_remove(struct ofono_call_barring *cb); diff --git a/include/call-forwarding.h b/include/call-forwarding.h index b4ad0a206788..2eb2f1817b8d 100644 --- a/include/call-forwarding.h +++ b/include/call-forwarding.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_call_forwarding; @@ -34,6 +36,8 @@ typedef void (*ofono_call_forwarding_query_cb_t)( struct ofono_call_forwarding_driver { int (*probe)(struct ofono_call_forwarding *cf, unsigned int vendor, void *data); + int (*probev)(struct ofono_call_forwarding *cf, unsigned int vendor, + va_list args); void (*remove)(struct ofono_call_forwarding *cf); void (*activation)(struct ofono_call_forwarding *cf, int type, int cls, @@ -56,7 +60,7 @@ struct ofono_call_forwarding_driver { struct ofono_call_forwarding *ofono_call_forwarding_create( struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_call_forwarding_register(struct ofono_call_forwarding *cf); void ofono_call_forwarding_remove(struct ofono_call_forwarding *cf); diff --git a/include/call-meter.h b/include/call-meter.h index feaef17ed5f1..9a00104a2ede 100644 --- a/include/call-meter.h +++ b/include/call-meter.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_call_meter; @@ -30,6 +32,8 @@ typedef void(*ofono_call_meter_set_cb_t)(const struct ofono_error *error, struct ofono_call_meter_driver { int (*probe)(struct ofono_call_meter *cm, unsigned int vendor, void *data); + int (*probev)(struct ofono_call_meter *cm, unsigned int vendor, + va_list args); void (*remove)(struct ofono_call_meter *cm); void (*call_meter_query)(struct ofono_call_meter *cm, ofono_call_meter_query_cb_t cb, void *data); @@ -52,7 +56,7 @@ struct ofono_call_meter_driver { struct ofono_call_meter *ofono_call_meter_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data); + ...); void ofono_call_meter_register(struct ofono_call_meter *cm); void ofono_call_meter_remove(struct ofono_call_meter *cm); diff --git a/include/call-settings.h b/include/call-settings.h index 854cc96afa97..ced1047fd3d2 100644 --- a/include/call-settings.h +++ b/include/call-settings.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_call_settings; @@ -28,6 +30,8 @@ typedef void (*ofono_call_settings_clir_cb_t)(const struct ofono_error *error, struct ofono_call_settings_driver { int (*probe)(struct ofono_call_settings *cs, unsigned int vendor, void *data); + int (*probev)(struct ofono_call_settings *cs, unsigned int vendor, + va_list args); void (*remove)(struct ofono_call_settings *cs); void (*clip_query)(struct ofono_call_settings *cs, ofono_call_settings_status_cb_t cb, void *data); @@ -52,7 +56,7 @@ struct ofono_call_settings_driver { struct ofono_call_settings *ofono_call_settings_create( struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_call_settings_register(struct ofono_call_settings *cs); void ofono_call_settings_remove(struct ofono_call_settings *cs); diff --git a/include/call-volume.h b/include/call-volume.h index bf3606353cff..90629b25cc1f 100644 --- a/include/call-volume.h +++ b/include/call-volume.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include #include @@ -23,6 +25,8 @@ typedef void (*ofono_call_volume_cb_t)(const struct ofono_error *error, struct ofono_call_volume_driver { int (*probe)(struct ofono_call_volume *cv, unsigned int vendor, void *data); + int (*probev)(struct ofono_call_volume *cv, unsigned int vendor, + va_list args); void (*remove)(struct ofono_call_volume *cv); void (*speaker_volume)(struct ofono_call_volume *cv, unsigned char percent, @@ -41,7 +45,7 @@ void ofono_call_volume_set_microphone_volume(struct ofono_call_volume *cv, void ofono_call_volume_set_muted(struct ofono_call_volume *cv, int muted); struct ofono_call_volume *ofono_call_volume_create(struct ofono_modem *modem, - unsigned int vendor, const char *driver, void *data); + unsigned int vendor, const char *driver, ...); void ofono_call_volume_register(struct ofono_call_volume *cv); void ofono_call_volume_remove(struct ofono_call_volume *cv); diff --git a/include/cbs.h b/include/cbs.h index 7ec4b60afeda..9d3367b7b24f 100644 --- a/include/cbs.h +++ b/include/cbs.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_cbs; @@ -21,6 +23,7 @@ typedef void (*ofono_cbs_set_cb_t)(const struct ofono_error *error, struct ofono_cbs_driver { int (*probe)(struct ofono_cbs *cbs, unsigned int vendor, void *data); + int (*probev)(struct ofono_cbs *cbs, unsigned int vendor, va_list args); void (*remove)(struct ofono_cbs *cbs); void (*set_topics)(struct ofono_cbs *cbs, const char *topics, ofono_cbs_set_cb_t cb, void *data); @@ -32,7 +35,7 @@ void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned char *pdu, int len); struct ofono_cbs *ofono_cbs_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_cbs_register(struct ofono_cbs *cbs); void ofono_cbs_remove(struct ofono_cbs *cbs); diff --git a/include/ctm.h b/include/ctm.h index 5d600a500f9e..315fa5d562f3 100644 --- a/include/ctm.h +++ b/include/ctm.h @@ -13,6 +13,8 @@ extern "C" { #endif +#include + #include struct ofono_ctm; @@ -24,6 +26,7 @@ typedef void (*ofono_ctm_query_cb_t)(const struct ofono_error *error, struct ofono_ctm_driver { int (*probe)(struct ofono_ctm *ctm, unsigned int vendor, void *data); + int (*probev)(struct ofono_ctm *ctm, unsigned int vendor, va_list args); void (*remove)(struct ofono_ctm *ctm); void (*query_tty)(struct ofono_ctm *ctm, ofono_ctm_query_cb_t cb, void *data); @@ -33,7 +36,7 @@ struct ofono_ctm_driver { struct ofono_ctm *ofono_ctm_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_ctm_register(struct ofono_ctm *ctm); void ofono_ctm_remove(struct ofono_ctm *ctm); diff --git a/include/devinfo.h b/include/devinfo.h index 59a1bd21ecdb..ac553e959443 100644 --- a/include/devinfo.h +++ b/include/devinfo.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_devinfo; @@ -22,6 +24,8 @@ typedef void (*ofono_devinfo_query_cb_t)(const struct ofono_error *error, struct ofono_devinfo_driver { int (*probe)(struct ofono_devinfo *info, unsigned int vendor, void *data); + int (*probev)(struct ofono_devinfo *info, unsigned int vendor, + va_list args); void (*remove)(struct ofono_devinfo *info); void (*query_manufacturer)(struct ofono_devinfo *info, ofono_devinfo_query_cb_t cb, void *data); @@ -38,7 +42,7 @@ struct ofono_devinfo_driver { struct ofono_devinfo *ofono_devinfo_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data); + ...); void ofono_devinfo_register(struct ofono_devinfo *info); void ofono_devinfo_remove(struct ofono_devinfo *info); diff --git a/include/gnss.h b/include/gnss.h index 700fc2737a6d..dd1b79246f72 100644 --- a/include/gnss.h +++ b/include/gnss.h @@ -13,6 +13,8 @@ extern "C" { #endif +#include + #include struct ofono_gnss; @@ -21,6 +23,8 @@ typedef void (*ofono_gnss_cb_t)(const struct ofono_error *error, void *data); struct ofono_gnss_driver { int (*probe)(struct ofono_gnss *gnss, unsigned int vendor, void *data); + int (*probev)(struct ofono_gnss *gnss, unsigned int vendor, + va_list args); void (*remove)(struct ofono_gnss *gnss); void (*send_element)(struct ofono_gnss *gnss, const char *xml, @@ -36,7 +40,7 @@ void ofono_gnss_notify_posr_reset(struct ofono_gnss *gnss); struct ofono_gnss *ofono_gnss_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_gnss_register(struct ofono_gnss *gnss); void ofono_gnss_remove(struct ofono_gnss *gnss); diff --git a/include/gprs-context.h b/include/gprs-context.h index dab00191d3f6..2bc9dd166787 100644 --- a/include/gprs-context.h +++ b/include/gprs-context.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_gprs_context; @@ -42,6 +44,8 @@ typedef void (*ofono_gprs_context_cb_t)(const struct ofono_error *error, struct ofono_gprs_context_driver { int (*probe)(struct ofono_gprs_context *gc, unsigned int vendor, void *data); + int (*probev)(struct ofono_gprs_context *gc, unsigned int vendor, + va_list args); void (*remove)(struct ofono_gprs_context *gc); void (*activate_primary)(struct ofono_gprs_context *gc, const struct ofono_gprs_primary_context *ctx, @@ -61,7 +65,7 @@ void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc, struct ofono_gprs_context *ofono_gprs_context_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_gprs_context_remove(struct ofono_gprs_context *gc); void ofono_gprs_context_set_data(struct ofono_gprs_context *gc, void *data); diff --git a/include/gprs.h b/include/gprs.h index f4706c5cdbd7..62bf05baf30b 100644 --- a/include/gprs.h +++ b/include/gprs.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_gprs; @@ -25,6 +27,8 @@ typedef void (*ofono_gprs_cb_t)(const struct ofono_error *error, void *data); struct ofono_gprs_driver { int (*probe)(struct ofono_gprs *gprs, unsigned int vendor, void *data); + int (*probev)(struct ofono_gprs *gprs, unsigned int vendor, + va_list args); void (*remove)(struct ofono_gprs *gprs); void (*set_attached)(struct ofono_gprs *gprs, int attached, ofono_gprs_cb_t cb, void *data); @@ -52,7 +56,7 @@ struct ofono_modem *ofono_gprs_get_modem(struct ofono_gprs *gprs); struct ofono_gprs *ofono_gprs_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data); + ...); void ofono_gprs_register(struct ofono_gprs *gprs); void ofono_gprs_remove(struct ofono_gprs *gprs); diff --git a/include/handsfree.h b/include/handsfree.h index 326d79c33c9e..43fe572693f6 100644 --- a/include/handsfree.h +++ b/include/handsfree.h @@ -13,6 +13,8 @@ extern "C" { #endif +#include + #include struct ofono_handsfree; @@ -30,6 +32,8 @@ typedef void (*ofono_handsfree_cnum_query_cb_t)(const struct ofono_error *error, struct ofono_handsfree_driver { int (*probe)(struct ofono_handsfree *hf, unsigned int vendor, void *data); + int (*probev)(struct ofono_handsfree *hf, unsigned int vendor, + va_list args); void (*remove)(struct ofono_handsfree *hf); void (*cnum_query)(struct ofono_handsfree *hf, ofono_handsfree_cnum_query_cb_t cb, void *data); @@ -66,7 +70,7 @@ void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf, unsigned char level); struct ofono_handsfree *ofono_handsfree_create(struct ofono_modem *modem, - unsigned int vendor, const char *driver, void *data); + unsigned int vendor, const char *driver, ...); void ofono_handsfree_register(struct ofono_handsfree *hf); void ofono_handsfree_remove(struct ofono_handsfree *hf); diff --git a/include/ims.h b/include/ims.h index 737532b17500..c394d5160c26 100644 --- a/include/ims.h +++ b/include/ims.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_ims; @@ -24,6 +26,7 @@ typedef void (*ofono_ims_status_cb_t)(const struct ofono_error *error, struct ofono_ims_driver { int (*probe)(struct ofono_ims *ims, unsigned int vendor, void *data); + int (*probev)(struct ofono_ims *ims, unsigned int vendor, va_list args); void (*remove)(struct ofono_ims *ims); void (*ims_register)(struct ofono_ims *ims, ofono_ims_register_cb_t cb, void *data); @@ -38,7 +41,7 @@ void ofono_ims_status_notify(struct ofono_ims *ims, int reg_info, struct ofono_ims *ofono_ims_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_ims_register(struct ofono_ims *ims); void ofono_ims_remove(struct ofono_ims *ims); diff --git a/include/location-reporting.h b/include/location-reporting.h index 38003a950005..7faf0ba3c485 100644 --- a/include/location-reporting.h +++ b/include/location-reporting.h @@ -13,6 +13,8 @@ extern "C" { #endif +#include + #include struct ofono_location_reporting; @@ -32,6 +34,8 @@ struct ofono_location_reporting_driver { enum ofono_location_reporting_type type; int (*probe)(struct ofono_location_reporting *lr, unsigned int vendor, void *data); + int (*probev)(struct ofono_location_reporting *lr, unsigned int vendor, + va_list args); void (*remove)(struct ofono_location_reporting *lr); void (*enable)(struct ofono_location_reporting *lr, ofono_location_reporting_enable_cb_t cb, void *data); @@ -42,7 +46,7 @@ struct ofono_location_reporting_driver { struct ofono_location_reporting *ofono_location_reporting_create( struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_location_reporting_register(struct ofono_location_reporting *lr); void ofono_location_reporting_remove(struct ofono_location_reporting *lr); diff --git a/include/lte.h b/include/lte.h index 378b8faf5d43..3f8dbd535e69 100644 --- a/include/lte.h +++ b/include/lte.h @@ -13,6 +13,8 @@ extern "C" { #endif +#include + #include struct ofono_lte; @@ -29,6 +31,7 @@ typedef void (*ofono_lte_cb_t)(const struct ofono_error *error, void *data); struct ofono_lte_driver { int (*probe)(struct ofono_lte *lte, unsigned int vendor, void *data); + int (*probev)(struct ofono_lte *lte, unsigned int vendor, va_list args); void (*remove)(struct ofono_lte *lte); void (*set_default_attach_info)(const struct ofono_lte *lte, const struct ofono_lte_default_attach_info *info, @@ -37,7 +40,7 @@ struct ofono_lte_driver { struct ofono_lte *ofono_lte_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_lte_register(struct ofono_lte *lte); diff --git a/include/netmon.h b/include/netmon.h index 85d25706f06a..d1eef952314e 100644 --- a/include/netmon.h +++ b/include/netmon.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_netmon; @@ -21,6 +23,8 @@ typedef void (*ofono_netmon_cb_t)(const struct ofono_error *error, void *data); struct ofono_netmon_driver { int (*probe)(struct ofono_netmon *netmon, unsigned int vendor, void *data); + int (*probev)(struct ofono_netmon *netmon, unsigned int vendor, + va_list args); void (*remove)(struct ofono_netmon *netmon); void (*request_update)(struct ofono_netmon *netmon, ofono_netmon_cb_t cb, void *data); @@ -80,7 +84,7 @@ void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon, struct ofono_netmon *ofono_netmon_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_netmon_register(struct ofono_netmon *netmon); diff --git a/include/netreg.h b/include/netreg.h index e70283bf6bd5..48a13e161fea 100644 --- a/include/netreg.h +++ b/include/netreg.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_netreg; @@ -57,6 +59,8 @@ typedef void (*ofono_netreg_strength_cb_t)(const struct ofono_error *error, struct ofono_netreg_driver { int (*probe)(struct ofono_netreg *netreg, unsigned int vendor, void *data); + int (*probev)(struct ofono_netreg *netreg, unsigned int vendor, + va_list args); void (*remove)(struct ofono_netreg *netreg); void (*registration_status)(struct ofono_netreg *netreg, ofono_netreg_status_cb_t cb, void *data); @@ -81,8 +85,7 @@ void ofono_netreg_time_notify(struct ofono_netreg *netreg, struct ofono_netreg *ofono_netreg_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, - void *data); + const char *driver, ...); void ofono_netreg_register(struct ofono_netreg *netreg); void ofono_netreg_remove(struct ofono_netreg *netreg); diff --git a/include/phonebook.h b/include/phonebook.h index 2944e3a0d836..2c895fa9cf13 100644 --- a/include/phonebook.h +++ b/include/phonebook.h @@ -26,6 +26,8 @@ extern "C" { #endif +#include + #include struct ofono_phonebook; @@ -39,6 +41,8 @@ typedef void (*ofono_phonebook_cb_t)(const struct ofono_error *error, struct ofono_phonebook_driver { int (*probe)(struct ofono_phonebook *pb, unsigned int vendor, void *data); + int (*probev)(struct ofono_phonebook *pb, unsigned int vendor, + va_list args); void (*remove)(struct ofono_phonebook *pb); void (*export_entries)(struct ofono_phonebook *pb, const char *storage, ofono_phonebook_cb_t cb, void *data); @@ -55,7 +59,7 @@ void ofono_phonebook_entry(struct ofono_phonebook *pb, int index, struct ofono_phonebook *ofono_phonebook_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data); + ...); void ofono_phonebook_register(struct ofono_phonebook *pb); void ofono_phonebook_remove(struct ofono_phonebook *pb); diff --git a/include/radio-settings.h b/include/radio-settings.h index c424d374bb57..7dcccf81d226 100644 --- a/include/radio-settings.h +++ b/include/radio-settings.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include enum ofono_radio_access_mode { @@ -73,6 +75,8 @@ typedef void (*ofono_radio_settings_available_rats_query_cb_t)( struct ofono_radio_settings_driver { int (*probe)(struct ofono_radio_settings *rs, unsigned int vendor, void *data); + int (*probev)(struct ofono_radio_settings *rs, unsigned int vendor, + va_list args); void (*remove)(struct ofono_radio_settings *rs); void (*query_rat_mode)(struct ofono_radio_settings *rs, ofono_radio_settings_rat_mode_query_cb_t cb, @@ -103,7 +107,7 @@ struct ofono_radio_settings_driver { struct ofono_radio_settings *ofono_radio_settings_create( struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_radio_settings_register(struct ofono_radio_settings *rs); void ofono_radio_settings_remove(struct ofono_radio_settings *rs); diff --git a/include/sim.h b/include/sim.h index 326a6fe09709..c362cc0ecb62 100644 --- a/include/sim.h +++ b/include/sim.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_sim; @@ -124,6 +126,7 @@ typedef void (*ofono_sim_set_active_card_slot_cb_t)( struct ofono_sim_driver { int (*probe)(struct ofono_sim *sim, unsigned int vendor, void *data); + int (*probev)(struct ofono_sim *sim, unsigned int vendor, va_list args); void (*remove)(struct ofono_sim *sim); void (*read_file_info)(struct ofono_sim *sim, int fileid, const unsigned char *path, unsigned int path_len, @@ -200,7 +203,7 @@ struct ofono_sim_driver { struct ofono_sim *ofono_sim_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_sim_register(struct ofono_sim *sim); void ofono_sim_remove(struct ofono_sim *sim); diff --git a/include/siri.h b/include/siri.h index be09c49236a4..0a9702b2037a 100644 --- a/include/siri.h +++ b/include/siri.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_siri; @@ -21,6 +23,8 @@ typedef void (*ofono_siri_cb_t)(const struct ofono_error *error, struct ofono_siri_driver { int (*probe)(struct ofono_siri *siri, unsigned int vendor, void *data); + int (*probev)(struct ofono_siri *siri, unsigned int vendor, + va_list args); void (*remove)(struct ofono_siri *siri); void (*set_eyes_free_mode) (struct ofono_siri *siri, ofono_siri_cb_t cb, unsigned int val); @@ -30,7 +34,7 @@ void ofono_siri_set_status(struct ofono_siri *siri, int value); struct ofono_siri *ofono_siri_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_siri_register(struct ofono_siri *siri); void ofono_siri_remove(struct ofono_siri *siri); diff --git a/include/sms.h b/include/sms.h index 21ac6a3a3d35..d843ae6ae122 100644 --- a/include/sms.h +++ b/include/sms.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_sms; @@ -30,6 +32,7 @@ typedef void (*ofono_sms_bearer_query_cb_t)(const struct ofono_error *error, struct ofono_sms_driver { int (*probe)(struct ofono_sms *sms, unsigned int vendor, void *data); + int (*probev)(struct ofono_sms *sms, unsigned int vendor, va_list args); void (*remove)(struct ofono_sms *sms); void (*sca_query)(struct ofono_sms *sms, ofono_sms_sca_query_cb_t cb, void *data); @@ -52,7 +55,7 @@ void ofono_sms_status_notify(struct ofono_sms *sms, const unsigned char *pdu, struct ofono_sms *ofono_sms_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_sms_register(struct ofono_sms *sms); void ofono_sms_remove(struct ofono_sms *sms); diff --git a/include/stk.h b/include/stk.h index 93311d564223..8575b2819b4a 100644 --- a/include/stk.h +++ b/include/stk.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_stk; @@ -25,6 +27,7 @@ typedef void (*ofono_stk_generic_cb_t)(const struct ofono_error *error, struct ofono_stk_driver { int (*probe)(struct ofono_stk *stk, unsigned int vendor, void *data); + int (*probev)(struct ofono_stk *stk, unsigned int vendor, va_list args); void (*remove)(struct ofono_stk *stk); void (*envelope)(struct ofono_stk *stk, int length, const unsigned char *command, @@ -37,7 +40,7 @@ struct ofono_stk_driver { struct ofono_stk *ofono_stk_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_stk_register(struct ofono_stk *stk); void ofono_stk_remove(struct ofono_stk *stk); diff --git a/include/ussd.h b/include/ussd.h index 0b4895a82d52..04a91e8483b7 100644 --- a/include/ussd.h +++ b/include/ussd.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include /* 3GPP TS 27.007 section 7.15, values for */ @@ -30,6 +32,8 @@ typedef void (*ofono_ussd_cb_t)(const struct ofono_error *error, void *data); struct ofono_ussd_driver { int (*probe)(struct ofono_ussd *ussd, unsigned int vendor, void *data); + int (*probev)(struct ofono_ussd *ussd, unsigned int vendor, + va_list args); void (*remove)(struct ofono_ussd *ussd); void (*request)(struct ofono_ussd *ussd, int dcs, const unsigned char *pdu, int len, @@ -43,7 +47,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, struct ofono_ussd *ofono_ussd_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_ussd_register(struct ofono_ussd *ussd); void ofono_ussd_remove(struct ofono_ussd *ussd); diff --git a/include/voicecall.h b/include/voicecall.h index 50480b5ee015..345e52b15a0e 100644 --- a/include/voicecall.h +++ b/include/voicecall.h @@ -12,6 +12,8 @@ extern "C" { #endif +#include + #include struct ofono_modem; @@ -29,6 +31,8 @@ typedef void (*ofono_voicecall_cb_t)(const struct ofono_error *error, struct ofono_voicecall_driver { int (*probe)(struct ofono_voicecall *vc, unsigned int vendor, void *data); + int (*probev)(struct ofono_voicecall *vc, unsigned int vendor, + va_list args); void (*remove)(struct ofono_voicecall *vc); /* According to 22.030 the dial is expected to do the following: @@ -149,7 +153,7 @@ struct ofono_modem *ofono_voicecall_get_modem(struct ofono_voicecall *vc); struct ofono_voicecall *ofono_voicecall_create(struct ofono_modem *modem, unsigned int vendor, - const char *driver, void *data); + const char *driver, ...); void ofono_voicecall_register(struct ofono_voicecall *vc); void ofono_voicecall_remove(struct ofono_voicecall *vc); diff --git a/src/ofono.h b/src/ofono.h index cb4eae81db1a..c6fa16f2dc01 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -5,6 +5,7 @@ * SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include @@ -231,15 +232,17 @@ extern struct ofono_driver_desc __stop___ ## type[]; \ struct ofono_ ## type *ofono_ ## type ##_create( \ struct ofono_modem *modem, \ unsigned int vendor, const char *driver,\ - void *data) \ + ...) \ { \ const struct ofono_ ## type ## _driver *drv = \ __ofono_driver_builtin_find(driver, \ __start___ ## type, \ __stop___ ## type); \ + va_list args; \ struct ofono_ ## type *atom; \ + int r; \ \ - if (!drv || !drv->probe) \ + if (!drv || (!drv->probe && !drv->probev)) \ return NULL; \ \ atom = g_new0(struct ofono_ ##type, 1); \ @@ -247,7 +250,14 @@ struct ofono_ ## type *ofono_ ## type ##_create( \ type ##_remove, atom); \ __VA_ARGS__ \ \ - if (drv->probe(atom, vendor, data) < 0) { \ + va_start(args, driver); \ + if (drv->probev) \ + r = drv->probev(atom, vendor, args); \ + else \ + r = drv->probe(atom, vendor, va_arg(args, void *)); \ + va_end(args); \ + \ + if (r < 0) { \ ofono_ ## type ##_remove(atom); \ return NULL; \ } \ From patchwork Fri Jun 7 22:47:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690699 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8830C12FF6A for ; Fri, 7 Jun 2024 22:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800473; cv=none; b=oJ5mgvbEUfL4GXXAboqSptmHktmAYqRGJXaisv9lc/6wm8WOUej6/KvLok2FX/rFw4Rj49u135uOg8xuHj+7mfG0hqbqFaZ+o0wxAnXugX+GOXG9SK/3aDH4UjBWRU6qo15/6fz4TuVBweKwVi91APCz7spEVZUhZVe+cBqdnU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800473; c=relaxed/simple; bh=oenWwScYhH6lxXUYh72CYQlds6Qy0EszKgFxHy7c5uc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uMW18dKnO7jwZBiJtGKVyGRDhSHU86S/i5bFnd+JVNWKEXSc73YNNuG0rjTb2XUjBXeC+9yO46RVrVQNGl7bRdI/4Enl1UO60ZEjRVrQF4qhB8srVdHWp/YxVsm1s5IqrQ6A4r7GQsXqJF1mH26NvpJ95T7md0veDLYELj3jLVM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EsnsnGoD; arc=none smtp.client-ip=209.85.161.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EsnsnGoD" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5ba74c25fb3so1450877eaf.0 for ; Fri, 07 Jun 2024 15:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800471; x=1718405271; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y8iTzLM1WfsArapDmALWmBs5nYg7z9haFIa9C4W82QQ=; b=EsnsnGoDLWIMGTkDslhXD7zaiLQ7O11xNhfCx+pHENGDB4DgvG+ziBnRIhwXi5e8/C oONdg2vf26qhYSwIEs3nR65TDQdWtbhIESLe0+w3SK4eJhTUlPvFXfhXT4qr4QPi0j1k Ew8YFy136RVsvgMHTF7qvjTDPQeW+GaAtIyybK8AFID60M969UVswYzm1UCG2fnafRHV hBc9yV2BNTvWL7e207T0BTTFCMlb/s/Nk06FWKU/amg0g/OnHu5cJJoK5FH4GSxJ6+jl oZzvPAbuz5oM6Gux66AUGFgFR0Jw8Dn8lETKQWejVpxzHS7axCjIVcQRAuBrzMadF9aJ Pr2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800471; x=1718405271; h=content-transfer-encoding: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=y8iTzLM1WfsArapDmALWmBs5nYg7z9haFIa9C4W82QQ=; b=gq4TLUm6BY8nyFGpCapCqlQwu3UoSmVn9vc5DlTlQeOGgEmriQKKU54mvIyl7iyQRA zbt6PgKInfCIS9aR+mrNXC+Ym3V51yoVDAUcX5h50FBPq4YPwKRiIryVSDvESNt1H9Sb ZLDl1AAM5Fvx+hjXbH6lAqZneYr8/YnFt7JtlvsuG38ya6IeUgQ2yb0fYjV9QtPbHwEQ pPsR6Sh1U823R6wybKhIT/WEtKCZWTI02SE9wG79Z2Pe/PZpLIxNbbob3RD9jw9jUknT zVp5eHP0WkVfOklH4+ZQSkNgDi2L2O0sxgT+7LMMFEzHgjNQAyzKjOAConpm/8skrA84 eXyA== X-Gm-Message-State: AOJu0Yx8U7QZyqzqOXTCZkh00Cs+FxBWJ+vUncYEhucSdbLaYco5npnM t7yIFbi+Hd+aaGxJHaaWlF8nGJibGw1u3uwA5+Dwifh60Ur9Gg5zwmA//A== X-Google-Smtp-Source: AGHT+IGI7tY9t6G18rofcOFvLfOWr0q/Lx1eUVhEevaeEDqsiV6Ei34XLS5nnhjvgFZA1hDGgZ9whA== X-Received: by 2002:a05:6820:1ad3:b0:5b7:3502:6543 with SMTP id 006d021491bc7-5baae780cfamr4649225eaf.7.1717800471416; Fri, 07 Jun 2024 15:47:51 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:51 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 04/23] unit: Update unit tests to the new API Date: Fri, 7 Jun 2024 17:47:04 -0500 Message-ID: <20240607224746.903769-4-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- unit/test-rilmodem-cb.c | 9 +++++++-- unit/test-rilmodem-cs.c | 9 +++++++-- unit/test-rilmodem-sms.c | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/unit/test-rilmodem-cb.c b/unit/test-rilmodem-cb.c index 75e7e02076f6..984ea4efc64e 100644 --- a/unit/test-rilmodem-cb.c +++ b/unit/test-rilmodem-cb.c @@ -407,11 +407,16 @@ extern struct ofono_driver_desc __start___call_barring[]; struct ofono_call_barring *ofono_call_barring_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data) + ...) { - struct rilmodem_cb_data *rsd = data; + struct rilmodem_cb_data *rsd; struct ofono_call_barring *cb = g_new0(struct ofono_call_barring, 1); int retval; + va_list args; + + va_start(args, driver); + rsd = va_arg(args, void *); + va_end(args); cbdriver = __start___call_barring[0].driver; diff --git a/unit/test-rilmodem-cs.c b/unit/test-rilmodem-cs.c index 414ded61022e..8c65fb1f6bb4 100644 --- a/unit/test-rilmodem-cs.c +++ b/unit/test-rilmodem-cs.c @@ -383,11 +383,16 @@ extern struct ofono_driver_desc __start___call_settings[]; struct ofono_call_settings *ofono_call_settings_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data) + ...) { - struct rilmodem_cs_data *rcd = data; + struct rilmodem_cs_data *rcd; struct ofono_call_settings *cs = g_new0(struct ofono_call_settings, 1); int retval; + va_list args; + + va_start(args, driver); + rcd = va_arg(args, void *); + va_end(args); csdriver = __start___call_settings[0].driver; diff --git a/unit/test-rilmodem-sms.c b/unit/test-rilmodem-sms.c index 347922c309b6..8d85d23ce92a 100644 --- a/unit/test-rilmodem-sms.c +++ b/unit/test-rilmodem-sms.c @@ -414,11 +414,16 @@ extern struct ofono_driver_desc __start___sms[]; struct ofono_sms *ofono_sms_create(struct ofono_modem *modem, unsigned int vendor, const char *driver, - void *data) + ...) { - struct rilmodem_sms_data *rsd = data; + struct rilmodem_sms_data *rsd; struct ofono_sms *sms = g_new0(struct ofono_sms, 1); int retval; + va_list args; + + va_start(args, driver); + rsd = va_arg(args, void *); + va_end(args); smsdriver = __start___sms[0].driver; From patchwork Fri Jun 7 22:47:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690702 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A367215572D for ; Fri, 7 Jun 2024 22:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800475; cv=none; b=eDYjeCzfoXrDQovxR73+tB5VQa/2bKmAEAWSSuZRx7Wqb8Tz10zNlxtEACRhfHHVCdDy/+0P8p85oblSeYtcjnHO1wU8KUJ6eWO4dOIBDtwROdibUHRlNM6hVoS4gyWA3vI1vnejrlI7esMPcERjEoYOoWxD+gNsmnvggMemmik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800475; c=relaxed/simple; bh=q0KuagSasHgfO/XncaDRh/6BzWr6ELAnEle7dOCmhfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TF1ftaD+CSDGA+tpRVeWRdPCRqvzNRBGrO9d8SxVr9TdE9VksObsz+j4ugGvgQ0aYnmDf80j944tmyC6NlYYUQuL8eMPZCuw5KEN0UbF9lQ7HxOv1cuKmWb0jjabvLz2qQKNgp56mu0XyinVzJzT82uOSGTKwg0fh+V8yXV4fy8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZgeaRyl5; arc=none smtp.client-ip=209.85.161.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZgeaRyl5" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5b3241373adso1450053eaf.2 for ; Fri, 07 Jun 2024 15:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800472; x=1718405272; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MOOBg6Gsufpva0ieml7234FnSDXP7734brFuiYW5AHw=; b=ZgeaRyl5T7FZ5q79e5h59fp2SiZXsztkCBPoELDwKh40U37vBOQXb2KGZSP2hEiIdM xHWyr+P3ZxT6pPBdZk/2FLMmjjM8HRANxB5fZ5EIAa+yNRmMu1UWJTxgX8j8u61QbpDc 0biCZuv4bAlOz6bB5jEGXwKWEXhyf7ErUpHnASS3ZLyNj45HdF3V9uvK/dKpedtB6W9t 4Bg/NZA523Kp1O3nmskYeRoTCun1WY1r0eWhFSO/Q7m2m7+SlD/T7vIH4P+42+/IrJWa grtT5mZTVsY1n5SQfJ2MmgXtWotmA0May9VF/gQ2fSeNxM35w9z5NFcPquPpQNnzOTXn sZiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800472; x=1718405272; h=content-transfer-encoding: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=MOOBg6Gsufpva0ieml7234FnSDXP7734brFuiYW5AHw=; b=X6JRW60KlAhskKZCdBcUs/U1ptgVZfm2KsdTfzhJKSlTPqqrfD6alLrUK8TkWKPfO1 7dfV5TdKopc7+OJySXTgkT/iS0xlB8egcfhXAenim8GXZcku7ilFYH7VJdJ26OM/kDcB gUPZJG6/6ybfdn6JuwW3+cuRNQgmEyhvWZDqLYwB209gSTmfUJl1WxeMNQfE5QleL5sM xcqYiVu4JvD+qy53kuCgqMKPk4snJgggk9lSIfmhcctsMkEbZHTM34LIgly7hmPDo8v9 vgilQL+f5FGIWEyd+lzEeqv4gs1Q1VPRVF8cKVgXK7kt8/Ubuaj3kUvapuTASz6cFIiz cycA== X-Gm-Message-State: AOJu0YxW26Qvw4ScPKd2hRW21YHGycIJzblfHhhBB40/DMSd7sB6F/FR dCqxQs3kXfQ3/JphMUjLuFFEx633D+rjFNEYIu15DoMvChgDmD/U/u7AYg== X-Google-Smtp-Source: AGHT+IEAYbWFNr7gnDhiyrM+XqqWkJ68pAYsD6XI8cwShJM5IxvZ20oO3RjsREG/rGMIZgv0RUNfOA== X-Received: by 2002:a05:6820:2290:b0:5b7:1979:ec49 with SMTP id 006d021491bc7-5baae242e65mr4130199eaf.0.1717800472208; Fri, 07 Jun 2024 15:47:52 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:51 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 05/23] core: Support register on probe flag Date: Fri, 7 Jun 2024 17:47:05 -0500 Message-ID: <20240607224746.903769-5-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some atom drivers have no meaningful initialization to perform after probe but prior to calling ofono_foo_atom_register(). Such atom drivers are forced to use l_idle or g_timeout_add in order to invoke ofono_foo_atom_register() outside of the probe() method. Make this easier by introducing a flag that will tell the core to call ofono_foo_atom_register() automatically. One exception is ofono_gprs_context drivers which have not had a ofono_gprs_context_register() API. Introduce such an API as a no-op for now. --- drivers/atmodem/gprs-context.c | 1 + drivers/gemaltomodem/gprs-context.c | 1 + drivers/hsomodem/gprs-context.c | 1 + drivers/huaweimodem/gprs-context.c | 1 + drivers/iceramodem/gprs-context.c | 1 + drivers/ifxmodem/gprs-context.c | 1 + drivers/isimodem/gprs-context.c | 1 + drivers/mbimmodem/gprs-context.c | 1 + drivers/mbmmodem/gprs-context.c | 1 + drivers/qmimodem/gprs-context.c | 1 + drivers/rilmodem/gprs-context.c | 1 + drivers/stemodem/gprs-context.c | 1 + drivers/swmodem/gprs-context.c | 1 + drivers/ubloxmodem/gprs-context.c | 1 + include/audio-settings.h | 1 + include/call-barring.h | 1 + include/call-forwarding.h | 1 + include/call-meter.h | 1 + include/call-settings.h | 1 + include/call-volume.h | 1 + include/cbs.h | 1 + include/ctm.h | 1 + include/devinfo.h | 1 + include/gnss.h | 1 + include/gprs-context.h | 1 + include/gprs.h | 1 + include/handsfree.h | 1 + include/ims.h | 1 + include/location-reporting.h | 1 + include/lte.h | 1 + include/modem.h | 2 ++ include/netmon.h | 1 + include/netreg.h | 1 + include/phonebook.h | 1 + include/radio-settings.h | 1 + include/sim.h | 1 + include/siri.h | 1 + include/sms.h | 1 + include/stk.h | 1 + include/ussd.h | 1 + include/voicecall.h | 1 + src/gprs.c | 4 ++++ src/ofono.h | 5 +++++ 43 files changed, 51 insertions(+) diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c index 5cca26f57ccb..da63fa1c72f3 100644 --- a/drivers/atmodem/gprs-context.c +++ b/drivers/atmodem/gprs-context.c @@ -495,6 +495,7 @@ static void at_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = at_gprs_context_probe, .remove = at_gprs_context_remove, .activate_primary = at_gprs_activate_primary, diff --git a/drivers/gemaltomodem/gprs-context.c b/drivers/gemaltomodem/gprs-context.c index 34c044207274..f60fd4282a31 100644 --- a/drivers/gemaltomodem/gprs-context.c +++ b/drivers/gemaltomodem/gprs-context.c @@ -327,6 +327,7 @@ static void gemalto_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = gemalto_gprs_context_probe, .remove = gemalto_gprs_context_remove, .activate_primary = gemalto_gprs_activate_primary, diff --git a/drivers/hsomodem/gprs-context.c b/drivers/hsomodem/gprs-context.c index 85f16404cb76..3b3346b0309b 100644 --- a/drivers/hsomodem/gprs-context.c +++ b/drivers/hsomodem/gprs-context.c @@ -363,6 +363,7 @@ static void hso_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = hso_gprs_context_probe, .remove = hso_gprs_context_remove, .activate_primary = hso_gprs_activate_primary, diff --git a/drivers/huaweimodem/gprs-context.c b/drivers/huaweimodem/gprs-context.c index 81eecbeded11..9108d490e0c5 100644 --- a/drivers/huaweimodem/gprs-context.c +++ b/drivers/huaweimodem/gprs-context.c @@ -322,6 +322,7 @@ static void huawei_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = huawei_gprs_context_probe, .remove = huawei_gprs_context_remove, .activate_primary = huawei_gprs_activate_primary, diff --git a/drivers/iceramodem/gprs-context.c b/drivers/iceramodem/gprs-context.c index 1bfaf703905c..070017c1d529 100644 --- a/drivers/iceramodem/gprs-context.c +++ b/drivers/iceramodem/gprs-context.c @@ -389,6 +389,7 @@ static void icera_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = icera_gprs_context_probe, .remove = icera_gprs_context_remove, .activate_primary = icera_gprs_activate_primary, diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c index f39c874a299b..da4632b5ce42 100644 --- a/drivers/ifxmodem/gprs-context.c +++ b/drivers/ifxmodem/gprs-context.c @@ -724,6 +724,7 @@ static void ifx_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = ifx_gprs_context_probe, .remove = ifx_gprs_context_remove, .activate_primary = ifx_gprs_activate_primary, diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c index ec4e9c15a69e..7d6fda2baf85 100644 --- a/drivers/isimodem/gprs-context.c +++ b/drivers/isimodem/gprs-context.c @@ -645,6 +645,7 @@ static void isi_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = isi_gprs_context_probe, .remove = isi_gprs_context_remove, .activate_primary = isi_gprs_activate_primary, diff --git a/drivers/mbimmodem/gprs-context.c b/drivers/mbimmodem/gprs-context.c index 0c2042d92919..c420e300aa57 100644 --- a/drivers/mbimmodem/gprs-context.c +++ b/drivers/mbimmodem/gprs-context.c @@ -440,6 +440,7 @@ static void mbim_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = mbim_gprs_context_probe, .remove = mbim_gprs_context_remove, .activate_primary = mbim_gprs_activate_primary, diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c index 65668c36ef91..d9ea204da049 100644 --- a/drivers/mbmmodem/gprs-context.c +++ b/drivers/mbmmodem/gprs-context.c @@ -494,6 +494,7 @@ static void mbm_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = mbm_gprs_context_probe, .remove = mbm_gprs_context_remove, .activate_primary = mbm_gprs_activate_primary, diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 4b36d621630b..625fd0b8f193 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -608,6 +608,7 @@ static void qmi_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = qmi_gprs_context_probe, .remove = qmi_gprs_context_remove, .activate_primary = qmi_activate_primary, diff --git a/drivers/rilmodem/gprs-context.c b/drivers/rilmodem/gprs-context.c index be47731b295c..42d12b0f3e94 100644 --- a/drivers/rilmodem/gprs-context.c +++ b/drivers/rilmodem/gprs-context.c @@ -842,6 +842,7 @@ static void ril_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = ril_gprs_context_probe, .remove = ril_gprs_context_remove, .activate_primary = ril_gprs_context_activate_primary, diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c index e793c96cd4e3..a23c6f837ff4 100644 --- a/drivers/stemodem/gprs-context.c +++ b/drivers/stemodem/gprs-context.c @@ -412,6 +412,7 @@ out: } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = ste_gprs_context_probe, .remove = ste_gprs_context_remove, .activate_primary = ste_gprs_activate_primary, diff --git a/drivers/swmodem/gprs-context.c b/drivers/swmodem/gprs-context.c index 7de61871760e..32f8cef64c07 100644 --- a/drivers/swmodem/gprs-context.c +++ b/drivers/swmodem/gprs-context.c @@ -231,6 +231,7 @@ static void sw_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = sw_gprs_context_probe, .remove = sw_gprs_context_remove, .activate_primary = sw_gprs_activate_primary, diff --git a/drivers/ubloxmodem/gprs-context.c b/drivers/ubloxmodem/gprs-context.c index bba36ddd6c20..fab0207430b4 100644 --- a/drivers/ubloxmodem/gprs-context.c +++ b/drivers/ubloxmodem/gprs-context.c @@ -569,6 +569,7 @@ static void ublox_gprs_context_remove(struct ofono_gprs_context *gc) } static const struct ofono_gprs_context_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = ublox_gprs_context_probe, .remove = ublox_gprs_context_remove, .activate_primary = ublox_gprs_activate_primary, diff --git a/include/audio-settings.h b/include/audio-settings.h index 452d7e73632d..6b7eb0db1a7e 100644 --- a/include/audio-settings.h +++ b/include/audio-settings.h @@ -19,6 +19,7 @@ extern "C" { struct ofono_audio_settings; struct ofono_audio_settings_driver { + unsigned int flags; int (*probe)(struct ofono_audio_settings *as, unsigned int vendor, void *data); int (*probev)(struct ofono_audio_settings *as, diff --git a/include/call-barring.h b/include/call-barring.h index 99e2764e64da..7ce787249a9e 100644 --- a/include/call-barring.h +++ b/include/call-barring.h @@ -24,6 +24,7 @@ typedef void (*ofono_call_barring_query_cb_t)(const struct ofono_error *error, int status, void *data); struct ofono_call_barring_driver { + unsigned int flags; int (*probe)(struct ofono_call_barring *cb, unsigned int vendor, void *data); int (*probev)(struct ofono_call_barring *cb, unsigned int vendor, diff --git a/include/call-forwarding.h b/include/call-forwarding.h index 2eb2f1817b8d..3e58bb40e48f 100644 --- a/include/call-forwarding.h +++ b/include/call-forwarding.h @@ -34,6 +34,7 @@ typedef void (*ofono_call_forwarding_query_cb_t)( void *data); struct ofono_call_forwarding_driver { + unsigned int flags; int (*probe)(struct ofono_call_forwarding *cf, unsigned int vendor, void *data); int (*probev)(struct ofono_call_forwarding *cf, unsigned int vendor, diff --git a/include/call-meter.h b/include/call-meter.h index 9a00104a2ede..455f1645ba0d 100644 --- a/include/call-meter.h +++ b/include/call-meter.h @@ -30,6 +30,7 @@ typedef void(*ofono_call_meter_set_cb_t)(const struct ofono_error *error, void *data); struct ofono_call_meter_driver { + unsigned int flags; int (*probe)(struct ofono_call_meter *cm, unsigned int vendor, void *data); int (*probev)(struct ofono_call_meter *cm, unsigned int vendor, diff --git a/include/call-settings.h b/include/call-settings.h index ced1047fd3d2..72c69df6ed20 100644 --- a/include/call-settings.h +++ b/include/call-settings.h @@ -28,6 +28,7 @@ typedef void (*ofono_call_settings_clir_cb_t)(const struct ofono_error *error, int override, int network, void *data); struct ofono_call_settings_driver { + unsigned int flags; int (*probe)(struct ofono_call_settings *cs, unsigned int vendor, void *data); int (*probev)(struct ofono_call_settings *cs, unsigned int vendor, diff --git a/include/call-volume.h b/include/call-volume.h index 90629b25cc1f..5b95d1814d86 100644 --- a/include/call-volume.h +++ b/include/call-volume.h @@ -23,6 +23,7 @@ typedef void (*ofono_call_volume_cb_t)(const struct ofono_error *error, void *data); struct ofono_call_volume_driver { + unsigned int flags; int (*probe)(struct ofono_call_volume *cv, unsigned int vendor, void *data); int (*probev)(struct ofono_call_volume *cv, unsigned int vendor, diff --git a/include/cbs.h b/include/cbs.h index 9d3367b7b24f..07e08836db6e 100644 --- a/include/cbs.h +++ b/include/cbs.h @@ -22,6 +22,7 @@ typedef void (*ofono_cbs_set_cb_t)(const struct ofono_error *error, void *data); struct ofono_cbs_driver { + unsigned int flags; int (*probe)(struct ofono_cbs *cbs, unsigned int vendor, void *data); int (*probev)(struct ofono_cbs *cbs, unsigned int vendor, va_list args); void (*remove)(struct ofono_cbs *cbs); diff --git a/include/ctm.h b/include/ctm.h index 315fa5d562f3..19a7332dcc2b 100644 --- a/include/ctm.h +++ b/include/ctm.h @@ -25,6 +25,7 @@ typedef void (*ofono_ctm_query_cb_t)(const struct ofono_error *error, ofono_bool_t enable, void *data); struct ofono_ctm_driver { + unsigned int flags; int (*probe)(struct ofono_ctm *ctm, unsigned int vendor, void *data); int (*probev)(struct ofono_ctm *ctm, unsigned int vendor, va_list args); void (*remove)(struct ofono_ctm *ctm); diff --git a/include/devinfo.h b/include/devinfo.h index ac553e959443..70190b8fcc62 100644 --- a/include/devinfo.h +++ b/include/devinfo.h @@ -22,6 +22,7 @@ typedef void (*ofono_devinfo_query_cb_t)(const struct ofono_error *error, const char *attribute, void *data); struct ofono_devinfo_driver { + unsigned int flags; int (*probe)(struct ofono_devinfo *info, unsigned int vendor, void *data); int (*probev)(struct ofono_devinfo *info, unsigned int vendor, diff --git a/include/gnss.h b/include/gnss.h index dd1b79246f72..5df31791ef80 100644 --- a/include/gnss.h +++ b/include/gnss.h @@ -22,6 +22,7 @@ struct ofono_gnss; typedef void (*ofono_gnss_cb_t)(const struct ofono_error *error, void *data); struct ofono_gnss_driver { + unsigned int flags; int (*probe)(struct ofono_gnss *gnss, unsigned int vendor, void *data); int (*probev)(struct ofono_gnss *gnss, unsigned int vendor, va_list args); diff --git a/include/gprs-context.h b/include/gprs-context.h index 2bc9dd166787..0002724acbd3 100644 --- a/include/gprs-context.h +++ b/include/gprs-context.h @@ -42,6 +42,7 @@ typedef void (*ofono_gprs_context_cb_t)(const struct ofono_error *error, void *data); struct ofono_gprs_context_driver { + unsigned int flags; int (*probe)(struct ofono_gprs_context *gc, unsigned int vendor, void *data); int (*probev)(struct ofono_gprs_context *gc, unsigned int vendor, diff --git a/include/gprs.h b/include/gprs.h index 62bf05baf30b..df288a125de4 100644 --- a/include/gprs.h +++ b/include/gprs.h @@ -25,6 +25,7 @@ typedef void (*ofono_gprs_status_cb_t)(const struct ofono_error *error, typedef void (*ofono_gprs_cb_t)(const struct ofono_error *error, void *data); struct ofono_gprs_driver { + unsigned int flags; int (*probe)(struct ofono_gprs *gprs, unsigned int vendor, void *data); int (*probev)(struct ofono_gprs *gprs, unsigned int vendor, diff --git a/include/handsfree.h b/include/handsfree.h index 43fe572693f6..19eeb52bd802 100644 --- a/include/handsfree.h +++ b/include/handsfree.h @@ -30,6 +30,7 @@ typedef void (*ofono_handsfree_cnum_query_cb_t)(const struct ofono_error *error, void *data); struct ofono_handsfree_driver { + unsigned int flags; int (*probe)(struct ofono_handsfree *hf, unsigned int vendor, void *data); int (*probev)(struct ofono_handsfree *hf, unsigned int vendor, diff --git a/include/ims.h b/include/ims.h index c394d5160c26..cee3ff804b37 100644 --- a/include/ims.h +++ b/include/ims.h @@ -25,6 +25,7 @@ typedef void (*ofono_ims_status_cb_t)(const struct ofono_error *error, void *data); struct ofono_ims_driver { + unsigned int flags; int (*probe)(struct ofono_ims *ims, unsigned int vendor, void *data); int (*probev)(struct ofono_ims *ims, unsigned int vendor, va_list args); void (*remove)(struct ofono_ims *ims); diff --git a/include/location-reporting.h b/include/location-reporting.h index 7faf0ba3c485..75900eb5738c 100644 --- a/include/location-reporting.h +++ b/include/location-reporting.h @@ -31,6 +31,7 @@ typedef void (*ofono_location_reporting_disable_cb_t)( void *data); struct ofono_location_reporting_driver { + unsigned int flags; enum ofono_location_reporting_type type; int (*probe)(struct ofono_location_reporting *lr, unsigned int vendor, void *data); diff --git a/include/lte.h b/include/lte.h index 3f8dbd535e69..91a15fdcc1a0 100644 --- a/include/lte.h +++ b/include/lte.h @@ -30,6 +30,7 @@ struct ofono_lte_default_attach_info { typedef void (*ofono_lte_cb_t)(const struct ofono_error *error, void *data); struct ofono_lte_driver { + unsigned int flags; int (*probe)(struct ofono_lte *lte, unsigned int vendor, void *data); int (*probev)(struct ofono_lte *lte, unsigned int vendor, va_list args); void (*remove)(struct ofono_lte *lte); diff --git a/include/modem.h b/include/modem.h index 08a7012acae4..65cb3a15bc95 100644 --- a/include/modem.h +++ b/include/modem.h @@ -41,6 +41,8 @@ struct ofono_driver_desc { const void *driver; } __attribute__((aligned(8))); +#define OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE 0x1 + #define OFONO_ATOM_DRIVER_BUILTIN(type, name, driver) \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \ diff --git a/include/netmon.h b/include/netmon.h index d1eef952314e..7eac8d070c80 100644 --- a/include/netmon.h +++ b/include/netmon.h @@ -21,6 +21,7 @@ struct ofono_netmon; typedef void (*ofono_netmon_cb_t)(const struct ofono_error *error, void *data); struct ofono_netmon_driver { + unsigned int flags; int (*probe)(struct ofono_netmon *netmon, unsigned int vendor, void *data); int (*probev)(struct ofono_netmon *netmon, unsigned int vendor, diff --git a/include/netreg.h b/include/netreg.h index 48a13e161fea..8d11518aa239 100644 --- a/include/netreg.h +++ b/include/netreg.h @@ -57,6 +57,7 @@ typedef void (*ofono_netreg_strength_cb_t)(const struct ofono_error *error, * vendor extensions for signal strength notification. */ struct ofono_netreg_driver { + unsigned int flags; int (*probe)(struct ofono_netreg *netreg, unsigned int vendor, void *data); int (*probev)(struct ofono_netreg *netreg, unsigned int vendor, diff --git a/include/phonebook.h b/include/phonebook.h index 2c895fa9cf13..fbe689618215 100644 --- a/include/phonebook.h +++ b/include/phonebook.h @@ -39,6 +39,7 @@ typedef void (*ofono_phonebook_cb_t)(const struct ofono_error *error, * occurs, ofono_phonebook_entry should not be called */ struct ofono_phonebook_driver { + unsigned int flags; int (*probe)(struct ofono_phonebook *pb, unsigned int vendor, void *data); int (*probev)(struct ofono_phonebook *pb, unsigned int vendor, diff --git a/include/radio-settings.h b/include/radio-settings.h index 7dcccf81d226..487963c589d7 100644 --- a/include/radio-settings.h +++ b/include/radio-settings.h @@ -73,6 +73,7 @@ typedef void (*ofono_radio_settings_available_rats_query_cb_t)( void *data); struct ofono_radio_settings_driver { + unsigned int flags; int (*probe)(struct ofono_radio_settings *rs, unsigned int vendor, void *data); int (*probev)(struct ofono_radio_settings *rs, unsigned int vendor, diff --git a/include/sim.h b/include/sim.h index c362cc0ecb62..84592fc93e5a 100644 --- a/include/sim.h +++ b/include/sim.h @@ -125,6 +125,7 @@ typedef void (*ofono_sim_set_active_card_slot_cb_t)( void *data); struct ofono_sim_driver { + unsigned int flags; int (*probe)(struct ofono_sim *sim, unsigned int vendor, void *data); int (*probev)(struct ofono_sim *sim, unsigned int vendor, va_list args); void (*remove)(struct ofono_sim *sim); diff --git a/include/siri.h b/include/siri.h index 0a9702b2037a..7a41694f0c09 100644 --- a/include/siri.h +++ b/include/siri.h @@ -22,6 +22,7 @@ typedef void (*ofono_siri_cb_t)(const struct ofono_error *error, struct ofono_siri *siri); struct ofono_siri_driver { + unsigned int flags; int (*probe)(struct ofono_siri *siri, unsigned int vendor, void *data); int (*probev)(struct ofono_siri *siri, unsigned int vendor, va_list args); diff --git a/include/sms.h b/include/sms.h index d843ae6ae122..ba98c5e44287 100644 --- a/include/sms.h +++ b/include/sms.h @@ -31,6 +31,7 @@ typedef void (*ofono_sms_bearer_query_cb_t)(const struct ofono_error *error, int bearer, void *data); struct ofono_sms_driver { + unsigned int flags; int (*probe)(struct ofono_sms *sms, unsigned int vendor, void *data); int (*probev)(struct ofono_sms *sms, unsigned int vendor, va_list args); void (*remove)(struct ofono_sms *sms); diff --git a/include/stk.h b/include/stk.h index 8575b2819b4a..b99f6ba255e4 100644 --- a/include/stk.h +++ b/include/stk.h @@ -26,6 +26,7 @@ typedef void (*ofono_stk_generic_cb_t)(const struct ofono_error *error, void *data); struct ofono_stk_driver { + unsigned int flags; int (*probe)(struct ofono_stk *stk, unsigned int vendor, void *data); int (*probev)(struct ofono_stk *stk, unsigned int vendor, va_list args); void (*remove)(struct ofono_stk *stk); diff --git a/include/ussd.h b/include/ussd.h index 04a91e8483b7..1b928171ef9e 100644 --- a/include/ussd.h +++ b/include/ussd.h @@ -31,6 +31,7 @@ struct ofono_ussd; typedef void (*ofono_ussd_cb_t)(const struct ofono_error *error, void *data); struct ofono_ussd_driver { + unsigned int flags; int (*probe)(struct ofono_ussd *ussd, unsigned int vendor, void *data); int (*probev)(struct ofono_ussd *ussd, unsigned int vendor, va_list args); diff --git a/include/voicecall.h b/include/voicecall.h index 345e52b15a0e..370658369538 100644 --- a/include/voicecall.h +++ b/include/voicecall.h @@ -29,6 +29,7 @@ typedef void (*ofono_voicecall_cb_t)(const struct ofono_error *error, * not support vendor extensions for call progress indication. */ struct ofono_voicecall_driver { + unsigned int flags; int (*probe)(struct ofono_voicecall *vc, unsigned int vendor, void *data); int (*probev)(struct ofono_voicecall *vc, unsigned int vendor, diff --git a/src/gprs.c b/src/gprs.c index 28b3ddff6584..57b823b0f1c6 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -2806,6 +2806,10 @@ static void gprs_context_remove(struct ofono_atom *atom) g_free(gc); } +static void ofono_gprs_context_register(struct ofono_gprs_context *gc) +{ +} + OFONO_DEFINE_ATOM_CREATE(gprs_context, OFONO_ATOM_TYPE_GPRS_CONTEXT, { atom->type = OFONO_GPRS_CONTEXT_TYPE_ANY; }) diff --git a/src/ofono.h b/src/ofono.h index c6fa16f2dc01..a853bba60ce6 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -263,6 +263,11 @@ struct ofono_ ## type *ofono_ ## type ##_create( \ } \ \ atom->driver = drv; \ + \ + if (atom->driver->flags & \ + OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE) \ + ofono_ ## type ##_register(atom); \ + \ return atom; \ } From patchwork Fri Jun 7 22:47:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690701 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E10181CAB5 for ; Fri, 7 Jun 2024 22:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800475; cv=none; b=BgbuDQ8hd3t6A0uW8q4hVAAC1WNeQwBkEjiC7ixnmSo2a2qJ0jyjlpoX09qERKOAjZoNR2SroMnWsNNx0iSywI1aXZT+/V9+aXUCYSfWwh1dm224kjcgE8cqGy6Iu+x6LhmDjKzkzkYMte3iHZvUbC9u8duS10znaUsZ2qeo+/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800475; c=relaxed/simple; bh=2dmAhmWZ/wPkyF9FB8Oet3/n6QpWt/Q86pnqLM+OQo8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lJWe647cs0fflpUNW6fsPLoVFgpsxgdvrQYTRTvIFFFF8qW37lWbz/OrbXpk36409x/5XRBVqNGcBf4Io9jSXD2q0gijHAcbMlBCbuN9CIRO4sS5RdrEfXWqSMpM9YtCP0q8w95YQlge6O95EQI6osHuTpI3vKOLMnfwucEC+6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nFGJPbhb; arc=none smtp.client-ip=209.85.161.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nFGJPbhb" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5ba33b08550so1425438eaf.2 for ; Fri, 07 Jun 2024 15:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800473; x=1718405273; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2nZjk+odFokyhaV+Ey+Q8l4FcCSD/HuMKdyicUc4rrA=; b=nFGJPbhb/XHw5sXlIDrYiS4A7KnTHdt7YPSDN1mk8h9CLY/4/7wjNuBIaM9CgiDEYX Q6gF6FR/64dmZ8KWWX0o7N/QxzrO4E/TWlYjN3LDukyLa11u5WT322iVR2qiYKUqV9us Xu7VJKYMTGJW63G3ZeMTYkWawiuCuwoeseoHghRPDhgTanwdM4MQOFGe+FT9jUAFehd2 EpERtV90eFRMNJnJ6sVrjbKxvxiB0ra0ucjGelZqUfM0QlCqTWwFyy5o9kY1WX+N+vhn ZfOXaJ1YaistkIYd5lMhYezn00YDJdNr+pJwFPSZ8/ARWb+ifawKH43dwvNehlPA4vy9 sLQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800473; x=1718405273; h=content-transfer-encoding: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=2nZjk+odFokyhaV+Ey+Q8l4FcCSD/HuMKdyicUc4rrA=; b=LxbCtjYujoIEP4pdQgLG9WfpB0DpPAOPnBc6B8mvaTsZlHB8Xfnms/tjh8NgM73Zu7 iKqdmJUEdMCFaGT0/0yAh39mU7YJUk0qKQWRz8+ALbwGqEh/aqyVUPLbb3EcbuNry693 DADIeLNzOC5EyqDFWD+cVz4ITkANK3vKtIGrMBPK8lE1gugd6e9HZMYcBURE7LiEZbJa zonMfXPR1inkASAilMl+2at3qT+mb/+AyVhJUpI5ZUoSHmQl/9q/q8tbGEjI84TIYoUF RZinUU0pKk/p3PSqwY37Fq9nmD2rmmi1hvo0o7FzU6rJkXmnLbbeWMO8OoXrkeziYoOH L87g== X-Gm-Message-State: AOJu0YxAdwOx3njZaop0hXr9nFmfgJF5iK+/KzH+uzJb8nPC44nEPqDp NvXqgu6ekGqNvKbVTNqJE1hUQzhzMOvXw8isHVAPby5/9wg8zr90s+8MjA== X-Google-Smtp-Source: AGHT+IHDcgYueC9mhj66vNBRwghLtmFFiEYoNJDs6NjpuAxLjSoQu+oa2UBB2gduNzuEMH3HxxD/iQ== X-Received: by 2002:a05:6820:1ad3:b0:5b7:3502:653c with SMTP id 006d021491bc7-5baae75722fmr4590059eaf.4.1717800472951; Fri, 07 Jun 2024 15:47:52 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:52 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 06/23] qmi: introduce qmi_service_clone Date: Fri, 7 Jun 2024 17:47:06 -0500 Message-ID: <20240607224746.903769-6-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Allows obtaining a new lightweight qmi_service handle from an existing handle. All outstanding requests (sent using qmi_service_send) and registrations (qmi_service_register) will be automatically canceled when the lightweight handle is freed. --- drivers/qmimodem/qmi.c | 8 ++++++++ drivers/qmimodem/qmi.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index 1b3fa34f685c..91469dc2e00c 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -2918,6 +2918,14 @@ static bool qmi_service_unregister_all(struct qmi_service *service) return true; } +struct qmi_service *qmi_service_clone(struct qmi_service *service) +{ + if (!service) + return NULL; + + return service_create(service->family); +} + void qmi_service_free(struct qmi_service *service) { if (!service) diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h index 227c498ab41d..821e54443658 100644 --- a/drivers/qmimodem/qmi.h +++ b/drivers/qmimodem/qmi.h @@ -139,6 +139,7 @@ typedef void (*qmi_create_func_t)(struct qmi_service *service, void *user_data); 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); +struct qmi_service *qmi_service_clone(struct qmi_service *service); void qmi_service_free(struct qmi_service *service); const char *qmi_service_get_identifier(struct qmi_service *service); From patchwork Fri Jun 7 22:47:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690703 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA297155390 for ; Fri, 7 Jun 2024 22:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800476; cv=none; b=JSBUEy2xibpbx45wDlpUalbXHQ2neO7gFcPL7OZ3CKugunSNJEqE0NU6IlpQNCNKfDnI+2fvngJjf7aBsMj05CfFbiwF0to7kLqk1DeARvdaG7lJvDiO0hWGi03uvtDerEETgAjtdGg0pn4CZtBM2IazqN5O9blwjelSVeATtEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800476; c=relaxed/simple; bh=MWdjsAWYmmbE7/zvOXe4RhU/0EJAqazgrpugKPkfbmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kukjl/7afc8zOvHKYQHT9kPrVe5NwegSzREidSgYPFLateiABE/u6u1Jr7QmtAh9MyEkF46g67YBQZMlmI8k+MdgdHgGI/LIPGuRPFUUercAK1rkWROqTuO5bLzzDXsS5E2rHGqC+EVQ9/Wi08n2xRYRxB6s59LCQF21epXiAwE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d2X37upc; arc=none smtp.client-ip=209.85.161.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d2X37upc" Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5b997b8a7efso1045306eaf.0 for ; Fri, 07 Jun 2024 15:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800474; x=1718405274; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YOccx9sH5t7MoQApYdFurfu/tU3tLahsUCaTcDvCZJY=; b=d2X37upc0Mzt9/wL9zjzaT2XQePQZk9xG1Kyao+K61py+VTWCoN4Kl23dpZfOMPuS2 eoTKymtk2J7ajUZU8JCWQAf7+NcNDq2HenoV0t3I+WpBh3K1IStXjXNkY1Cl7EFMkkxV OVhRv2KRZF4eA29lx+NywEs3DBmfUFAOIBRdcsvfXttPln8ezTFIzqTisbKbwHiRC05t sUQIee05FtSNwu73X0KocWWcw1X1pZ6E+Ag1Nkhbi5MIs6ipiXBVFxnVEv0StFsB+Imm Gz0MTcUms2CK6RQw8HwBKwfbe10r1Aj+1qcahQXyf2VgD/wQUspravFNBsfg6g6nQ3o5 TDWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800474; x=1718405274; h=content-transfer-encoding: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=YOccx9sH5t7MoQApYdFurfu/tU3tLahsUCaTcDvCZJY=; b=JIWjJfQBQOr4yQPzBAovnqS23DUs20AMcx1RoE9w7xPi7o5jwuRtliBjCmzvMXq56l qay2K0cyMpQmLQpvj6q2WzYWEClTBBuvV+Kghy1HyP7LWQWd5ePYmgNzGRa+fmxCY1Ql ZoZWgWrudgG/oKtW49hUyUeDT1TTHPq0eIDgS3Kx18+ganhuIX6CHG5z3rXvCkj0Qfca 0UaME1mybelpL5W/0HeE6mrbkOfKPpFqsU7wjMDV2QM+9M9mWkmC99KkVk/NUnApJP1M d+7GQDVnxIRCv4gfti7yKUrs2GpkTYfsWOU2+DKCNOMs1nRJuVUw4of22LivntIBf93n COTg== X-Gm-Message-State: AOJu0Yy1cgZZPHsJVcmaHZWmnNk1UsBSIUOeWrZmI1jJPFfhlZR5gpNu zyq6+57+xY/QI9gYsoJ3V8oBE7/d0bvedYer1soKVG5mAKkPcMfBNB69CA== X-Google-Smtp-Source: AGHT+IHIiAETB/2ggJd2mqF0GzgeHyFxbjNGQbJaMQmHF0s5mFgEnScN6GdzCFwBQhAOzqVUZ+bu4A== X-Received: by 2002:a05:6820:82b:b0:5ba:6687:a4dd with SMTP id 006d021491bc7-5baae8d0d41mr4281697eaf.8.1717800473558; Fri, 07 Jun 2024 15:47:53 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:53 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 07/23] gobi: request needed services at .enable() Date: Fri, 7 Jun 2024 17:47:07 -0500 Message-ID: <20240607224746.903769-7-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Request all needed services when the modem is being powered up via .enable method. --- plugins/gobi.c | 100 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 15 deletions(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index 147f572a799a..c82dd70d25e1 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -63,10 +63,24 @@ enum qmi_protocol { QMI_PROTOCOL_QRTR, }; +struct service_request { + struct qmi_service **member; + uint32_t service_type; +}; + struct gobi_data { struct qmi_device *device; struct qmi_service *dms; struct qmi_service *wda; + struct qmi_service *nas; + struct qmi_service *wds; + struct qmi_service *wms; + struct qmi_service *voice; + struct qmi_service *pds; + struct qmi_service *uim; + struct service_request service_requests[16]; + int cur_service_request; + int num_service_requests; unsigned long features; unsigned int discover_attempts; uint8_t oper_mode; @@ -164,6 +178,24 @@ static void cleanup_services(struct gobi_data *data) qmi_service_free(data->wda); data->wda = NULL; + + qmi_service_free(data->nas); + data->nas = NULL; + + qmi_service_free(data->wds); + data->wds = NULL; + + qmi_service_free(data->wms); + data->wms = NULL; + + qmi_service_free(data->voice); + data->voice = NULL; + + qmi_service_free(data->pds); + data->pds = NULL; + + qmi_service_free(data->uim); + data->uim = NULL; } static void gobi_remove(struct ofono_modem *modem) @@ -186,6 +218,21 @@ static void gobi_remove(struct ofono_modem *modem) l_free(data); } +static void add_service_request(struct gobi_data *data, + struct qmi_service **member, + uint32_t service_type) +{ + struct service_request req = { .member = member, + .service_type = service_type }; + + if (data->num_service_requests == L_ARRAY_SIZE(data->service_requests)) { + ofono_error("No room to add service request"); + return; + } + + data->service_requests[data->num_service_requests++] = req; +} + static void shutdown_cb(void *user_data) { struct ofono_modem *modem = user_data; @@ -379,34 +426,42 @@ error: shutdown_device(modem); } -static void create_dms_cb(struct qmi_service *service, void *user_data) +static void request_service_cb(struct qmi_service *service, void *user_data) { struct ofono_modem *modem = user_data; struct gobi_data *data = ofono_modem_get_data(modem); + struct service_request *req = + &data->service_requests[data->cur_service_request]; DBG(""); if (!service) goto error; - data->dms = service; + *req->member = service; - if (qmi_service_create_shared(data->device, QMI_SERVICE_WDA, - create_wda_cb, modem, NULL)) + data->cur_service_request += 1; + if (data->cur_service_request == data->num_service_requests) { + DBG("All services requested, proceeding to create WDA"); + + if (qmi_service_create_shared(data->device, QMI_SERVICE_WDA, + create_wda_cb, modem, NULL)) + return; + + goto error; + } + + req = &data->service_requests[data->cur_service_request]; + DBG("Requesting: %u", req->service_type); + + if (qmi_service_create_shared(data->device, req->service_type, + request_service_cb, modem, NULL)) return; error: shutdown_device(modem); } -static void create_shared_dms(struct ofono_modem *modem) -{ - struct gobi_data *data = ofono_modem_get_data(modem); - - qmi_service_create_shared(data->device, QMI_SERVICE_DMS, - create_dms_cb, modem, NULL); -} - static void discover_cb(void *user_data) { struct ofono_modem *modem = user_data; @@ -446,11 +501,26 @@ static void discover_cb(void *user_data) modem, NULL)) return; - shutdown_device(modem); - return; + goto error; } - create_shared_dms(modem); + add_service_request(data, &data->dms, QMI_SERVICE_DMS); + if (data->features & GOBI_NAS) + add_service_request(data, &data->nas, QMI_SERVICE_NAS); + if (data->features & GOBI_WDS) + add_service_request(data, &data->wds, QMI_SERVICE_WDS); + if (data->features & GOBI_WMS) + add_service_request(data, &data->wms, QMI_SERVICE_WMS); + if (data->features & GOBI_VOICE) + add_service_request(data, &data->voice, QMI_SERVICE_VOICE); + if (data->features & GOBI_UIM) + add_service_request(data, &data->uim, QMI_SERVICE_UIM); + + if (qmi_service_create_shared(data->device, QMI_SERVICE_DMS, + request_service_cb, modem, NULL) > 0) + return; +error: + shutdown_device(modem); } static int gobi_enable(struct ofono_modem *modem) From patchwork Fri Jun 7 22:47:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690704 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A730719D8B5 for ; Fri, 7 Jun 2024 22:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800477; cv=none; b=WIDaBxbTr3EYsbWjjjMFMfKxOnSgeEHp+wU5Z7+w3uGtVLEtvaDIoGJP8payUZRoXmdI0pHUcSOxauYjaKHa8E3BldAOBFbpNYeEMmTdD5Ol62nLruGHLEbtLOg2Nj4TXQsQuDYB+e4D5emcCX8i1d+Aem+Eh5fwlENi/YiMW+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800477; c=relaxed/simple; bh=OJCTEr//bHTKfFyKhWyff2cibYrVj+6uWeZiPKxYXgg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gm9A5NU57dvRj0Rs0b4Nunfu53C6s1dDo91NWY3eL3R1ST+lmzPWlkQYg5fI7ajRGzfyYS3A4oalS8yAq4yZoKhM0YTaQwj9YWqeFpI99UqTLRlaBKQDb2zrQWFwe0q5do729xT5+MiYnOV88sk83PbD4o9brOXDv7C9ECgYLBY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nBAdwVFl; arc=none smtp.client-ip=209.85.161.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nBAdwVFl" Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5ba33b08550so1425443eaf.2 for ; Fri, 07 Jun 2024 15:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800475; x=1718405275; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZvlkyCcO7kbBQkBzwIIrUUUWp9H7a3gMrqwzAqckpJI=; b=nBAdwVFlm4GpWd9ALKvZbYWDb7sj48VcqfdVAqsDJi28XVOu8ouf+8ZKw2axPu1w4V J57j69dILItSgZ2YZ4gFu6hdkp900TkRmb60GRqwkn+xcxMaNRVn6CZJ0CcFQVh61tcP fpl9SCrBaC/szk3oN0s16VaVqE01uLbQ4B5YGNGjiHkJalke0fP5jESGorym17LJTYfj HjHhGiGs+pKhvRVOJ1aT0HcCLNVuMDYZs8KOaBtM1pUNmsdgBFY9weVfsR4+jW0c/M7K uEhGrHuXrzJj0OKlfz3kHoeEmCf1Ydqk8rYNmsGgcHpvbuVYCTsSaJL+wu7q741erMVS lqMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800475; x=1718405275; h=content-transfer-encoding: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=ZvlkyCcO7kbBQkBzwIIrUUUWp9H7a3gMrqwzAqckpJI=; b=c/BjCxKFl7bqt8uZxTQzId0i40x3Bboyhwbs0Pa3yyK1wBDo9CFnBmsgrShAraRx6w RCj8XZI8c6GFgh3NSC8GMsGj/PXB785lNxN9uKm5PS31vuNk8YhOASCHrzolGD7jftsm 70QQXjJca9lz+G2bKlhkC0w0EN0ejsAxDWXwbPUMjT/3fGd3uuVBCqipsE/tdB/YJk+/ M1bNblhe1Uxaq/ILmJ0oBZ5NPxnxj3canfel5qMf6qgF/Y9HQO7/JBM27sSgCq0qsZuw 335tnuttIL3+Y5R8FfzYq8Atd6zG0agit4re2qNQgU1r8QDfYhTNb7F3wJT1L6FqtrlV HKsA== X-Gm-Message-State: AOJu0YwttNwYf4RiLNwQo/rZAc0TTek/Ev/QEOA8sLp+v/c4TCCtwo9A WOiC6YpkNSaN6BMAAZk9kRz3AGx7R27aT06RZlifrKuI9GmBBsaTfIFuNw== X-Google-Smtp-Source: AGHT+IEQFHTLQXpDlX1WlrXRdqGb7TFs0eGGaTH5Ne7XEMVCah5SJRk1eVWHYFkAIzA+WjuhpC/5sg== X-Received: by 2002:a05:6820:161f:b0:5b1:bf03:d1c6 with SMTP id 006d021491bc7-5baae50bfe2mr4365520eaf.1.1717800474530; Fri, 07 Jun 2024 15:47:54 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:54 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 08/23] qmi: devinfo: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:08 -0500 Message-ID: <20240607224746.903769-8-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Send qmi_service directly to the devinfo atom, which will clone it during probe, obtaining its own lightweight handle. --- drivers/qmimodem/devinfo.c | 45 +++++++------------------------------- plugins/gobi.c | 2 +- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/drivers/qmimodem/devinfo.c b/drivers/qmimodem/devinfo.c index b74e535aaeb8..2e514cfa3265 100644 --- a/drivers/qmimodem/devinfo.c +++ b/drivers/qmimodem/devinfo.c @@ -192,53 +192,25 @@ error: ofono_devinfo_register(devinfo); } -static void qmi_query_caps(struct ofono_devinfo *devinfo) -{ - struct devinfo_data *data = ofono_devinfo_get_data(devinfo); - - DBG(""); - - if (qmi_service_send(data->dms, QMI_DMS_GET_CAPS, NULL, - get_caps_cb, devinfo, NULL) > 0) - return; - - ofono_devinfo_register(devinfo); -} - -static void create_dms_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_devinfo *devinfo = user_data; - struct devinfo_data *data = ofono_devinfo_get_data(devinfo); - - DBG(""); - - if (!service) { - ofono_error("Failed to request DMS service"); - ofono_devinfo_remove(devinfo); - return; - } - - data->dms = service; - data->device_is_3gpp = false; - - qmi_query_caps(devinfo); -} - static int qmi_devinfo_probe(struct ofono_devinfo *devinfo, unsigned int vendor, void *user_data) { - struct qmi_device *device = user_data; + struct qmi_service *dms = user_data; struct devinfo_data *data; DBG(""); + if (!qmi_service_send(dms, QMI_DMS_GET_CAPS, NULL, + get_caps_cb, devinfo, NULL)) { + qmi_service_free(dms); + return -EIO; + } + data = l_new(struct devinfo_data, 1); + data->dms = dms; ofono_devinfo_set_data(devinfo, data); - qmi_service_create_shared(device, QMI_SERVICE_DMS, - create_dms_cb, devinfo, NULL); - return 0; } @@ -251,7 +223,6 @@ static void qmi_devinfo_remove(struct ofono_devinfo *devinfo) ofono_devinfo_set_data(devinfo, NULL); qmi_service_free(data->dms); - l_free(data); } diff --git a/plugins/gobi.c b/plugins/gobi.c index c82dd70d25e1..1a31e7a2b17d 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -725,7 +725,7 @@ static void gobi_pre_sim(struct ofono_modem *modem) DBG("%p", modem); - ofono_devinfo_create(modem, 0, "qmimodem", data->device); + ofono_devinfo_create(modem, 0, "qmimodem", qmi_service_clone(data->dms)); if (data->features & GOBI_UIM) sim_driver = "qmimodem"; From patchwork Fri Jun 7 22:47:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690705 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 012CF155728 for ; Fri, 7 Jun 2024 22:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800477; cv=none; b=BfxYieswtQ7J2rUJanp77sUgD5NT0n32EjcrtskeVY191d3Nam6wZ03IkiQtCp0K1ELWjrrbOuXg8Xcezj8/Wx1BXkfyFBIa1CzmQOPM026mXtZgBPtM5ZvqEG0m2dLireBXTG/1K0cLJUZ2DpXdRzeWVjdhaoqyIhd53nB/jZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800477; c=relaxed/simple; bh=LkEYvIxUBeEOfdy3LB8JcaPHvOWbC1NDSEXrtCwdm20=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c25EHj1TxOag8JwJwqHgdw9FMQMPWLcOOnJWUdZc6EdJvCMIQ0wtcg9tCkzo2SiASw4ciDZ1dj+P8xTkeQ9sqOw+YSR2UvtReJlPTbFan2IC3NjokRKKt3IcafzflXkw9AmY1KQsd6SIwMRtotU0Q+VZo+S4fk0vnfiKA30YXW4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ELo+T6xa; arc=none smtp.client-ip=209.85.161.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ELo+T6xa" Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5b97a071c92so1366661eaf.1 for ; Fri, 07 Jun 2024 15:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800475; x=1718405275; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eAu7nA5L3aL3vM9wjwUJEqCl+QRPuPlG8/beHgKZnGo=; b=ELo+T6xaS1ZRLfVxPXjk3kD3pah9ltaoIylUT1TwTLaDj6c+Kr3H6YeGF5jvunu86p C16DmMA52SwD79vbxh23flNPNZyHyWgEp+eUvqdST3aK36QkY3/Ita3YGKUekNlzPeXL LXW+fBPueMaqgifl0vulQn/xSrPCfjvr/wLl98ksXvygiJHJddMoWOnVTWyoalOWs0bS +TmmTi4+RAq4Ur7x94sV/PzOn1hPaxUxL7a5CRvccxJ4gEbVhUzTiePiHAOHbIuT0Qxu iE4vGtHOFqNhQ2njkJekZuUEzdyYqU6UIYqIZe1kvzPY5y0HPH3CMNi/4MxpGnpzQUEc leow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800475; x=1718405275; h=content-transfer-encoding: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=eAu7nA5L3aL3vM9wjwUJEqCl+QRPuPlG8/beHgKZnGo=; b=b/M5eZfzXk+4FQ5KB+gsALaGa0lX9El08nxKAZ7XwF+hyjjUnXIIJCHe0f6lrJf1BR L8YuF5TMYXICmOPzlnaZrS775OCRz3+xn+YB7qqwgp6ssvSfzCV64KFQbC+i+PLnEOKu IKWI2+QP+hlaFnvPJ1yRC8tBbprecQN9CPgxDZZbC+pW5nyp5IzJSXsDZ63vPaiKlTWm A5nark6p5KzKwk1WEcTZ1rTGUvn2N8PSoxM7rXjou4QBrLoZr7ev1obRAOTKU08+327c LVc3g3tuKUKvMVZo+pRegjh7/s8f/EIyPC0I2UsgnOsnmKncq0S3D4NuweeOBF3XWS4t EY1w== X-Gm-Message-State: AOJu0YwdFQ3c+ka/2LmC+Fc8uJSuDn9HrznqP8bArTCnrOl319e44PJG 3JEOBozm44pc2KKskC1Zl3XpY5rBm2Lkdf796E9zWgb80mup86kbQiiNBQ== X-Google-Smtp-Source: AGHT+IEc2aLX4PsqVqSSd8RvJPqC8rUwDqyb4GBFXZVH3UF5X7ZEMEgo/0Khnb4yTvUDkKwNe3Er0g== X-Received: by 2002:a05:6820:823:b0:5b9:f440:169d with SMTP id 006d021491bc7-5baae5457c2mr4438938eaf.3.1717800475116; Fri, 07 Jun 2024 15:47:55 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:54 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 09/23] qmi: sim-legacy: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:09 -0500 Message-ID: <20240607224746.903769-9-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 While here, also drop tracking of indication registration. This is not needed as qmi_service_free will automatically unregister from all indications for the cloned handle. --- drivers/qmimodem/sim-legacy.c | 57 +++++++++-------------------------- plugins/gobi.c | 17 ++++------- 2 files changed, 20 insertions(+), 54 deletions(-) diff --git a/drivers/qmimodem/sim-legacy.c b/drivers/qmimodem/sim-legacy.c index aeea5fae22f3..1feaf86976c6 100644 --- a/drivers/qmimodem/sim-legacy.c +++ b/drivers/qmimodem/sim-legacy.c @@ -27,7 +27,6 @@ struct sim_data { struct qmi_service *dms; int retries[OFONO_SIM_PASSWORD_INVALID]; - uint16_t event_indication_id; }; static void qmi_read_file_info(struct ofono_sim *sim, int fileid, @@ -295,59 +294,37 @@ done: ofono_sim_register(sim); } -static void create_dms_cb(struct qmi_service *service, void *user_data) +static int qmi_sim_probe(struct ofono_sim *sim, + unsigned int vendor, void *user_data) { - struct ofono_sim *sim = user_data; - struct sim_data *data = ofono_sim_get_data(sim); + struct qmi_service *dms = user_data; struct qmi_param *param; + struct sim_data *data; + int i; DBG(""); - if (!service) { - ofono_error("Failed to request DMS service"); - ofono_sim_remove(sim); - return; - } - - data->dms = service; - - data->event_indication_id = - qmi_service_register(data->dms, QMI_DMS_EVENT, - event_notify, sim, NULL); - param = qmi_param_new(); - qmi_param_append_uint8(param, QMI_DMS_PARAM_REPORT_PIN_STATUS, 0x01); qmi_param_append_uint8(param, QMI_DMS_PARAM_REPORT_OPER_MODE, 0x01); qmi_param_append_uint8(param, QMI_DMS_PARAM_REPORT_UIM_STATE, 0x01); - if (qmi_service_send(data->dms, QMI_DMS_SET_EVENT, param, - set_event_cb, sim, NULL) > 0) - return; - - qmi_param_free(param); - - ofono_sim_register(sim); -} - -static int qmi_sim_probe(struct ofono_sim *sim, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; - struct sim_data *data; - int i; - - DBG(""); + if (!qmi_service_send(dms, QMI_DMS_SET_EVENT, param, + set_event_cb, sim, NULL)) { + qmi_param_free(param); + qmi_service_free(dms); + return -EIO; + } data = l_new(struct sim_data, 1); + data->dms = dms; for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++) data->retries[i] = -1; - ofono_sim_set_data(sim, data); + qmi_service_register(dms, QMI_DMS_EVENT, event_notify, sim, NULL); - qmi_service_create_shared(device, QMI_SERVICE_DMS, - create_dms_cb, sim, NULL); + ofono_sim_set_data(sim, data); return 0; } @@ -360,13 +337,7 @@ static void qmi_sim_remove(struct ofono_sim *sim) ofono_sim_set_data(sim, NULL); - if (data->event_indication_id) { - qmi_service_unregister(data->dms, data->event_indication_id); - data->event_indication_id = 0; - } - qmi_service_free(data->dms); - l_free(data); } diff --git a/plugins/gobi.c b/plugins/gobi.c index 1a31e7a2b17d..b0f5896808fa 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -721,22 +721,17 @@ static void gobi_set_online(struct ofono_modem *modem, ofono_bool_t online, static void gobi_pre_sim(struct ofono_modem *modem) { struct gobi_data *data = ofono_modem_get_data(modem); - const char *sim_driver = NULL; + bool legacy = ofono_modem_get_boolean(modem, "ForceSimLegacy"); DBG("%p", modem); ofono_devinfo_create(modem, 0, "qmimodem", qmi_service_clone(data->dms)); - if (data->features & GOBI_UIM) - sim_driver = "qmimodem"; - else if (data->features & GOBI_DMS) - sim_driver = "qmimodem_legacy"; - - if (ofono_modem_get_boolean(modem, "ForceSimLegacy")) - sim_driver = "qmimodem_legacy"; - - if (sim_driver) - ofono_sim_create(modem, 0, sim_driver, data->device); + if ((data->features & GOBI_UIM) && !legacy) + ofono_sim_create(modem, 0, "qmimodem", data->device); + else /* DMS always availalable */ + ofono_sim_create(modem, 0, "qmimodem_legacy", + qmi_service_clone(data->dms)); if (data->features & GOBI_VOICE) ofono_voicecall_create(modem, 0, "qmimodem", data->device); From patchwork Fri Jun 7 22:47:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690706 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB8CF155390 for ; Fri, 7 Jun 2024 22:47:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800478; cv=none; b=PtB+PEnChbMrc6kPRVHwm6cKSl/+rahfJej0B6lDEx+VRErR8FzbNmLlYXiRDiGNFcH0AkE54fnJVvG7IP53wHiPKOPoGMNsAdvubqwj+v5Mf1TvlKznsZQKLq0Gb4GaJemebylymc4tqzV9AJOq2jZx50z1YzYzVPkYsi7+W5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800478; c=relaxed/simple; bh=Q4v42DWk3zs6/1Xp/vW5eCm/gKCMlhiw9BrSh9PtKeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VyUNoN6kggH/HfWPuH7ZUszHhGeO+EmKogRJhd8PfwJgPHcUazUSE1Oq9Q2QX6NDnav3YIJkiBMGDqbky//V+nou39ndnM9rl8z257KHYK/0PLXtlRA0dvIxAKAR3z7GQGuDMIeCQHuY0aSFJmneKfYAQei2iky4Y+Ytzh6qEOo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QR30BBMs; arc=none smtp.client-ip=209.85.161.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QR30BBMs" Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5b2ed25b337so1455839eaf.0 for ; Fri, 07 Jun 2024 15:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800476; x=1718405276; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r/MNp1wb5bxCxXz+a6Gdiuhxij2mnQflLXQ9Ai4DDBw=; b=QR30BBMs7lw9AFae72v9SzCTDCUEixiA49zdMg/ncOInkwgpbp8tD6i28gbLmBI48r ApOptMGKN9P6qkWQwqvUBnL20jOopO0qgAEdogrARnk/1gvxnPQHrxNWaA2E+DZdeUAU lvNAIPKkWc8R8ZQV/XG481LPW7YzLUxZlufXhnJizL3D3x1Bl0XOrUdGb1hHbAHEIDRQ Ltzza7ugi3pTrpFXLwgxKv6NJUFXpJXuxzEHcnrYR3uIrYCm/IUKzuSgOJuZe+vl20bD ZpgYt8MNygabslp4R+sOsdSyvoREj13s8i3fGsdbaSDMzIgK+nsdP5rtdjXo6AKZajOF TW+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800476; x=1718405276; h=content-transfer-encoding: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=r/MNp1wb5bxCxXz+a6Gdiuhxij2mnQflLXQ9Ai4DDBw=; b=jbTbA30g+/mJvIHwHD+QVJ6LMO0DElr09Bk+fvluBnW0HvS0zERV4cIc34IkXAtoWr loYjMOWMou0iTJtQjxnAgNXTFCC82feuAdzzPJZY8SF5zvq1l7VtzRJScZtEDa/KEGMx +uGmtbYLkQKUZHLSgvsxiwXVdBCDv/43Le1NoZNVR8qeNyb7LtyOkD0I0/faKnJGxezd ZHe6gdSDYf553B2wOMtKBRyPDn96+md5DY0bpRogqVgRmRbT6Vj+h9iyMCF4pT8FfmGy /XP30hoO9Z3edBOAQ14Id1GVoIAuGFSeFIm8Jv15bUQloEO43TGMjtznE9CERDPZ1kf5 zuVA== X-Gm-Message-State: AOJu0YybJa55kpKOeUoDMwTNcI+xer0IUbST2jB5CeRnvk5IvmkaoZiO wBUfdZ5na7NdJFirczttaFLv4TouwLeO108cY1id/PJeUSlbs8bWGylYOg== X-Google-Smtp-Source: AGHT+IFAC56YYxtVEcWgR0BhEhSp25Yeq+TAAtPPHUZ6gn5PJTry1WDRdfRkchLH/wTEVCMJIv0eew== X-Received: by 2002:a05:6820:2296:b0:5b9:d8ab:2e35 with SMTP id 006d021491bc7-5baae7572b1mr3584285eaf.5.1717800475791; Fri, 07 Jun 2024 15:47:55 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:55 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 10/23] qmi: voicecall: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:10 -0500 Message-ID: <20240607224746.903769-10-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/voicecall.c | 40 ++++++++---------------------------- plugins/gobi.c | 3 ++- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/drivers/qmimodem/voicecall.c b/drivers/qmimodem/voicecall.c index 6af85caa840a..c7a5230f9680 100644 --- a/drivers/qmimodem/voicecall.c +++ b/drivers/qmimodem/voicecall.c @@ -709,48 +709,24 @@ static void send_dtmf(struct ofono_voicecall *vc, const char *dtmf, send_one_dtmf(vc, *dtmf, send_one_dtmf_cb, vd); } -static void create_voice_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_voicecall *vc = user_data; - struct voicecall_data *data = ofono_voicecall_get_data(vc); - - DBG(""); - - if (!service) { - ofono_error("Failed to request Voice service"); - ofono_voicecall_remove(vc); - return; - } - - if (!qmi_service_get_version(service, &data->major, &data->minor)) { - ofono_error("Failed to get Voice service version"); - ofono_voicecall_remove(vc); - return; - } - - data->voice = service; - - qmi_service_register(data->voice, QMI_VOICE_ALL_CALL_STATUS_IND, - all_call_status_ind, vc, NULL); - - ofono_voicecall_register(vc); -} - static int qmi_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor, void *user_data) { - struct qmi_device *device = user_data; + struct qmi_service *voice = user_data; struct voicecall_data *data; DBG(""); data = l_new(struct voicecall_data, 1); + data->voice = voice; data->call_list = l_queue_new(); - ofono_voicecall_set_data(vc, data); + qmi_service_get_version(data->voice, &data->major, &data->minor); + + qmi_service_register(data->voice, QMI_VOICE_ALL_CALL_STATUS_IND, + all_call_status_ind, vc, NULL); - qmi_service_create_shared(device, QMI_SERVICE_VOICE, - create_voice_cb, vc, NULL); + ofono_voicecall_set_data(vc, data); return 0; } @@ -764,13 +740,13 @@ static void qmi_voicecall_remove(struct ofono_voicecall *vc) ofono_voicecall_set_data(vc, NULL); qmi_service_free(data->voice); - l_queue_destroy(data->call_list, l_free); l_free(data->full_dtmf); l_free(data); } static const struct ofono_voicecall_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = qmi_voicecall_probe, .remove = qmi_voicecall_remove, .dial = dial, diff --git a/plugins/gobi.c b/plugins/gobi.c index b0f5896808fa..f81fb8243bf8 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -734,7 +734,8 @@ static void gobi_pre_sim(struct ofono_modem *modem) qmi_service_clone(data->dms)); if (data->features & GOBI_VOICE) - ofono_voicecall_create(modem, 0, "qmimodem", data->device); + ofono_voicecall_create(modem, 0, "qmimodem", + qmi_service_clone(data->voice)); if (data->features & GOBI_PDS) ofono_location_reporting_create(modem, 0, "qmimodem", From patchwork Fri Jun 7 22:47:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690707 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08F841553A6 for ; Fri, 7 Jun 2024 22:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800479; cv=none; b=uSMbLCOnSBZvuuvS1h2MpOk9GpIHTlpCIGZk1DPhCVa0UYGjp1Qswy2zm8dUya5W0aP/1VDRqsJl9gMNV6Vu/ksuy7Jv/yUFXwDQ7ZN/Q1raJLyJu6Lwsfrfl2MEm3NZ3m5GIJ0Ms/ozdjNwvBEpE6wcjF1TWIaXy9CZyUb8Fbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800479; c=relaxed/simple; bh=+mCCg2JDyv1dxn4CSJ/k7Jv3gcLtJLqcn7eoEFlrnGQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XWFhZho5Fx7yVd3XoUcMqPmxZ2wpRWf1DlIdCDiR2BRcP8ypfFNEkrKyVar/CEDPDv2D0RRjqnjtWuzmI9FqN25D2tPX4BaJFxZ9Ul3wWOVZw1E8VzYEG/z5TEjUwjnUlfYsMOeiCx9IlEMLbNZsSfAkFX3v1ueBUwH72JbuQAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dt7LMVaV; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dt7LMVaV" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c9cc681ee7so1051081b6e.1 for ; Fri, 07 Jun 2024 15:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800477; x=1718405277; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VD5FsEpnpFUnveyu9tmrPSXCDTwYqAAmo87emNrQQQk=; b=dt7LMVaVuTcEV+781MhiB2rocJdnKj4H3Sfp62acEIoSxcj4KvoXLCyX7RXObWymX7 FvqSJMCm/5C65tlF1WcKvAJLXrONwPrOO8c8Pp6MO/hKOBRr6NOfI4Q9ozK7q0KOwE8o gG02UbAvcOz2NyAeOIGgLuOBo++VC8NUx8rXWVM/pbXD25579+aY4nUrRP5MnK3NNEPC ga36MEyCtUeYvlCOCPLmcLeOfWfU/55APNrmdCTY82VbVxtSPASaNXPQXcw1++TE7jmD 0pJafS3eiJ8H+nbDalPimuKqNsjfRGOmAjbTBHioIczeF+75mf6CIJKTkZF2/OEqKaXE yG9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800477; x=1718405277; h=content-transfer-encoding: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=VD5FsEpnpFUnveyu9tmrPSXCDTwYqAAmo87emNrQQQk=; b=TZDsEDWGXlIzAaKk7rhShbDwDAlxaw4ofL6T25wf71QRhWS4tcux6B/vDRkO/MaoTx JTne0Z/4o6kRJpNzUgZgcQyJbBP8yHGlSCwFS2bXqApNUC/rB7ifRcOujBk4/OwCDwCj UaShxpTFexu55XqHZ2/PrtCh8tqBxFFjErVu79qP/BmBTVDtFI8RKyDwG/THyCKFcO/d 2e062HSOh7lEkd6RlHSdRVaqMxp0Te49e+lYHbvvQ5TCB8y4QBBPJEwS3/JYevEneT+0 8h2zikLFDc2aM5beLX0ktYarveYScRUzZycrk90VEMEsGN9+y40AfegrPBf4fvyjssEo 8fRw== X-Gm-Message-State: AOJu0YyZ0P8sIfwrgJrmrVbnbKTOBYb0A21FsQ6fek6dhoBcqX0cI1TJ rj54QkImjiCTKJ6wufoFpIGemv45xyUZiymTCcdG4JxUb7CKAQYZe8bQ9w== X-Google-Smtp-Source: AGHT+IGDvjhQhI6C5odXExCcw55h4NvRwZ/BTRfQ4AtW80YAqfl/dnrLSMbY209CPqPfFGjYwMBARQ== X-Received: by 2002:a05:6808:1694:b0:3c9:9e8e:52f3 with SMTP id 5614622812f47-3d209bac258mr3270810b6e.17.1717800476888; Fri, 07 Jun 2024 15:47:56 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:56 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 11/23] qmi: call-barring: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:11 -0500 Message-ID: <20240607224746.903769-11-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/call-barring.c | 29 ++++------------------------- plugins/gobi.c | 3 ++- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/drivers/qmimodem/call-barring.c b/drivers/qmimodem/call-barring.c index 2209b4049c13..8da805cfe6ca 100644 --- a/drivers/qmimodem/call-barring.c +++ b/drivers/qmimodem/call-barring.c @@ -190,39 +190,19 @@ error: CALLBACK_WITH_FAILURE(cb, data); } -static void create_voice_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_call_barring *barr = user_data; - struct call_barring_data *bd = ofono_call_barring_get_data(barr); - - DBG(""); - - if (!service) { - ofono_error("Failed to request Voice service"); - ofono_call_barring_remove(barr); - return; - } - - bd->voice = service; - - ofono_call_barring_register(barr); -} - static int qmi_call_barring_probe(struct ofono_call_barring *barr, unsigned int vendor, void *user_data) { - struct qmi_device *device = user_data; + struct qmi_service *voice = user_data; struct call_barring_data *bd; DBG(""); bd = l_new(struct call_barring_data, 1); + bd->voice = voice; ofono_call_barring_set_data(barr, bd); - qmi_service_create_shared(device, QMI_SERVICE_VOICE, - create_voice_cb, barr, NULL); - return 0; } @@ -234,13 +214,12 @@ static void qmi_call_barring_remove(struct ofono_call_barring *barr) ofono_call_barring_set_data(barr, NULL); - if (bd->voice) - qmi_service_free(bd->voice); - + qmi_service_free(bd->voice); l_free(bd); } static const struct ofono_call_barring_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = qmi_call_barring_probe, .remove = qmi_call_barring_remove, .set = qmi_set, diff --git a/plugins/gobi.c b/plugins/gobi.c index f81fb8243bf8..1688d5478d59 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -847,7 +847,8 @@ static void gobi_post_online(struct ofono_modem *modem) if (data->features & GOBI_VOICE) { ofono_ussd_create(modem, 0, "qmimodem", data->device); ofono_call_settings_create(modem, 0, "qmimodem", data->device); - ofono_call_barring_create(modem, 0, "qmimodem", data->device); + ofono_call_barring_create(modem, 0, "qmimodem", + qmi_service_clone(data->voice)); ofono_call_forwarding_create(modem, 0, "qmimodem", data->device); } From patchwork Fri Jun 7 22:47:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690708 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4961C1553A6 for ; Fri, 7 Jun 2024 22:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800481; cv=none; b=fIYnduMdY+YYmGWHSiSi+4+rX8T48OjX31M/lc4rY7lCKMHIpsNglbCUcAn8bR3UqDarZ8WAbZVj0NK6WF1Sk4pgulztGU+ikrybNNYkSXwcOutore3sxP3fOqI0ADzAczBy5C7hfFSWYnjr/uJL6eXHr/4hcpjt56wTlJdx+5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800481; c=relaxed/simple; bh=iKy9R28icw+U7LEPrqe8aDb4tRGC/IUXmWKTva9Eu/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mnBprmeBZihAuK6gUp6StWxAVtw3W02gJoDjvTucVWA63ZyZGoIb5A0NP8ayhiPduR5nRl+2C5oGSyp25k8HBlJTBbUWy4cLIujVCwBHrf5iF/S/eJ100H6FjDLxijKbCVm+qw6rnIjfrp+4ZiIcuUftMFTUC0PCsLTcU7DIo/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PtR5sSCk; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PtR5sSCk" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5b9778bb7c8so1398033eaf.3 for ; Fri, 07 Jun 2024 15:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800479; x=1718405279; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9fRRhZG6wipDEWz7aRdDtPXrNzxjOff4i1UJVqh+B4I=; b=PtR5sSCkuUq0RRv34DZjrMPdCnLzkr1ctozKttOw634WXvfEMgnJlSB3dg8KmjuM3m LdbPBSY+JrWl8Lj4P2CDsBxwYtQEFtFrUfkhyS4g997YLmBn93/q1TZR/b5j9OVRioJk GaGuqzzO160KaBA+mi3WpVE5+eusM49hfGEcyPrIxiZkmj58Ay9o0mngHCsTQHjlqQ44 EpXDdv8n9Pmnmmhqd5bmXkMC0dA1jc8/Ajy7P7SwbWmYhhoXkKDwmvyJbPde7npHGqr2 Q0Qpy/GoiaofLS79ppi1rNoK7HYz5K1atihr7lZVjXVFIEANoZj5aU4O74YCPOy5BrYP PxXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800479; x=1718405279; h=content-transfer-encoding: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=9fRRhZG6wipDEWz7aRdDtPXrNzxjOff4i1UJVqh+B4I=; b=CUqr5J20dw4nxteHwok1bwVu42tciuxo/UPsHR8mi8kUqwfuEgdt1lEoqFWJgqgH8A Ly2lvnXsp4au2CKK0WhjnEfgIIO2RJ9zk+HgX4YruNjzaIlIJZ1lH5gvF+rONnUAsXdX j0w4S8M9ox0dWAJiZGkTtIW4RlTC5LEhdANUUS0APGY9CLLJ2CmgX1qu0kO2EYlrUMRb iwQVTAJxUL6wAX1JqRheOdba0rIGbGLYo5kHbNg/5tCZwyKAz6d0b+ngyKKpBoY48PW6 HGNS5e+uL1lKyi5ZtO3LZRnrXbtQNn0pSNMbFH+jRLNXlPsVFUkj1h19pZQsxWwr/hng HsOA== X-Gm-Message-State: AOJu0YzDHyOqwdHpPUBEnvypINgDzxUGz1DykbIijtzys47rr7o0U+Rw 2y0F2XSjL54IFVvhOOL18BGEZrokxGxTlWWSdQRN9FgSSPjQvuN7cnEraA== X-Google-Smtp-Source: AGHT+IERux48+31oBf2Kg3GvXxLRdQW5pyuZyl1ybVxksbyU+5bxXpVt9Z+Qnl74H+q8GN9VVaa40A== X-Received: by 2002:a05:6820:1ad3:b0:5b7:3502:653c with SMTP id 006d021491bc7-5baae75722fmr4590250eaf.4.1717800479071; Fri, 07 Jun 2024 15:47:59 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:57 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 12/23] qmi: call-forwarding: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:12 -0500 Message-ID: <20240607224746.903769-12-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/call-forwarding.c | 29 ++++------------------------- plugins/gobi.c | 2 +- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/drivers/qmimodem/call-forwarding.c b/drivers/qmimodem/call-forwarding.c index 191f3db75645..e7ae35153b09 100644 --- a/drivers/qmimodem/call-forwarding.c +++ b/drivers/qmimodem/call-forwarding.c @@ -276,39 +276,19 @@ static void qmi_erase(struct ofono_call_forwarding *cf, int type, int cls, qmi_set(cf, type, cls, QMI_VOICE_SS_ACTION_ERASE, cb, data); } -static void create_voice_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_call_forwarding *cf = user_data; - struct call_forwarding_data *cfd = ofono_call_forwarding_get_data(cf); - - DBG(""); - - if (!service) { - ofono_error("Failed to request Voice service"); - ofono_call_forwarding_remove(cf); - return; - } - - cfd->voice = service; - - ofono_call_forwarding_register(cf); -} - static int qmi_call_forwarding_probe(struct ofono_call_forwarding *cf, unsigned int vendor, void *user_data) { - struct qmi_device *device = user_data; + struct qmi_service *voice = user_data; struct call_forwarding_data *cfd; DBG(""); cfd = l_new(struct call_forwarding_data, 1); + cfd->voice = voice; ofono_call_forwarding_set_data(cf, cfd); - qmi_service_create_shared(device, QMI_SERVICE_VOICE, - create_voice_cb, cf, NULL); - return 0; } @@ -320,13 +300,12 @@ static void qmi_call_forwarding_remove(struct ofono_call_forwarding *cf) ofono_call_forwarding_set_data(cf, NULL); - if (cfd->voice) - qmi_service_free(cfd->voice); - + qmi_service_free(cfd->voice); l_free(cfd); } static const struct ofono_call_forwarding_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = qmi_call_forwarding_probe, .remove = qmi_call_forwarding_remove, .registration = qmi_register, diff --git a/plugins/gobi.c b/plugins/gobi.c index 1688d5478d59..ff6d7553f851 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -850,7 +850,7 @@ static void gobi_post_online(struct ofono_modem *modem) ofono_call_barring_create(modem, 0, "qmimodem", qmi_service_clone(data->voice)); ofono_call_forwarding_create(modem, 0, "qmimodem", - data->device); + qmi_service_clone(data->voice)); } } From patchwork Fri Jun 7 22:47:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690709 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7A8D155727 for ; Fri, 7 Jun 2024 22:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800482; cv=none; b=tw74dIeXjLf7vn3IxuxdoZyhUdYgpJj8wdfwXEdhDxTIjwwmBnnABIUWuPqytLwdFh+h2Bjk1evgThdfiptxLB4jBpTa9eu1V9q8WgQvFmKhfxrBTyVKiPXvrUmhUlcjgTyhAlM5kWtOWfCRW8NjujWVZZb5T/CQcL4YgKh5nME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800482; c=relaxed/simple; bh=siDrpa8gm1awcmj0KzuO2o9KW04FpcbJUO5VklwRVTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MFlzpal+MDR+1o1iBu82ef8xuLAq7PIFzlkZHGVO5JS7aRHveJsC9nYHEmGxDdSLYzSmu2aA4P1EvNcOF4OnQqWloZ+8zYCffpTH/+yq/OSJbiZpOu6da84Rc1ZIJi45hdXWUd8X6v0uYGxO93GJ3uPJ7DXMIcFe6z3EcXDepqU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U276phjs; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U276phjs" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5b5254f9c32so1378034eaf.0 for ; Fri, 07 Jun 2024 15:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800480; x=1718405280; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bewc5clYHNOPtiyuKgcU7HWxVqdgFmxIy8K/Qr06ngI=; b=U276phjsgxKGashS+xp4zyZoGiyzVycQ9TWm/kogFKuYmC7exwpER9S8rEyfuWGaoD ptPX2tppbMkSJec9wGHMDzXc6HDUDmWNnrTZm5Yc4rGbrbHUftJHkdYHCWxelCXty+oi Usdvw0ENxJaKpf9BaI1DbZsId4WVIcsg84Rr2Dlu5P1AtSHJw885mfEx5oF5XgXMdph7 lBiAbIAJWJVPM73+Xfxe68YdRNlyhohvTxpjyvfeHmnN8w1fCKi2nS7i+JrQ+FQf/TJN PD2WZrvASkI3DK0XpMFi47cHoGtfqI+TlWbvRraXD9oGrZ6sq6LpkTV/rbqk4WRwOeuB ZkEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800480; x=1718405280; h=content-transfer-encoding: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=Bewc5clYHNOPtiyuKgcU7HWxVqdgFmxIy8K/Qr06ngI=; b=aDYl3T6iRjA6hT2XTYODUQnfKIhf3AOvqKNn8vzBRhKj3yme/K0jXR8as8P8Pd7luu d0ovrijnoWmNyb8TokJ7GMEAikC1TM3aV3HRDJNzGVED+Ih3DxGcwrzrwlaAOYBLXUKg Sm7Ha37UBhAyktbqdrvewyBYaq6mV2M3Wngb/b5wvCxLhlyXyLfC7PhT0Rz29x9Ktaak 4jkKb5JkiqYzsPeYSn/eHwL6j7goU8dkJpBtIPu95gIUBi7K60/8Av2QW5Fu+X+C2jaX +nrCpD3zqdcLiF2m1NdttQKZlxAVSlY4/ixqYhyyQswzM/WJCJJbuOmF9Q6/vVujapSa Y7Bw== X-Gm-Message-State: AOJu0YyEWWiMmIwjLdz/QbUcjpbJ/7PN5aXNjoGoIQafcR8wNBhf0/IU LwBHhPPrrZwki40SsdZwZ7c3tWSIBa6SsH7MPdbsu28dSfNf/H7EpvwQrg== X-Google-Smtp-Source: AGHT+IG8Y/SwqMW5UmwMxslLt51I3tzDYAFyG/ORqNHiKjILZJXCHi9hICZrslgHu/ZET4xJUXgUhQ== X-Received: by 2002:a05:6820:1504:b0:5b9:de1d:38ef with SMTP id 006d021491bc7-5baae89c539mr3762756eaf.9.1717800479805; Fri, 07 Jun 2024 15:47:59 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:47:59 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 13/23] qmi: call-settings: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:13 -0500 Message-ID: <20240607224746.903769-13-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 While here, drop 'sups_ind_id' member. Explicitly unregistering from a an indication is not required. All indication registrations will be automatically dropped when the service handle is freed using qmi_service_free() --- drivers/qmimodem/call-settings.c | 37 ++++++-------------------------- plugins/gobi.c | 3 ++- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/drivers/qmimodem/call-settings.c b/drivers/qmimodem/call-settings.c index 676b39aaf487..3611c98894a0 100644 --- a/drivers/qmimodem/call-settings.c +++ b/drivers/qmimodem/call-settings.c @@ -21,7 +21,6 @@ struct call_settings_data { struct qmi_service *voice; - uint16_t sups_ind_id; }; static void query_status(struct ofono_call_settings *cs, uint16_t message, @@ -262,41 +261,20 @@ static void sups_ind(struct qmi_result *result, void *user_data) clip->active, clip->provisioned); } -static void create_voice_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_call_settings *cs = user_data; - struct call_settings_data *csd = ofono_call_settings_get_data(cs); - - DBG(""); - - if (!service) { - ofono_error("Failed to request Voice service"); - ofono_call_settings_remove(cs); - return; - } - - csd->voice = service; - - csd->sups_ind_id = qmi_service_register(csd->voice, QMI_VOICE_SUPS_IND, - sups_ind, cs, NULL); - - ofono_call_settings_register(cs); -} - static int qmi_call_settings_probe(struct ofono_call_settings *cs, unsigned int vendor, void *user_data) { - struct qmi_device *device = user_data; + struct qmi_service *voice = user_data; struct call_settings_data *csd; DBG(""); csd = l_new(struct call_settings_data, 1); + csd->voice = voice; - ofono_call_settings_set_data(cs, csd); + qmi_service_register(csd->voice, QMI_VOICE_SUPS_IND, sups_ind, cs, NULL); - qmi_service_create_shared(device, QMI_SERVICE_VOICE, - create_voice_cb, cs, NULL); + ofono_call_settings_set_data(cs, csd); return 0; } @@ -309,15 +287,12 @@ static void qmi_call_settings_remove(struct ofono_call_settings *cs) ofono_call_settings_set_data(cs, NULL); - if (csd->voice) { - qmi_service_unregister(csd->voice, csd->sups_ind_id); - qmi_service_free(csd->voice); - } - + qmi_service_free(csd->voice); l_free(csd); } static const struct ofono_call_settings_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = qmi_call_settings_probe, .remove = qmi_call_settings_remove, .clip_query = qmi_clip_query, diff --git a/plugins/gobi.c b/plugins/gobi.c index ff6d7553f851..4de5a915ba54 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -846,7 +846,8 @@ static void gobi_post_online(struct ofono_modem *modem) if (data->features & GOBI_VOICE) { ofono_ussd_create(modem, 0, "qmimodem", data->device); - ofono_call_settings_create(modem, 0, "qmimodem", data->device); + ofono_call_settings_create(modem, 0, "qmimodem", + qmi_service_clone(data->voice)); ofono_call_barring_create(modem, 0, "qmimodem", qmi_service_clone(data->voice)); ofono_call_forwarding_create(modem, 0, "qmimodem", From patchwork Fri Jun 7 22:47:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690710 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62C381553AB for ; Fri, 7 Jun 2024 22:48:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800482; cv=none; b=pL0QNKQCugVYw4B+GEIVSSgYRSq7qhaFgbyQcxlmy7ljyF/0ukW2nBKDJvcQ1XRhj81GWG8fUVJyxYystX0PtPRfhYpa6iAcql4w4np7heCKibqVbcy8tJOuHkz95JcR37umCDtd1M9NF4A5o3RfAM70p8KGwkhaowKCZl5EIQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800482; c=relaxed/simple; bh=a5dc1W2R1a2IQ7RHphV/WlyZIPj8nXBrDlutdfs1d74=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NTS7QzWPEzBjO521YWM1dnJb25DBK0agy5KhGwUawcpWE72ovbRLd/Jl0omXiSCy6jyvZ918i0BdiA7gwx1L/9WHIRvW0SOgJxoRh5fSFp5eC8PodT5r8R0O5KD0WABgJybfcFBpFmbIegEvPQiotV8ZkqVPIyBh/p2VyrBAjLs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UuzqtqIX; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UuzqtqIX" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5b9778bb7c8so1398038eaf.3 for ; Fri, 07 Jun 2024 15:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800480; x=1718405280; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AyCIJnKyJpsGX4yoOyn1EbxkSavVDJBHh4nu2HBbiJw=; b=UuzqtqIXz6j7O7ZGRs7f69RhUFE2N4exOBxXgP76vcAdqpjhGSMLdItlFyIJOVlw6m WbXnQCnWPkNremx7GdGZGF61LY5D5Ws895ThSdWKgnowIpILrEyaz+KI1Ir6KVuxYjiP UPVgYz4Oj9a68GDxKqA/sbabtEro5PKIxQiQbsSDpC7SmY9Ep/SODNmHi40CTpJWn8OZ Ca2BV+hguW9TzMJJMfXLGn64yvLs/dYmsQhhhDgUUu5hqSxpFw88emiYFCaALjX6Guil GyXcZ+RQTBWrH3EZbWii2GMYlmyI3Xn7DLoFRLSgQDYRxV9sKdrckZyWJasiwM7K+dJ8 vYjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800480; x=1718405280; h=content-transfer-encoding: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=AyCIJnKyJpsGX4yoOyn1EbxkSavVDJBHh4nu2HBbiJw=; b=RyRsncoUzPFi7qLBGIKdZz8IQ+Bo+YpvkVBGIlnpO87eH0cgdr7VHyzDkrMol5jsaH ohsqalYg2jG8KN8jeMORQdvg3Xd1pWa7gUsJ30Rk8HHZd9LiPoPXJRWGFSm0wGLvQzd1 bDHRlAbv7rB1nudOXJF/Pyo74ysW5OMcczmfscmLgDjGbqd0Fj7PkJTV9eUFp5C0mJw8 0/NC0bhiy+1nQ+Luh1bX1fMbk6YM18fKsnI0Y4vzydxB/EUKH+zH6yZqmVQtQPCvird9 Gql6t2puA9v5C+6AlJEP+/XsqERijMYeOH2UVODOOJcHyVdskiir296ZUMFBycSrWL96 VzTQ== X-Gm-Message-State: AOJu0YzAT/CRXKFETkUhzIY3t0CKE+6VoaD2o9c2qjMZ8sXGG6h1zeSj AYj4ABbqru1SYld4XfDBEv/NJgv0ClC0R21BqIYSf3Ud6AW0ZHzfHxcSYg== X-Google-Smtp-Source: AGHT+IHcEtunRIRo3LC/ZE9JwyLMjMyXh26ZmBB9I3u4Uo9C+tcNd9uO08qgen2mthFIFv4wOGugAg== X-Received: by 2002:a05:6820:54f:b0:5ba:43ec:eb81 with SMTP id 006d021491bc7-5baae877527mr3855393eaf.7.1717800480475; Fri, 07 Jun 2024 15:48:00 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:00 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 14/23] qmi: ussd: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:14 -0500 Message-ID: <20240607224746.903769-14-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/ussd.c | 41 ++++++++--------------------------------- plugins/gobi.c | 3 ++- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/drivers/qmimodem/ussd.c b/drivers/qmimodem/ussd.c index ec9b60ff1222..6637ae759c55 100644 --- a/drivers/qmimodem/ussd.c +++ b/drivers/qmimodem/ussd.c @@ -145,51 +145,26 @@ error: ofono_ussd_notify(ussd, OFONO_USSD_STATUS_TERMINATED, 0, NULL, 0); } -static void create_voice_cb(struct qmi_service *service, void *user_data) +static int qmi_ussd_probe(struct ofono_ussd *ussd, + unsigned int vendor, void *user_data) { - struct ofono_ussd *ussd = user_data; - struct ussd_data *data = ofono_ussd_get_data(ussd); + struct qmi_service *voice = user_data; + struct ussd_data *data; DBG(""); - if (service == NULL) { - ofono_error("Failed to request Voice service"); - ofono_ussd_remove(ussd); - return; - } - - if (!qmi_service_get_version(service, &data->major, &data->minor)) { - ofono_error("Failed to get Voice service version"); - ofono_ussd_remove(ussd); - return; - } - - data->voice = service; + data = l_new(struct ussd_data, 1); + data->voice = voice; + qmi_service_get_version(data->voice, &data->major, &data->minor); qmi_service_register(data->voice, QMI_VOICE_USSD_IND, async_ind, ussd, NULL); - qmi_service_register(data->voice, QMI_VOICE_ASYNC_ORIG_USSD, async_orig_ind, ussd, NULL); - ofono_ussd_register(ussd); -} - -static int qmi_ussd_probe(struct ofono_ussd *ussd, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; - struct ussd_data *data; - - DBG(""); - - data = l_new(struct ussd_data, 1); ofono_ussd_set_data(ussd, data); - qmi_service_create_shared(device, QMI_SERVICE_VOICE, - create_voice_cb, ussd, NULL); - return 0; } @@ -202,7 +177,6 @@ static void qmi_ussd_remove(struct ofono_ussd *ussd) ofono_ussd_set_data(ussd, NULL); qmi_service_free(data->voice); - l_free(data); } @@ -298,6 +272,7 @@ error: } static const struct ofono_ussd_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = qmi_ussd_probe, .remove = qmi_ussd_remove, .request = qmi_ussd_request, diff --git a/plugins/gobi.c b/plugins/gobi.c index 4de5a915ba54..6dee928acdea 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -845,7 +845,8 @@ static void gobi_post_online(struct ofono_modem *modem) } if (data->features & GOBI_VOICE) { - ofono_ussd_create(modem, 0, "qmimodem", data->device); + ofono_ussd_create(modem, 0, "qmimodem", + qmi_service_clone(data->voice)); ofono_call_settings_create(modem, 0, "qmimodem", qmi_service_clone(data->voice)); ofono_call_barring_create(modem, 0, "qmimodem", From patchwork Fri Jun 7 22:47:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690711 Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76151155737 for ; Fri, 7 Jun 2024 22:48:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800483; cv=none; b=s55WlFQwvJsVi3F2Z/V44byn/TI0zV7ajeR4o20mBd/JoS4FjFifJR+XCp9v+n2v5U85ea+JCx6Lv3Aybkk4SlHjFxIRcW5vmen0VgaPOfEdYKgewLtfqnadgAX+w5cOCGKaQuhEAVSVKxpLd/kQfblN3k5B7tU9Z560GiWNOe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800483; c=relaxed/simple; bh=TmbPi0t6lMR9o6JQl1euLlkz53pHRBKieCjN4fdjjCA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mBjNcml5YG1GGYIOQJzHLWOlgoQo9/tdbOmXtP28sLyhnH576YzaoOOrrto/OyYoV+3TXOQ72Erc8Ny/wdFc7crFkhYqxYVA7mXVHxn2j059uFmz7QAp5IXamUKnCNyvyPe/N3Y9adBtTzNCcB442Dy0lkXMKJJurvfM5dvBTn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e5u0iP8S; arc=none smtp.client-ip=209.85.161.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e5u0iP8S" Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-5b96a95c5e8so1425622eaf.3 for ; Fri, 07 Jun 2024 15:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800481; x=1718405281; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VB3dAwV+rcYkqWccEm3HngtfEkjDrHJbfnxDOIe0LXA=; b=e5u0iP8SXi12+xxebPetvpKphIF/27t2vB7FKq/G6f9b8geFKQUmK2dGejhg4q09f4 o6P9l/jpjaMkVhSxcuOGS1LByXIDNDamhZ9FmKnTfdjlSv6M6yNAbtyIb4ulCdtVClri dAPUJc7MZNoOljBejtVG9N7uX3vqjPiswFLizUw6KVG/Q87o6PKqMS/cGhlegrHLn8h0 Sn0ENDzgpmh5B3vieAqXZOjh7dbLEkuQ5sy22YxvYLwrbASp+b3bCGsQrhbK6wQw2hmy 3h+ViIsOG+f9L0UObEfyaQ01nFhmYa/39lMmHed12UXGDaHtezR3tw2zyceHzBU01wpq K0Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800481; x=1718405281; h=content-transfer-encoding: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=VB3dAwV+rcYkqWccEm3HngtfEkjDrHJbfnxDOIe0LXA=; b=qrjNd9hh4vhcLc9fiKkilb+39DUBd0dxAnYdkX5PU9MSQNmJv/7zn52GgqJbjEnOLK 1z1vppmXQMReosuwfbQ9yha1nylXTugeWPUaxmu/zjBTtlSgVW9blaWkacNSsfwJsQch 1B9QJgp4XIPOEZtyBjDtTkyX9mgNiFEvP0OAuGKixkeM4yjV1Yh7Re6ieGyrMKlFxER3 5fyEL+Mk2ufeIOZNgxaFHp+Mha23i7+gS+SWsCMKGg/8cPbIKPq3G7nIUDcKi/bDG4xl +m2bxtoJg7mUr+nTeZDlgDkwKFhBMeKgPtOI4yCDCvVjfF/naT0rd06m0vrQnc8q+DVk 8PWA== X-Gm-Message-State: AOJu0YyBCYVTqJwrAFSApsFCzK9rLLA9/Xyd1M6jzG08vdStrlPFGER5 PSm9aa+4IPoYoixEGg+FoEJA40Hvunlsb+aLfhfsbqGIE3gM3pFlh0K0Bg== X-Google-Smtp-Source: AGHT+IHfBuI7q1c0S8z//LmR9sawKqG0G0EzwHCcoC5SMtlHHaZ6u0Aaf4XqHUgvyiU+umnBDLpfzA== X-Received: by 2002:a4a:dd83:0:b0:5ba:d272:3223 with SMTP id 006d021491bc7-5bad27232d6mr765142eaf.4.1717800481266; Fri, 07 Jun 2024 15:48:01 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:00 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 15/23] qmi: location-reporting: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:15 -0500 Message-ID: <20240607224746.903769-15-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/location-reporting.c | 50 ++++++++------------------- plugins/gobi.c | 5 ++- 2 files changed, 16 insertions(+), 39 deletions(-) diff --git a/drivers/qmimodem/location-reporting.c b/drivers/qmimodem/location-reporting.c index 669e9e6fdd41..1c9b9c9c3663 100644 --- a/drivers/qmimodem/location-reporting.c +++ b/drivers/qmimodem/location-reporting.c @@ -172,67 +172,46 @@ static void qmi_location_reporting_disable(struct ofono_location_reporting *lr, } static void set_event_cb(struct qmi_result *result, void *user_data) -{ - struct ofono_location_reporting *lr = user_data; - - DBG(""); - - ofono_location_reporting_register(lr); -} - -static void create_pds_cb(struct qmi_service *service, void *user_data) { struct ofono_location_reporting *lr = user_data; struct location_data *data = ofono_location_reporting_get_data(lr); - struct qmi_param *param; DBG(""); - if (!service) { - ofono_error("Failed to request PDS service"); - ofono_location_reporting_remove(lr); - return; - } - - data->pds = service; - qmi_service_register(data->pds, QMI_PDS_EVENT, event_notify, lr, NULL); - qmi_service_register(data->pds, QMI_PDS_STATE_IND, state_notify, lr, NULL); - param = qmi_param_new(); - - qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA, 0x01); - qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA_DEBUG, 0x00); - - if (qmi_service_send(data->pds, QMI_PDS_SET_EVENT, param, - set_event_cb, lr, NULL) > 0) - return; - - qmi_param_free(param); - ofono_location_reporting_register(lr); } static int qmi_location_reporting_probe(struct ofono_location_reporting *lr, unsigned int vendor, void *user_data) { - struct qmi_device *device = user_data; + struct qmi_service *pds = user_data; struct location_data *data; + struct qmi_param *param; DBG(""); - data = l_new(struct location_data, 1); + param = qmi_param_new(); + qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA, 0x01); + qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA_DEBUG, 0x00); + + if (!qmi_service_send(pds, QMI_PDS_SET_EVENT, param, + set_event_cb, lr, NULL)) { + qmi_param_free(param); + qmi_service_free(pds); + return -EIO; + } + data = l_new(struct location_data, 1); + data->pds = pds; data->fd = -1; ofono_location_reporting_set_data(lr, data); - qmi_service_create_shared(device, QMI_SERVICE_PDS, create_pds_cb, lr, - NULL); - return 0; } @@ -245,7 +224,6 @@ static void qmi_location_reporting_remove(struct ofono_location_reporting *lr) ofono_location_reporting_set_data(lr, NULL); qmi_service_free(data->pds); - l_free(data); } diff --git a/plugins/gobi.c b/plugins/gobi.c index 6dee928acdea..f27d6c23e34a 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -737,9 +737,8 @@ static void gobi_pre_sim(struct ofono_modem *modem) ofono_voicecall_create(modem, 0, "qmimodem", qmi_service_clone(data->voice)); - if (data->features & GOBI_PDS) - ofono_location_reporting_create(modem, 0, "qmimodem", - data->device); + if (data->features & GOBI_PDS) /* exclusive use, no need to clone */ + ofono_location_reporting_create(modem, 0, "qmimodem", data->pds); } static void gobi_setup_gprs(struct ofono_modem *modem) From patchwork Fri Jun 7 22:47:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690714 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15A681553AB for ; Fri, 7 Jun 2024 22:48:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800485; cv=none; b=JAjzkmw4jpHX+VnMr67get3xFL45sxnUbidM/rXE1A0+fAvvJnvyYPxvp8Qe2IkQ0Dqt5QDpbqzEMictqs9IqQEk3NW3tEyiJb9V+/hu0Q8zXfyN42T+l73Bhc6dqxGL8aEEULkXPdFkzaqYn5kSq4WD7KJ/YMZva1aLXIZ77U0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800485; c=relaxed/simple; bh=+op+uupI5WOCZV3YJ/eLL9mCHw61ZrwuE5eaBWHdz5E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GKTLMadeINjrfbAvAWfz+LGJ5lNkUxY/SGKiiNrHtEzSMwFBffhSE17u+tNP4T9dWc9s7DcBCIDm+p7LfBzhnNy5ZBDw4/2Ng3o/eZa8TMw6PIKLBRgpmueU6bcvxJIZXVZ8DWfMJJgBU37BM0Wk6/dJCTBVv6prKaS8nu0GAhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QbSB4lfi; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QbSB4lfi" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5b9794dad09so1266883eaf.3 for ; Fri, 07 Jun 2024 15:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800482; x=1718405282; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H/1FS0M3pvKtU7IvsYpFzPw2W2IqT7t5DFSZkI/x9Js=; b=QbSB4lfiZaeXTD0rMbJSn30aogr7rRmMblzPVoXSMwdhe27fVYbcz9Uxvd6qBYKGCT NuUbGsnRc6qQN2AlSMuKJpNRW7fN3kPJ6aqeADYrazqcP6/iu1XsfhL8caGX9Fgxw4AK U9u44lW1bYCBasCyaxIGR3FGgj1UT8golHxrCP10nwk5CEymNf5i67dHMJlD332arfLy ykJ+YjtPsoRAeRgue8RGJHawrEX7zToic2bn8TKzdZNVeh41xaGF1K+lhh0yS/s0SADG PgrUPMzRMQLv+qhIPZmvUCbucgoqgERfBnb1/NdWsLXJ31vpu5oZ+w5prZJ+YFl5E12j P8YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800482; x=1718405282; h=content-transfer-encoding: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=H/1FS0M3pvKtU7IvsYpFzPw2W2IqT7t5DFSZkI/x9Js=; b=lzwUP5hx1S1aJwWnaNiYt24yhiC4ZDncdTTvLXgxoUH10t9SUnPX7iiV18gM2NKX3A msaeCZE8ymqTM4Hx8Yp7lx4ko7rcG3bHSeRh0VeP42k7G2Aii7xBWJzp7QqMovNY9YgI SJqm3ciYVkef/z3ZbqAw+idoPHcOEgVBrNPDrMgDu1BPeX+CTTUBdiRvn7MVgSQxgINa ovvt0rN9niicreStFRZsRVxKONY7OdTupvEhB+i8ZzwjZ0rSDccEjN32oacOy8yjU0ar VHHMQy0VuxwyWrVeRybfwAWa2d08VcbZtUDnwR3u0ArKB9Mmr7H95qGhNKoSpu5Aor6p wGPA== X-Gm-Message-State: AOJu0YyumE4MFCeY1HfCGLIHZ/n3q2BMjMd2hzyY2rXVP8fHR6x+nLa4 LW8GH4GpqC87rd4qPNs5bHEW94zjC0TmLTsa/EniJmDeS1dDPbSsyDNEMw== X-Google-Smtp-Source: AGHT+IG0y2QMsqJ2qI65lW0D38hbJ+/x1iBo3/3K0VVAl+qlxE9NX+tXn/fHZvO1TX2tPDbUcEZQTw== X-Received: by 2002:a05:6820:54f:b0:5ba:6b7c:82af with SMTP id 006d021491bc7-5baae8967a7mr3812776eaf.7.1717800482009; Fri, 07 Jun 2024 15:48:02 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:01 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 16/23] qmi: sms: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:16 -0500 Message-ID: <20240607224746.903769-16-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/sms.c | 56 +++++++++++------------------------------- plugins/gobi.c | 3 ++- 2 files changed, 17 insertions(+), 42 deletions(-) diff --git a/drivers/qmimodem/sms.c b/drivers/qmimodem/sms.c index 65909c6a71f6..4238665a5e8d 100644 --- a/drivers/qmimodem/sms.c +++ b/drivers/qmimodem/sms.c @@ -725,58 +725,33 @@ static void set_event_cb(struct qmi_result *result, void *user_data) ofono_sms_register(sms); } -static void create_wms_cb(struct qmi_service *service, void *user_data) +static int qmi_sms_probe(struct ofono_sms *sms, + unsigned int vendor, void *user_data) { - struct ofono_sms *sms = user_data; - struct sms_data *data = ofono_sms_get_data(sms); + struct qmi_service *wms = user_data; struct qmi_param *param; + struct sms_data *data; DBG(""); - if (!service) { - ofono_error("Failed to request WMS service"); - ofono_sms_remove(sms); - return; - } + param = qmi_param_new_uint8(QMI_WMS_PARAM_NEW_MSG_REPORT, 0x01); - if (!qmi_service_get_version(service, &data->major, &data->minor)) { - ofono_error("Failed to get WMS service version"); - ofono_sms_remove(sms); - return; + if (!qmi_service_send(wms, QMI_WMS_SET_EVENT, param, + set_event_cb, sms, NULL)) { + qmi_param_free(param); + qmi_service_free(wms); + return -EIO; } - data->wms = service; - + data = l_new(struct sms_data, 1); + data->wms = wms; memset(&data->rd_msg_id, 0, sizeof(data->rd_msg_id)); data->msg_mode = QMI_WMS_MESSAGE_MODE_GSMWCDMA; - - qmi_service_register(data->wms, QMI_WMS_EVENT, - event_notify, sms, NULL); - - param = qmi_param_new_uint8(QMI_WMS_PARAM_NEW_MSG_REPORT, 0x01); - - if (qmi_service_send(data->wms, QMI_WMS_SET_EVENT, param, - set_event_cb, sms, NULL) > 0) - return; - - ofono_sms_register(sms); -} - -static int qmi_sms_probe(struct ofono_sms *sms, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; - struct sms_data *data; - - DBG(""); - - data = l_new(struct sms_data, 1); + qmi_service_get_version(data->wms, &data->major, &data->minor); + qmi_service_register(data->wms, QMI_WMS_EVENT, event_notify, sms, NULL); ofono_sms_set_data(sms, data); - qmi_service_create_shared(device, QMI_SERVICE_WMS, create_wms_cb, sms, - NULL); - return 0; } @@ -788,11 +763,10 @@ static void qmi_sms_remove(struct ofono_sms *sms) ofono_sms_set_data(sms, NULL); - qmi_service_free(data->wms); - if (data->msg_list) l_free(data->msg_list); + qmi_service_free(data->wms); l_free(data); } diff --git a/plugins/gobi.c b/plugins/gobi.c index f27d6c23e34a..ce43213a86a1 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -817,7 +817,8 @@ static void gobi_post_sim(struct ofono_modem *modem) ofono_radio_settings_create(modem, 0, "qmimodem", data->device); if (data->features & GOBI_WMS) - ofono_sms_create(modem, 0, "qmimodem", data->device); + ofono_sms_create(modem, 0, "qmimodem", + qmi_service_clone(data->wms)); if ((data->features & GOBI_WMS) && (data->features & GOBI_UIM) && !ofono_modem_get_boolean(modem, "ForceSimLegacy")) { From patchwork Fri Jun 7 22:47:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690712 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E45D2155739 for ; Fri, 7 Jun 2024 22:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800485; cv=none; b=IBuc9Khmzx2NPuk1AwF/WfZ6u5OOy4NNLdIO0n760oVLnc+9q9HvszlvQmAvezwwjPT9uHL/y/F/Zh9m0N7qXQwc00oqKhfe+NxA9ptQAanNra2v/ZTf/9I16wn+p375haFWQkOiGpyMkli+kaFwDtBh29Z5rtlPzQiyms3YGqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800485; c=relaxed/simple; bh=Ag4Dr3TRKxyCd0YUF1cbsz5x4LzgSplw+sy8TzzxOuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tQ7iNwwBa8j+YeIgBkl/JK9Gemmnfxl8rR5cZpFO1yVwyKskOlJWQ/Ir/0UOud0j3Xkdz4C6e2RfqbRNI0jgpBhDzqXJIuBmvDUqbqNsjsVJqUsp1lERUxIU+MzldMOTB1nLlQCbzVTZ/ydQ1S0FvY0hkAdxX7lWnW7N9XLqQXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RMuSOadb; arc=none smtp.client-ip=209.85.161.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RMuSOadb" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5ba1f60eb96so1411789eaf.3 for ; Fri, 07 Jun 2024 15:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800483; x=1718405283; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nm/h3HBvKrpECxnwWyPq33GZzL3flx+/+BpmZcecDTo=; b=RMuSOadbcEvI01D81AkWSEGZhAQiWimgpQgiKj3dC2nUO71VL54viDacB8SI6qsD6H xhbNc9Ya9JNMIXKgTYi+0zQ+u0dZvE/6SM9PPYiWBenzsTV7OPaoUwE3ieyGZcUCzvFN EZ8TW1Xjf6EGNFHIXkbIZmSiqhiFl6PmcIoa5oi63caL0xYBy5XePuNoUcENM9Opma35 /jL1mhUUSvXxBcxFj1AHEkxDhXYtF8oEUNBPIZShY0E3aN+/f0d/u50eVfLIwZcAQWu3 WnplGuPgvnn22E8l9CMBV8eiZF1UB0FmfbSaBwSK/nTYqsLJzu8msMIFJDMuHmHTZkKP pjEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800483; x=1718405283; h=content-transfer-encoding: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=Nm/h3HBvKrpECxnwWyPq33GZzL3flx+/+BpmZcecDTo=; b=FfwLVe/Ypzr20OH2DrwfP5T8QqpAp0lQBhLM98IZL/8Hzmy+ZhmDgIaW+3l1BBbc7p mT4y2pwDi9ICB3qtpBHKhHDkM3jVke764ZBFrUxEfE2IGXTch7zEbjIdbCrSxclWFhOJ popWfiiktCoPVD6FQMqpSv1vjr1iAhkrALvgciIkfpQko9kUFUfVzgvWM2jtGbXiq0tl H84GkCtEhELToUO9QS/3ru/02/DqqQ+sEH01N7B/nQOnXEM8XBv4nJgo5I+tGcZY7cdm +6AzMMh12LYeCoTGux9PB78EGw+wHex/YAxzCH2PN9xNqO9szrfYSmEXECH1uftlp/yL H2fQ== X-Gm-Message-State: AOJu0Yz6azUAXn86wfuX+/mw+LWpS8x46+wh2f+cOpVACQ57wU6qnSgH FZT7+GGJQ5w5Wto8FTw/1/6ezMQmu3uWxDiseq0Ng+frLfJYagdOTanhFA== X-Google-Smtp-Source: AGHT+IFecDAou0XdfT1VCrCUrStctl6xa8oiS2IbxqYlDCV9q4oSV2tk0PQ2BF+2npgyEPagxk5yww== X-Received: by 2002:a05:6820:2211:b0:5b9:f802:ba19 with SMTP id 006d021491bc7-5baae76fb7emr3928514eaf.5.1717800482618; Fri, 07 Jun 2024 15:48:02 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:02 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 17/23] qmi: netreg: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:17 -0500 Message-ID: <20240607224746.903769-17-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 While here, drop all indication registration id members. Explicitly unregistering from an indication is not required. All indication registrations will be automatically dropped when the service handle is freed using qmi_service_free() --- drivers/qmimodem/network-registration.c | 86 +++++-------------------- plugins/gobi.c | 3 +- 2 files changed, 17 insertions(+), 72 deletions(-) diff --git a/drivers/qmimodem/network-registration.c b/drivers/qmimodem/network-registration.c index 78957a677d2d..c0c9338d1c23 100644 --- a/drivers/qmimodem/network-registration.c +++ b/drivers/qmimodem/network-registration.c @@ -31,10 +31,6 @@ struct netreg_data { int lac; int cellid; bool is_roaming; - uint16_t event_indication_id; - uint16_t signal_info_indication_id; - uint16_t system_info_indication_id; - uint16_t serving_system_indication_id; }; enum roaming_status { @@ -587,23 +583,16 @@ static void register_indications_cb(struct qmi_result *result, ofono_netreg_register(netreg); - data->event_indication_id = - qmi_service_register(data->nas, QMI_NAS_EVENT_REPORT, + qmi_service_register(data->nas, QMI_NAS_EVENT_REPORT, event_notify, netreg, NULL); - data->serving_system_indication_id = - qmi_service_register(data->nas, - QMI_NAS_SERVING_SYSTEM_INDICATION, + qmi_service_register(data->nas, QMI_NAS_SERVING_SYSTEM_INDICATION, ss_info_notify, netreg, NULL); - data->system_info_indication_id = - qmi_service_register(data->nas, - QMI_NAS_SYSTEM_INFO_INDICATION, + qmi_service_register(data->nas, QMI_NAS_SYSTEM_INFO_INDICATION, system_info_notify, netreg, NULL); - data->signal_info_indication_id = - qmi_service_register(data->nas, - QMI_NAS_SIGNAL_INFO_INDICATION, + qmi_service_register(data->nas, QMI_NAS_SIGNAL_INFO_INDICATION, signal_info_notify, netreg, NULL); } @@ -636,10 +625,10 @@ error: ofono_netreg_remove(netreg); } -static void create_nas_cb(struct qmi_service *service, void *user_data) +static int qmi_netreg_probe(struct ofono_netreg *netreg, + unsigned int vendor, void *user_data) { - struct ofono_netreg *netreg = user_data; - struct netreg_data *data = ofono_netreg_get_data(netreg); + struct qmi_service *nas = user_data; struct qmi_param *param; static const uint8_t PARAM_REPORT_SIGNAL_STRENGTH = 0x10; static const uint8_t PARAM_REPORT_RF_INFO = 0x11; @@ -650,46 +639,28 @@ static void create_nas_cb(struct qmi_service *service, void *user_data) } __attribute__((__packed__)) ss = { .report = 0x01, .count = 5, .dbm[0] = -55, .dbm[1] = -65, .dbm[2] = -75, .dbm[3] = -85, .dbm[4] = -95 }; + struct netreg_data *data; DBG(""); - if (!service) { - ofono_error("Failed to request NAS service"); - goto error; - } - - data->nas = service; - param = qmi_param_new(); - qmi_param_append(param, PARAM_REPORT_SIGNAL_STRENGTH, sizeof(ss), &ss); qmi_param_append_uint8(param, PARAM_REPORT_RF_INFO, 0x01); - if (qmi_service_send(data->nas, QMI_NAS_SET_EVENT_REPORT, param, - set_event_report_cb, netreg, NULL) > 0) - return; - - qmi_param_free(param); -error: - ofono_netreg_remove(netreg); -} - -static int qmi_netreg_probe(struct ofono_netreg *netreg, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; - struct netreg_data *data; - - DBG(""); + if (!qmi_service_send(nas, QMI_NAS_SET_EVENT_REPORT, param, + set_event_report_cb, netreg, NULL)) { + qmi_param_free(param); + qmi_service_free(nas); + return -EIO; + } data = l_new(struct netreg_data, 1); - + data->nas = nas; data->operator.name[0] = '\0'; data->operator.mcc[0] = '\0'; data->operator.mnc[0] = '\0'; data->operator.status = -1; data->operator.tech = -1; - data->current_rat = QMI_NAS_NETWORK_RAT_NO_CHANGE; data->is_roaming = false; data->lac = -1; @@ -697,9 +668,6 @@ static int qmi_netreg_probe(struct ofono_netreg *netreg, ofono_netreg_set_data(netreg, data); - qmi_service_create_shared(device, QMI_SERVICE_NAS, - create_nas_cb, netreg, NULL); - return 0; } @@ -711,31 +679,7 @@ static void qmi_netreg_remove(struct ofono_netreg *netreg) ofono_netreg_set_data(netreg, NULL); - if (data->event_indication_id) { - qmi_service_unregister(data->nas, data->event_indication_id); - data->event_indication_id = 0; - } - - if (data->serving_system_indication_id) { - qmi_service_unregister(data->nas, - data->serving_system_indication_id); - data->serving_system_indication_id = 0; - } - - if (data->system_info_indication_id) { - qmi_service_unregister(data->nas, - data->system_info_indication_id); - data->system_info_indication_id = 0; - } - - if (data->signal_info_indication_id) { - qmi_service_unregister(data->nas, - data->signal_info_indication_id); - data->signal_info_indication_id = 0; - } - qmi_service_free(data->nas); - l_free(data); } diff --git a/plugins/gobi.c b/plugins/gobi.c index ce43213a86a1..9c0ea4f6bbcc 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -840,7 +840,8 @@ static void gobi_post_online(struct ofono_modem *modem) DBG("%p", modem); if (data->features & GOBI_NAS) { - ofono_netreg_create(modem, 0, "qmimodem", data->device); + ofono_netreg_create(modem, 0, "qmimodem", + qmi_service_clone(data->nas)); ofono_netmon_create(modem, 0, "qmimodem", data->device); } From patchwork Fri Jun 7 22:47:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690713 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 564C815572D for ; Fri, 7 Jun 2024 22:48:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800485; cv=none; b=tO6NXeL60CB98kycJPjTjyST+I/WC8V/INxPVsRQw2Y2HffeDS6PSlkJ/hnomcaUc6HmqdNeYGTfwjULYqsrZ878JqQiGRyXO+0rph4skKW/b25TBu2NRuiEeF9TOdmDNZl8m9aCuy0ua/Ta1B/QpPjB0rNeLonQQN2CJDcy5fg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800485; c=relaxed/simple; bh=SwULAulV4HnvpfTTr+6Nllpmj1Y2NI4+Th2yH0eiR1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hpDM2VBawzM5lUxcXxDbSAy0BhBLkx0kpX/IDEWmDyXpj2vHUurDxEJUc0IF7BTftT6fKtw+ZAbdTu3RsSj4S8vhP6IFhZEe2tBa4FIFfHS2R4dcrq3YONv1EXQ/lCPTJ8cgxaaIkXrr8cyJuD0EqNoRf7qJvIauSpSAZzpshxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Fmd2XRca; arc=none smtp.client-ip=209.85.161.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Fmd2XRca" Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5bacccdddd1so416075eaf.2 for ; Fri, 07 Jun 2024 15:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800483; x=1718405283; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3ErA5jrZR07RoJqNMKsEwZqsgW0qBbd9MiVmTLNjRkc=; b=Fmd2XRcaA3lOo/Fbtdk2bD3R37GsN6EEcf8Z4tD/0riyB2ZalG+M9x+6DRFapy0jKq +iEDg/iLxG83T+2Jj7bC7IumesXPj9+wY2fj1NT8KVTI144rxACmsd0oDb4No1A5DSmF n919O1yhnP/IpSGOBX6LagovO8AfIVLUDc9/xmVwdj9PLpKBuqd81uLzhprjAaZgee+1 gbt90btROUbz3/eZRFKpXeVeSfS8Nqs5sWCoS5dZKgIerJZpglfmFAeC6UDvPV2YU9m0 ZvWL+7FEsDwVEM+fs7AOqduNuX51xH6blQ0xNWqSc9naOJ4wDqRwnOkbrnvKzp42doR/ Q6nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800483; x=1718405283; h=content-transfer-encoding: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=3ErA5jrZR07RoJqNMKsEwZqsgW0qBbd9MiVmTLNjRkc=; b=N+zwu1pOSI42MMGG1e7OEB9E7BI+DHRMOAyF8RWXYN1QVIN0GDtgrCy1v4+YJJ7mhd zspTHyFv1+Y3dX3UBsUjqVELTWdeCnGOtGs4TeZs7C87WbKIuUs0vkdY8/Mo2FVIaDPX ocSUVSeoOZhvwLK+X5XffWe7plKicQl9Pes1T0i7rHXoCpIhmNcGeqSDRRRWfoAe9YJx gYtn/vEZlG7Q+djaNtr9kiYoSGZ+YQe7q9ct0xBA7DcXqYiwdaS//b+yn3lF6RQ9DOOt L6b+37GnBP+U6HAQZonzeA8TpNgFWVwpxTuz6nN2MGveUWuECtNH2AG4ba9fNWk1lA0N iHOA== X-Gm-Message-State: AOJu0Yzd5kmMA5Xwzzcxv+wiF9cSWF+kpz60LKivmTtzAamXpaDUgqLg UTBcLNOrUoLjDCzne2hgKR1GDXgJq0alLNMx6dYIvbZ4LBHAhSBxedtHfg== X-Google-Smtp-Source: AGHT+IFN2kTUcrUCCsAZtVyH4ZBZBwoCLeiVb00TZdP1al9ZTRVbKWQQEXUTrWw7CNOAyzRzVWsOjg== X-Received: by 2002:a05:6820:626:b0:5ba:7350:9e5a with SMTP id 006d021491bc7-5baae8e19a6mr3570379eaf.9.1717800483296; Fri, 07 Jun 2024 15:48:03 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:03 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 18/23] qmi: netmon: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:18 -0500 Message-ID: <20240607224746.903769-18-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/netmon.c | 26 +++----------------------- plugins/gobi.c | 3 ++- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/drivers/qmimodem/netmon.c b/drivers/qmimodem/netmon.c index f45a9efd6af8..82e0f2a4c737 100644 --- a/drivers/qmimodem/netmon.c +++ b/drivers/qmimodem/netmon.c @@ -195,39 +195,19 @@ static void qmi_netmon_request_update(struct ofono_netmon *netmon, l_free(cbd); } -static void create_nas_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_netmon *netmon = user_data; - struct netmon_data *nmd = ofono_netmon_get_data(netmon); - - DBG(""); - - if (!service) { - ofono_error("Failed to request NAS service"); - ofono_netmon_remove(netmon); - return; - } - - nmd->nas = service; - - ofono_netmon_register(netmon); -} - static int qmi_netmon_probe(struct ofono_netmon *netmon, unsigned int vendor, void *user_data) { - struct qmi_device *device = user_data; + struct qmi_service *nas = user_data; struct netmon_data *nmd; DBG(""); nmd = l_new(struct netmon_data, 1); + nmd->nas = nas; ofono_netmon_set_data(netmon, nmd); - qmi_service_create_shared(device, QMI_SERVICE_NAS, - create_nas_cb, netmon, NULL); - return 0; } @@ -240,11 +220,11 @@ static void qmi_netmon_remove(struct ofono_netmon *netmon) ofono_netmon_set_data(netmon, NULL); qmi_service_free(nmd->nas); - l_free(nmd); } static const struct ofono_netmon_driver driver = { + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, .probe = qmi_netmon_probe, .remove = qmi_netmon_remove, .request_update = qmi_netmon_request_update, diff --git a/plugins/gobi.c b/plugins/gobi.c index 9c0ea4f6bbcc..7c3b352eb274 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -842,7 +842,8 @@ static void gobi_post_online(struct ofono_modem *modem) if (data->features & GOBI_NAS) { ofono_netreg_create(modem, 0, "qmimodem", qmi_service_clone(data->nas)); - ofono_netmon_create(modem, 0, "qmimodem", data->device); + ofono_netmon_create(modem, 0, "qmimodem", + qmi_service_clone(data->nas)); } if (data->features & GOBI_VOICE) { From patchwork Fri Jun 7 22:47:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690715 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E58415572E for ; Fri, 7 Jun 2024 22:48:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800486; cv=none; b=ZYjysoV4wcmtNMtgPAhqAmdqUA0631tLpAcD0T9JBV/f5SepVQT4u48Se6fJjwyJ6FmOy9/tWN2Ym31l4jbTm0ts2kixYv4fEEsxGuChg8mG1I+avSLTZyzvgewYjVP3sRFfzviRawvDXa4rq7OcnlsdcPqEsf0k0oKxZ9X5esg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800486; c=relaxed/simple; bh=vhWh+T6RlZXJBj5VGe3hZj4JBj+FYCcaUvSjzMZ9ENc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JJNYFXXZTwSQbalsexHDi6ZCib1EZnl+v6DphhSIIFRSEBa7wwqw7imKbkYeyGI4yT33Ihi/8vY010D8gSg7WcNQAEIas/5qUSj9efvhvsnxNbk19eMKPJ6pQM/7IqV4O4BBALbvWzwpXk5P0H3WI4yn8vyGuo347ZMDK+39Iz0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ml04CkJK; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ml04CkJK" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5b97a071c92so1366681eaf.1 for ; Fri, 07 Jun 2024 15:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800484; x=1718405284; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oesFof9ssiOR6KggjI1+dEYYKWLzRtMci6UvA+JL9CE=; b=Ml04CkJKEjCpeiZXLN0tEiEcZ/2PL7A/zcm99S4Wu/wuxna0eLeEKySoz+BGIrp32O 3j9MSY/23prRyFq9lZuLUq829u6axO32wT9LPR3tCNBagghMzszzXwAqFWFM1ilkAvcV ZwProJLq6/D2+pUTqcKiRVT4H9Kh1w0uojaGtxJY/P4JnvjPQbJCE4nKPzNeFCFH/dH4 jMuZZq3kqqaOxd/UAAWIaHPvVD0yH6v46m2QL7eSr952EqBhgCHqcpVSH+yVNRvoMxxQ dAiof2Xx1ug2bz//gcRfFqNLnsKZV1jgeqzZTs1N9+kfSgjJVYtt+ig6/sFDiY2WYN45 GEng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800484; x=1718405284; h=content-transfer-encoding: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=oesFof9ssiOR6KggjI1+dEYYKWLzRtMci6UvA+JL9CE=; b=jEPL4xIz97KV2ztNYRVFImLLFQXFQb4GsXgHfd6ZqKNzgjUWI7XCIZvK7xQwZyYUuP fpf+UHS6p+dO3dSz7eGNU5drqbAJh1+1gvp7AzEcl0Z36I2if2PVeC++Js5AJgTyG/FC 7193VOJqkag2TfTixrkvNmpdmsoSHUgmYJVG/QdXtYT86zytvSxUAbdpcLADr00fwJ+e GWGck1rwpHcfk8pZnCJLtevLkkVo3GyFmzD/5IbcjjAv+r/cvS4ES926I/yVqC2+jy+E WfCRt+EmmL87KY/R4bpPuJnoFH2RnGQAnEoI7fpkC7gVx+CEGmropmFaMw9uZREzANtf VqMw== X-Gm-Message-State: AOJu0YxBpVpq2KSn6rg1a0pai1SjDMp2R4YH7hVSfAP1G2vDT+ZmcjLp UjyCjnj3tG0yMiG1lcRS1EOMchNOHs2HMwUPXg/ybv7ivitqGHPEpbuBeQ== X-Google-Smtp-Source: AGHT+IEJ2ffzS6TeClaBXxVx4vzZAl7zUtGu6Xx0jI53eoANRliFtAJHL+sxvDcOMl35VT4IroT6yw== X-Received: by 2002:a05:6820:2283:b0:5b9:ff9c:b884 with SMTP id 006d021491bc7-5baae76788emr4020506eaf.4.1717800483962; Fri, 07 Jun 2024 15:48:03 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:03 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 19/23] qmi: lte: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:19 -0500 Message-ID: <20240607224746.903769-19-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/lte.c | 47 ++++++++++-------------------------------- plugins/gobi.c | 4 +++- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/drivers/qmimodem/lte.c b/drivers/qmimodem/lte.c index 5466eac7c204..d2d1048b5515 100644 --- a/drivers/qmimodem/lte.c +++ b/drivers/qmimodem/lte.c @@ -162,10 +162,10 @@ error: ofono_lte_remove(lte); } -static void create_wds_cb(struct qmi_service *service, void *user_data) +static int qmimodem_lte_probe(struct ofono_lte *lte, + unsigned int vendor, void *data) { - struct ofono_lte *lte = user_data; - struct lte_data *ldd = ofono_lte_get_data(lte); + struct qmi_service *wds = data; struct qmi_param *param; struct { uint8_t type; @@ -174,49 +174,25 @@ static void create_wds_cb(struct qmi_service *service, void *user_data) .type = QMI_WDS_PROFILE_TYPE_3GPP, .family = QMI_WDS_PROFILE_FAMILY_EMBEDDED, }; + struct lte_data *ldd; DBG(""); - if (!service) { - ofono_error("Failed to request WDS service"); - ofono_lte_remove(lte); - return; - } - - ldd->wds = service; - - /* Query the default profile */ param = qmi_param_new(); - - /* Profile type */ qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p); - /* Get default profile */ - if (qmi_service_send(ldd->wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER, - param, get_default_profile_cb, lte, NULL) > 0) - return; - - qmi_param_free(param); - - ofono_error("Failed to query default profile"); - ofono_lte_register(lte); -} - -static int qmimodem_lte_probe(struct ofono_lte *lte, - unsigned int vendor, void *data) -{ - struct qmi_device *device = data; - struct lte_data *ldd; - - DBG("qmimodem lte probe"); + if (!qmi_service_send(wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER, + param, get_default_profile_cb, lte, NULL)) { + qmi_param_free(param); + qmi_service_free(wds); + return -EIO; + } ldd = l_new(struct lte_data, 1); + ldd->wds = wds; ofono_lte_set_data(lte, ldd); - qmi_service_create_shared(device, QMI_SERVICE_WDS, - create_wds_cb, lte, NULL); - return 0; } @@ -229,7 +205,6 @@ static void qmimodem_lte_remove(struct ofono_lte *lte) ofono_lte_set_data(lte, NULL); qmi_service_free(ldd->wds); - l_free(ldd); } diff --git a/plugins/gobi.c b/plugins/gobi.c index 7c3b352eb274..0e5e6badabd6 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -811,7 +811,9 @@ static void gobi_post_sim(struct ofono_modem *modem) DBG("%p", modem); - ofono_lte_create(modem, 0, "qmimodem", data->device); + if (data->features & GOBI_NAS) + ofono_lte_create(modem, 0, "qmimodem", + qmi_service_clone(data->wds)); if (data->features & GOBI_NAS) ofono_radio_settings_create(modem, 0, "qmimodem", data->device); From patchwork Fri Jun 7 22:47:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690716 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF78D15572D for ; Fri, 7 Jun 2024 22:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800487; cv=none; b=SBaLz487T/pjiEZ1BNsUuu+lUH+GZqiGbSkHkzzYtzYEK3SwRqn8x7a7aUHGmsQT+YBd9paEsNwKlagBwaEyK1QBdoZNYD+8wFZeH/CK43M3RnO8l1QVTlnXsg6ibaIfQQfDlZElD/odAZc22vMmSGmDP0yOV2ZVmVEbOGybj8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800487; c=relaxed/simple; bh=nA89mQj4IHqzTJQ87D5Kx49Se4PEMStDaDdDdUhhv7I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nwae3i+anv04kGOWs3bcoG3nqto1crE7Xo0+gY5hwcGvRCC57pWMFeCYkXF0cLtURxqZ6HZ2FcaBMjPyO4cZx5GzNgueCsDqc2fMqc4ATwfx+NhsvqU/W06a8W7GH2LE5CCiCp3phMmV1VqKwHrOLK5JggXN51GTjnUS/08xz4o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AWyHD8bL; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AWyHD8bL" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5ba70a0ed75so1458689eaf.1 for ; Fri, 07 Jun 2024 15:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800485; x=1718405285; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BZvEoY+n75WD/XlJn9EJtDiTKiZa2BG0t/Ag91b9Sbk=; b=AWyHD8bLtPtnzgtD7zgo6DT6Q1mnN9s7VjJ9upapH7jDjedEa2U6TEf9ssOKrBwEJ1 upBtFq/eXj+gnxSY9ruo8BZ1j1KhWPAqvEUJDDnhJSNMQBasVP9X7vcveFbYMfV+vxtX asEB9KEmRizQHHHxVoz+MZqVTUt5YfSrO/gEFfyDean2z9gZFuZVbf8BtGzJQa2AFfZt 68jYph0Uy/BhmLohx/CQ3b+wB3xPFn1w9YaJLH1o0VBXV5i+0gf1xJZzxltfKhlQ7BQ4 dkOWSymfAxNKBIhJm0e054ZlquxE0v9uJl2It2oNtlsC7fHNTjrRyQ37nGmJqZ1APIMr JRRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800485; x=1718405285; h=content-transfer-encoding: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=BZvEoY+n75WD/XlJn9EJtDiTKiZa2BG0t/Ag91b9Sbk=; b=YRKbSDJEMP8YI+PEWTcQC36eXo4Nvc0MR2HJDIUAW2tOoda/M42xeGZpOE2FB5W6E3 ds4htz7iihesxDHy6sRBRZ/rHEdO2UFeB1SSuADkc8NS+lgldWGcQNIyRCRe3+2T+Q9N ib/TNPRXkw/ySouK1Vs+oQ+e/4sEDsNbxmWU1RV/2MAskpYWc/SRJVlRrr51v3cBRhRb bOKLxOe9Z4jTsnX/ikx+EI69vJjRZRdaSH5T9GDDO6CPr9Q7ZbaIouFH3jlB8UGvE8iO KW5ec1fS8I9GpftjoO7VBX668EZQMPXFLdqA801ej3eOX65L7CvgVdOJ6R2ecmzG5/x4 vnhw== X-Gm-Message-State: AOJu0YzqqxFQw+XKR1l242B/vufAFhVqYxMy3DhpY8mujE4LsJnFI1Xa 6Up6Icrb4gorilV4aTQOtGulLOcFET9KpeH+bAlfYPl9X0Id+Saeo1JzmA== X-Google-Smtp-Source: AGHT+IHkApbhOW9QoSolpweObX711tJdPPcwwDYDfGE7kYTGjq8pwI8mIY5XJK8qGmTUKZTfQQaq0g== X-Received: by 2002:a05:6820:1609:b0:5b2:f2e5:a8c8 with SMTP id 006d021491bc7-5baae8c3542mr5040349eaf.8.1717800484793; Fri, 07 Jun 2024 15:48:04 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:04 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 20/23] qmi: gprs-context: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:20 -0500 Message-ID: <20240607224746.903769-20-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/gprs-context.c | 70 +++++++++++++-------------------- plugins/gobi.c | 4 +- 2 files changed, 29 insertions(+), 45 deletions(-) diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c index 625fd0b8f193..aae058f35a9b 100644 --- a/drivers/qmimodem/gprs-context.c +++ b/drivers/qmimodem/gprs-context.c @@ -22,7 +22,6 @@ struct gprs_context_data { struct qmi_service *wds; - struct qmi_device *dev; unsigned int active_context; uint32_t pkt_handle; uint8_t mux_id; @@ -480,9 +479,10 @@ static void bind_mux_data_port_cb(struct qmi_result *result, void *user_data) } } -static void qmi_gprs_context_bind_mux(struct ofono_gprs_context *gc) +static int qmi_gprs_context_bind_mux(struct ofono_gprs_context *gc, + struct qmi_service *wds, + uint8_t mux_id) { - struct gprs_context_data *data = ofono_gprs_context_get_data(gc); struct ofono_modem *modem = ofono_gprs_context_get_modem(gc); struct qmi_param *param; const char *interface_number; @@ -496,7 +496,7 @@ static void qmi_gprs_context_bind_mux(struct ofono_gprs_context *gc) bus = ofono_modem_get_string(modem, "Bus"); if (!bus) { ofono_error("%s: Missing 'Bus'", ofono_modem_get_path(modem)); - goto error; + return -EINVAL; } if (!strcmp(bus, "pcie")) @@ -508,7 +508,7 @@ static void qmi_gprs_context_bind_mux(struct ofono_gprs_context *gc) else { ofono_error("%s: Invalid 'Bus' value", ofono_modem_get_path(modem)); - goto error; + return -ENOTSUP; } switch (endpoint_info.endpoint_type) { @@ -528,68 +528,54 @@ static void qmi_gprs_context_bind_mux(struct ofono_gprs_context *gc) ofono_error("%s: Missing or invalid 'InterfaceNumber'", ofono_modem_get_path(modem)); - /* Fall through */ + return -EINVAL; default: - goto error; + return -ENOTSUP; } DBG("interface_number: %d", endpoint_info.interface_number); - DBG("mux_id: %hhx", data->mux_id); + DBG("mux_id: %hhx", mux_id); param = qmi_param_new(); qmi_param_append(param, 0x10, sizeof(endpoint_info), &endpoint_info); - qmi_param_append_uint8(param, 0x11, data->mux_id); + qmi_param_append_uint8(param, 0x11, mux_id); qmi_param_append_uint32(param, 0x13, QMI_WDS_CLIENT_TYPE_TETHERED); - if (qmi_service_send(data->wds, QMI_WDS_BIND_MUX_DATA_PORT, param, + if (qmi_service_send(wds, QMI_WDS_BIND_MUX_DATA_PORT, param, bind_mux_data_port_cb, gc, NULL) > 0) - return; + return 0; qmi_param_free(param); -error: - ofono_error("Failed to BIND_MUX_DATA_PORT"); - ofono_gprs_context_remove(gc); + return -EIO; } -static void create_wds_cb(struct qmi_service *service, void *user_data) +static int qmi_gprs_context_probe(struct ofono_gprs_context *gc, + unsigned int vendor, void *user_data) { - struct ofono_gprs_context *gc = user_data; - struct gprs_context_data *data = ofono_gprs_context_get_data(gc); + struct qmi_service *wds = user_data; + struct gprs_context_data *data; DBG(""); - if (!service) { - ofono_error("Failed to request WDS service"); - ofono_gprs_context_remove(gc); - return; + if (vendor) { + int r = qmi_gprs_context_bind_mux(gc, wds, vendor); + + if (r < 0) { + qmi_service_free(wds); + return r; + } } - data->wds = service; + data = l_new(struct gprs_context_data, 1); + data->wds = wds; + data->mux_id = vendor; qmi_service_register(data->wds, QMI_WDS_PACKET_SERVICE_STATUS, pkt_status_notify, gc, NULL); - if (data->mux_id) - qmi_gprs_context_bind_mux(gc); -} - -static int qmi_gprs_context_probe(struct ofono_gprs_context *gc, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; - struct gprs_context_data *data; - - DBG(""); - - data = l_new(struct gprs_context_data, 1); - ofono_gprs_context_set_data(gc, data); - data->dev = device; - data->mux_id = vendor; - qmi_service_create_shared(data->dev, QMI_SERVICE_WDS, create_wds_cb, gc, - NULL); return 0; } @@ -601,9 +587,7 @@ static void qmi_gprs_context_remove(struct ofono_gprs_context *gc) ofono_gprs_context_set_data(gc, NULL); - if (data->wds) - qmi_service_free(data->wds); - + qmi_service_free(data->wds); l_free(data); } diff --git a/plugins/gobi.c b/plugins/gobi.c index 0e5e6badabd6..8d537b85d8d9 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -763,7 +763,7 @@ static void gobi_setup_gprs(struct ofono_modem *modem) interface = ofono_modem_get_string(modem, "NetworkInterface"); gc = ofono_gprs_context_create(modem, 0, "qmimodem", - data->device); + qmi_service_clone(data->wds)); if (!gc) { ofono_warn("Unable to create gprs-context for: %s", ofono_modem_get_path(modem)); @@ -789,7 +789,7 @@ static void gobi_setup_gprs(struct ofono_modem *modem) mux_id = ofono_modem_get_integer(modem, buf); gc = ofono_gprs_context_create(modem, mux_id, "qmimodem", - data->device); + qmi_service_clone(data->wds)); if (!gc) { ofono_warn("gprs-context creation failed for [%d] %s", From patchwork Fri Jun 7 22:47:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690717 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84C221553AB for ; Fri, 7 Jun 2024 22:48:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800487; cv=none; b=gsIvCHm5A6AbzY3kFxTtLbFn0fj+jBT1c4rT6wKFJd7c+u0EjnH+iky4GdsKGnoQHj/ARLJaOJKloTGDd+VLklAUdJ8M5b/HBwBIDc7rUPWQVF994KraR7RGmynqI3+HJGB78pPi1rtbFt1ZmBptcq1RbCk9uf6pghlLXW2J/Pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800487; c=relaxed/simple; bh=SsV6uVMuTz2IXP5lAaBBxI/8XFl5PvYBgbXRboSJFTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nwdWsaIBB3RXstzVVYuk37n26UGdqyBaIaqKgRUDen+NPawRWjiBcLCjWX1I7BS7zU4KMTvjoqxaGY6s8yyjV7CncYkHWKkkBzdSJ37zonAvthH9+v5tr494pJ7akPh424xD0LF9t6buSl0QIJZcQ8y3HBHCTaY7OGIPJNwvHNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C0AnZN0M; arc=none smtp.client-ip=209.85.167.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C0AnZN0M" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3d1b33e9ac6so1523519b6e.1 for ; Fri, 07 Jun 2024 15:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800485; x=1718405285; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FVaa0Z0numLrxY/KxHgDBhD/KP5A9wqDJVkmZCuDa2s=; b=C0AnZN0MPnQui97sdq1uEVlHewURytJoOBTAJnYrc+LIkcYdwT73wVfmuTvil2zHhJ qkRFjzahGrgBHjn+iF84jTDW7gMc0Bxn7NzzN1Y1in023DbAu52/1XF6ztk9IOlcWxYm 0QKwrToK6ZKkssLchYhri9I2r2RuVJl8m5itz6zpobsjn7tm8inStLsTYhcQCZ+9S4Y5 8to7ER5c47EhcoR0dYoU7nvKrtvtlHBvuoPgyhbiLKPg9R97Iw1J/HhckDmvNrE/3ilV 8+kvfrdLoxVdDxK2fz1BzIkU7IJ9z3uvX+eVZ25D+hqkIDUYWtyi4M2SFcNG5A6fRne+ GrBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800485; x=1718405285; h=content-transfer-encoding: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=FVaa0Z0numLrxY/KxHgDBhD/KP5A9wqDJVkmZCuDa2s=; b=RBT8LC6PmLsnpyF9q8qOVjC7oi/NQt2/Pjc/1bsVGIhNhpgLjRKJHuNMp6WmGH2mUT LVKB0IJiGG89Gyw36dl8fZBWtoParCKghzR/+TZWefKVngZbos0bndrC0LKH6w5WWBLp /WPeq7vpwb+zwwsn+zW2dCIs9RjLhZhPHYRI4HRyetiak7VDNoMfv/wxLDtk3Wm7HI9s ArI/5njCdUOfK+YvrmwwqqHt3qs1xAa3BXLRPNYdGgfsH+iMnZQssWTReylnrpZB0hPb sGAr8HIAuqZlvPPQ8GNrxwSJ1tP+ztX4XaaioNHWOlI2OJRUXOc7BZuA64A6Gheap68P fVKA== X-Gm-Message-State: AOJu0YySGtv0WJ89uVu8b63q6+SSm6ljEsqZSdRhV9YEeg4IoT1axRiA eklxuVBzfCyTpOC2d7aBhYyzXDKkXuLvCwuOeMI/I2SjkqdrfbtoZw8Ppg== X-Google-Smtp-Source: AGHT+IFW5jNBAJoN4dgbsBSsMTZrKC+nQRZtB3rInFM2nD/X7s7LChW84U/RMq9avZcB1PD4eADP3A== X-Received: by 2002:a05:6808:6190:b0:3d2:1b2e:8c5b with SMTP id 5614622812f47-3d21b2e8efdmr419426b6e.3.1717800485425; Fri, 07 Jun 2024 15:48:05 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:05 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 21/23] qmi: sim: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:21 -0500 Message-ID: <20240607224746.903769-21-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use qmi_device_get_service and qmi_device_add_service_watch --- drivers/qmimodem/sim.c | 90 +++++++++--------------------------------- plugins/gobi.c | 4 +- 2 files changed, 21 insertions(+), 73 deletions(-) diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c index 67925239f2b5..29f4eff7bc40 100644 --- a/drivers/qmimodem/sim.c +++ b/drivers/qmimodem/sim.c @@ -44,7 +44,6 @@ struct sim_status { }; struct sim_data { - struct qmi_device *qmi_dev; struct qmi_service *dms; struct qmi_service *uim; uint32_t event_mask; @@ -841,68 +840,31 @@ error: ofono_sim_remove(sim); } -static void create_uim_cb(struct qmi_service *service, void *user_data) +static int qmi_sim_probev(struct ofono_sim *sim, + unsigned int vendor, va_list args) { - struct ofono_sim *sim = user_data; - struct sim_data *data = ofono_sim_get_data(sim); - struct qmi_param *param; - uint32_t mask = 0x0003; - - DBG(""); - - if (!service) { - ofono_error("Failed to request UIM service"); - goto error; - } - - data->uim = service; - - param = qmi_param_new_uint32(QMI_UIM_PARAM_EVENT_MASK, mask); - - if (qmi_service_send(data->uim, QMI_UIM_EVENT_REGISTRATION, param, - event_registration_cb, sim, NULL) > 0) - return; - -error: - ofono_sim_remove(sim); -} - -static void create_dms_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_sim *sim = user_data; - struct sim_data *data = ofono_sim_get_data(sim); + struct qmi_service *dms = va_arg(args, struct qmi_service *); + struct qmi_service *uim = va_arg(args, struct qmi_service *); + static const uint32_t mask = 0x0003; + struct qmi_param *param = + qmi_param_new_uint32(QMI_UIM_PARAM_EVENT_MASK, mask); + struct sim_data *data; DBG(""); - if (!service) { - ofono_error("Failed to request DMS service"); - ofono_sim_remove(sim); - return; + if (!qmi_service_send(uim, QMI_UIM_EVENT_REGISTRATION, param, + event_registration_cb, sim, NULL)) { + qmi_service_free(dms); + qmi_service_free(uim); + return -EIO; } - data->dms = service; - - qmi_service_create_shared(data->qmi_dev, QMI_SERVICE_UIM, create_uim_cb, - sim, NULL); -} - -static int qmi_sim_probe(struct ofono_sim *sim, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; - struct sim_data *data; - - DBG(""); - data = l_new(struct sim_data, 1); - - data->qmi_dev = device; + data->uim = uim; + data->dms = dms; ofono_sim_set_data(sim, data); - qmi_service_create_shared(device, QMI_SERVICE_DMS, - create_dms_cb, sim, NULL); - return 0; } @@ -915,29 +877,13 @@ static void qmi_sim_remove(struct ofono_sim *sim) ofono_sim_set_data(sim, NULL); l_timeout_remove(data->retry_timer); - data->retry_timer = NULL; - - if (data->uim) { - if (data->card_status_indication_id) { - qmi_service_unregister(data->uim, - data->card_status_indication_id); - data->card_status_indication_id = 0; - } - - qmi_service_free(data->uim); - data->uim = NULL; - } - - if (data->dms) { - qmi_service_free(data->dms); - data->dms = NULL; - } - + qmi_service_free(data->uim); + qmi_service_free(data->dms); l_free(data); } static const struct ofono_sim_driver driver = { - .probe = qmi_sim_probe, + .probev = qmi_sim_probev, .remove = qmi_sim_remove, .read_file_info = qmi_read_attributes, .read_file_transparent = qmi_read_transparent, diff --git a/plugins/gobi.c b/plugins/gobi.c index 8d537b85d8d9..d32fb9d75585 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -728,7 +728,9 @@ static void gobi_pre_sim(struct ofono_modem *modem) ofono_devinfo_create(modem, 0, "qmimodem", qmi_service_clone(data->dms)); if ((data->features & GOBI_UIM) && !legacy) - ofono_sim_create(modem, 0, "qmimodem", data->device); + ofono_sim_create(modem, 0, "qmimodem", + qmi_service_clone(data->dms), + qmi_service_clone(data->uim)); else /* DMS always availalable */ ofono_sim_create(modem, 0, "qmimodem_legacy", qmi_service_clone(data->dms)); From patchwork Fri Jun 7 22:47:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690718 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D23615572E for ; Fri, 7 Jun 2024 22:48:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800488; cv=none; b=BFirtI95hvP1jzd1eSAHKD6DXtj5MfEKAh0+n1EvlBtT0GE7rONu5bEWyG5xGNOgXkyUpSOGiE/1gZh9mzmKulhwSiuiXEc6UOCirAeJOnU18k6sIgakaLAz7swS0zIikhr2T1ha0mCH6/xLbTUA3BydwrSroX1QpijIlV6zubk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800488; c=relaxed/simple; bh=s0IvtF+LWC0iH0uuzhoie5XKTJ2+1EXgXGJtRacn60g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GKcDqtXFASYo7upl6tIaB28DQZI4jEsyw0GgpGpW6EtkSmeEUKgbHvCa5XWmrQWP6s/0rMMrfLEW1QjVQw6rEIztDncNT3U5pFbv0O47p9kN2QFOv9k5ZE4r+Z4lIt+47YVy3WgKyJCFH6FzQnXkR0Jm7abdKDHCQmjo/Ub8hf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=arad2801; arc=none smtp.client-ip=209.85.161.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="arad2801" Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5b2ed25b337so1455887eaf.0 for ; Fri, 07 Jun 2024 15:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800486; x=1718405286; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MlWXLrumlNL/wJBuQP2B4HVw9eIJiZQj7NOcoPGpK0s=; b=arad2801aPo8dYhTZxQGf00F1VDdiWjPJ2/HIXu41ngLvVlHmMpVAKjNwP30elgLQO kkj8R9mAui3dyaOD4MNobNVQWrSoCinzV99FF9F3/CozdRSWzVEADKXyTG3mXmESEZWo 3jL664GkwAeUWNwqb7NtdsFbmBlz0OZ+D90wUS/w2VXAT/Gk5nfvTiFoe8/sxzjw13TQ ryh7PhXV39M+VXqP7tOm/9qpVl9SKv/1QT1JR3kB12XU/Gxb5bV1tgVqVha6QaiLWCSZ SiYl59iF2n23D+gjY+9C1/gfWCmBl2h53cGQqDwVM4Md2bOJnRqL5lSv6wM/zqaqokn4 QoHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800486; x=1718405286; h=content-transfer-encoding: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=MlWXLrumlNL/wJBuQP2B4HVw9eIJiZQj7NOcoPGpK0s=; b=R8qGbXeMg2wwF87l3N+4KQOa55fPMnBEnelzny62HN4deY2j015YgGGsxcfzpZxBZ2 jq0bTV70MKvPGEj1wzd1uPojqXYafl7A93b1s09pc9z1ttkZeBN7vUGhk/w0IVzLhPfd lecJwZ8hV5A9JTAfVeKmrD20HL7LKGQvpRJmv6OWy0yUkoWzMjSiJ9SBLauRYet27G1p wG2XqhUKi2K/ogIJu5CC++HguRgBtaJ/xeYNfUrS0w6Rb4Fz67yEY0AzWTkQSHxM3anb IUbKWrmE08qnX+WRsh8ksWl2ROv8U8f2FTn2AzFnhWEE+vQDEcsOmAE6VCgVt4ZGIFtG wbpw== X-Gm-Message-State: AOJu0Yz/FYK+mxIDGqvZMSdI0U6jB6VuqxI6F+1pfdhzgVA3fVOAHaSu PY5VoIR749obx9LgPnrrO4WbWUVoTf3V9JyQ5aTMYD41ljviyMm1NMZE7A== X-Google-Smtp-Source: AGHT+IExf/au42wLm89oyGns/Rg9i+IGwoiIzfgGAG9pDY3lQ67wgk5r505Vwy0cjR2erm3qWtdgdQ== X-Received: by 2002:a05:6820:1689:b0:5b9:8a06:c49 with SMTP id 006d021491bc7-5baae50a4afmr4188275eaf.2.1717800486206; Fri, 07 Jun 2024 15:48:06 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:05 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 22/23] qmi: gprs: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:22 -0500 Message-ID: <20240607224746.903769-22-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/gprs.c | 85 +++++++++-------------------------------- plugins/gobi.c | 4 +- 2 files changed, 22 insertions(+), 67 deletions(-) diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c index 03ee377e8916..da7ad63c49cb 100644 --- a/drivers/qmimodem/gprs.c +++ b/drivers/qmimodem/gprs.c @@ -21,7 +21,6 @@ #include "util.h" struct gprs_data { - struct qmi_device *dev; struct qmi_service *nas; struct qmi_service *wds; unsigned int default_profile; @@ -405,9 +404,12 @@ error: ofono_gprs_remove(gprs); } -static int get_default_profile_number_request(struct ofono_gprs *gprs) +static int qmi_gprs_probev(struct ofono_gprs *gprs, + unsigned int vendor, va_list args) { - struct gprs_data *data = ofono_gprs_get_data(gprs); + struct qmi_service *wds = va_arg(args, struct qmi_service *); + struct qmi_service *nas = va_arg(args, struct qmi_service *); + struct gprs_data *data; struct { uint8_t type; uint8_t family; @@ -423,77 +425,29 @@ static int get_default_profile_number_request(struct ofono_gprs *gprs) */ qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p); - if (qmi_service_send(data->wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER, + if (!qmi_service_send(wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER, param, get_default_profile_number_cb, - gprs, NULL) > 0) - return 0; - - qmi_param_free(param); - return -EIO; -} - -static void create_wds_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_gprs *gprs = user_data; - struct gprs_data *data = ofono_gprs_get_data(gprs); + gprs, NULL)) { + qmi_param_free(param); + qmi_service_free(nas); + qmi_service_free(wds); - DBG(""); - - if (!service) { - ofono_error("Failed to request WDS service"); - goto error; + return -EIO; } - data->wds = service; - qmi_service_register(data->wds, QMI_WDS_EVENT_REPORT, - event_report_notify, gprs, NULL); - qmi_service_register(data->wds, QMI_WDS_PROFILE_CHANGED, - profile_changed_notify, gprs, NULL); - - if (get_default_profile_number_request(gprs) >= 0) - return; -error: - ofono_gprs_remove(gprs); -} - -static void create_nas_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_gprs *gprs = user_data; - struct gprs_data *data = ofono_gprs_get_data(gprs); - - DBG(""); - - if (!service) { - ofono_error("Failed to request NAS service"); - ofono_gprs_remove(gprs); - return; - } + data = l_new(struct gprs_data, 1); + data->wds = wds; + data->nas = nas; - data->nas = service; qmi_service_register(data->nas, QMI_NAS_SERVING_SYSTEM_INDICATION, ss_info_notify, gprs, NULL); - - qmi_service_create_shared(data->dev, QMI_SERVICE_WDS, - create_wds_cb, gprs, NULL); -} - -static int qmi_gprs_probe(struct ofono_gprs *gprs, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; - struct gprs_data *data; - - DBG(""); - - data = l_new(struct gprs_data, 1); + qmi_service_register(data->wds, QMI_WDS_EVENT_REPORT, + event_report_notify, gprs, NULL); + qmi_service_register(data->wds, QMI_WDS_PROFILE_CHANGED, + profile_changed_notify, gprs, NULL); ofono_gprs_set_data(gprs, data); - data->dev = device; - - qmi_service_create_shared(device, QMI_SERVICE_NAS, - create_nas_cb, gprs, NULL); - return 0; } @@ -507,12 +461,11 @@ static void qmi_gprs_remove(struct ofono_gprs *gprs) qmi_service_free(data->wds); qmi_service_free(data->nas); - l_free(data); } static const struct ofono_gprs_driver driver = { - .probe = qmi_gprs_probe, + .probev = qmi_gprs_probev, .remove = qmi_gprs_remove, .set_attached = qmi_set_attached, .attached_status = qmi_attached_status, diff --git a/plugins/gobi.c b/plugins/gobi.c index d32fb9d75585..b7a8240edd3c 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -753,7 +753,9 @@ static void gobi_setup_gprs(struct ofono_modem *modem) char buf[256]; int i; - gprs = ofono_gprs_create(modem, 0, "qmimodem", data->device); + gprs = ofono_gprs_create(modem, 0, "qmimodem", + qmi_service_clone(data->wds), + qmi_service_clone(data->nas)); if (!gprs) { ofono_warn("Unable to create gprs for: %s", ofono_modem_get_path(modem)); From patchwork Fri Jun 7 22:47:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13690719 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E780155739 for ; Fri, 7 Jun 2024 22:48:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800489; cv=none; b=YUdn8JfHei4v00r4/QDk4LfaK8RmIO7gcxcRDsWwWUqayqSQY/WQrQbbknxQib3uPFr/XKXcwidhYMiCny1TeA+wOv9vnhz60nGNuAV4IE5S7bTYppDpRKP2euyqw1fsIOhOoICZCyjTfwyZZ3V+X00yMp/l7cmDqYtE4/aqhLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717800489; c=relaxed/simple; bh=Pp8P/c6/5sdHVv8oFpdDhrCl3LhH8d/dNx8eVANIDhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dB6cAVtyp7YbkT6R4KctOsj+3Y1jzdQmeEJRAcMvUuKxKl59gl7GxiSXWYaQ9IFH09oi/GILduNH+8BYLylD8eX6O4lcA+zCtmvVno8nNZeWrCz0JZZqJAgck702F1ZzZjiGAkaoLpEhR8FIY9p36pcVs/MlPpqZrpxiDUnMwIY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kY8Jrrnu; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kY8Jrrnu" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5b97a9a9b4bso1192882eaf.0 for ; Fri, 07 Jun 2024 15:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717800487; x=1718405287; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rF/6GddWOqxS7yf6OLz866Lt+WuomuZF4pEEHEJcuAQ=; b=kY8JrrnuQQobb1/XNNciuWBlMlMykMcdtcA76s8wE5eScHHZr77CYIfpDYHVTKjXR0 Vrg4eXBpo2ggF/eXAwe7ip/6UiqoEhLAkbO/v++Nn06SpwtZMYZbX24LrdLzbD9XnGeX r2KcADgZ2qDHHf58pbYEnw1DJBAddQ5tSzRXJ85Z3srPMRWxmady4GWQK1YOZv9aY6L4 Z6GpWBqJKL6hSGPznypFkGeUm6nkl+1mSlDf1Ma9M0B8X1TPGHhcUpmiPwahYdx1uzcN 4l3wkJNHfBZfJQ0vOnWMCuyN8199UTt6NsaaT3NIajLQGWK60CiDB5N/gHbcJhYcOOdN h48g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717800487; x=1718405287; h=content-transfer-encoding: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=rF/6GddWOqxS7yf6OLz866Lt+WuomuZF4pEEHEJcuAQ=; b=ogfUhP8tt4foq80Qn4GSlR6LZhhe9LlxKKmmHrA9CdaDvJMBddtGYmr3oZC7P2i9RB 8MoMwwJsIjRUs3SeIl7fsurR7D7lymg86BqqlDp1XSAt+ouQh8ZM57Mvn5t/kEe0qZnM AieobgEV0iH2+qKhOPi4OWFRdSFDPiIpTY1+ZqU8J54Gsg3VlzF9Vg7Zv/eiM3//js3Z KVYkn49riupH4Nq9zv9acgdmaIMMmnTAWQiNbzjQ9BDpV1urMEFuOC0D+yYcCDzg7mNH 3G/I/drnSUtwI0F2Effiq8x5kt6ijFKpkCEZ7bqtmDwfY+rR4bfOj3NTOaXuuKyZ2xHC lKHA== X-Gm-Message-State: AOJu0Yyi/1vbnVDHdRntr5R2+HrHv3mJKteFUg5I1zSy4LjdQrzLinO0 J2L5CovJ7+DPFRyojHe9IGelX2y42Qax30H6xJu72JoEC9jyRC75DxzEuQ== X-Google-Smtp-Source: AGHT+IH9Nsac5xdqhd27euD3idIiF8S72hbEz5NlU4FHsnM3Gm/YGEbx0rMWKQNbeP5ZuDua48NKkg== X-Received: by 2002:a05:6820:1609:b0:5b5:3d56:287b with SMTP id 006d021491bc7-5baae7520bemr4528705eaf.4.1717800487013; Fri, 07 Jun 2024 15:48:07 -0700 (PDT) Received: from localhost.localdomain (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5ba976b43c4sm838773eaf.14.2024.06.07.15.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 15:48:06 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 23/23] qmi: radio-settings: Drop use of qmi_service_create_shared Date: Fri, 7 Jun 2024 17:47:23 -0500 Message-ID: <20240607224746.903769-23-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240607224746.903769-1-denkenz@gmail.com> References: <20240607224746.903769-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- drivers/qmimodem/radio-settings.c | 56 ++++++------------------------- plugins/gobi.c | 4 ++- 2 files changed, 13 insertions(+), 47 deletions(-) diff --git a/drivers/qmimodem/radio-settings.c b/drivers/qmimodem/radio-settings.c index 2e428b9d0c2e..8463c84bf1ed 100644 --- a/drivers/qmimodem/radio-settings.c +++ b/drivers/qmimodem/radio-settings.c @@ -198,59 +198,22 @@ error: CALLBACK_WITH_FAILURE(cb, -1, data); } -static void create_dms_cb(struct qmi_service *service, void *user_data) +static int qmi_radio_settings_probev(struct ofono_radio_settings *rs, + unsigned int vendor, va_list args) { - struct ofono_radio_settings *rs = user_data; - struct settings_data *data = ofono_radio_settings_get_data(rs); - - DBG(""); - - if (!service) - return; - - data->dms = service; -} - -static void create_nas_cb(struct qmi_service *service, void *user_data) -{ - struct ofono_radio_settings *rs = user_data; - struct settings_data *data = ofono_radio_settings_get_data(rs); - - DBG(""); - - if (!service) { - ofono_error("Failed to request NAS service"); - ofono_radio_settings_remove(rs); - return; - } - - if (!qmi_service_get_version(service, &data->major, &data->minor)) { - ofono_error("Failed to get NAS service version"); - ofono_radio_settings_remove(rs); - return; - } - - data->nas = service; - - ofono_radio_settings_register(rs); -} - -static int qmi_radio_settings_probe(struct ofono_radio_settings *rs, - unsigned int vendor, void *user_data) -{ - struct qmi_device *device = user_data; + struct qmi_service *dms = va_arg(args, struct qmi_service *); + struct qmi_service *nas = va_arg(args, struct qmi_service *); struct settings_data *data; DBG(""); data = l_new(struct settings_data, 1); + data->dms = dms; + data->nas = nas; - ofono_radio_settings_set_data(rs, data); + qmi_service_get_version(data->nas, &data->major, &data->minor); - qmi_service_create_shared(device, QMI_SERVICE_DMS, - create_dms_cb, rs, NULL); - qmi_service_create_shared(device, QMI_SERVICE_NAS, - create_nas_cb, rs, NULL); + ofono_radio_settings_set_data(rs, data); return 0; } @@ -270,7 +233,8 @@ static void qmi_radio_settings_remove(struct ofono_radio_settings *rs) } static const struct ofono_radio_settings_driver driver = { - .probe = qmi_radio_settings_probe, + .flags = OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE, + .probev = qmi_radio_settings_probev, .remove = qmi_radio_settings_remove, .set_rat_mode = qmi_set_rat_mode, .query_rat_mode = qmi_query_rat_mode, diff --git a/plugins/gobi.c b/plugins/gobi.c index b7a8240edd3c..549ccc6c9d7b 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -820,7 +820,9 @@ static void gobi_post_sim(struct ofono_modem *modem) qmi_service_clone(data->wds)); if (data->features & GOBI_NAS) - ofono_radio_settings_create(modem, 0, "qmimodem", data->device); + ofono_radio_settings_create(modem, 0, "qmimodem", + qmi_service_clone(data->dms), + qmi_service_clone(data->nas)); if (data->features & GOBI_WMS) ofono_sms_create(modem, 0, "qmimodem",