From patchwork Thu Jun 13 21:41: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: 13697491 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 2316C71747 for ; Thu, 13 Jun 2024 21:41:37 +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=1718314899; cv=none; b=PpRxFZumlf4+FdmVRmRi6mSNGkJuDq7g7BTdfyvOAkVqftFJVK0xrIBU+mtKTN+n5QQ4IkGj9ut/8HmPDFYcQZHU3gtaz5N4CTLvYqAQ40PAnc5YBkXDfPGit2k45Q+nvusrW6VZjeZxoxbS35i1KD97DK+CnlXjnx/cfzX4K4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314899; c=relaxed/simple; bh=jiraYGs/O4eweLj36mjlG97UPK2OwCGH5AINnydTkrg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jgARmk+uodX+ZfhKF/tcFHXwTTttBSeXgk80sGv78sT8hpe5o+3+Or14BEnUSRc+/sGjuzfa8Ea+WrKvckcowmQrf/NUwJiodBgepxsl0etpmpN3G6yRK7ZXxCqZG+NKJsbkg9yQBEN9nL2gc+JDTg9RMbfooKryH13/OAuu+pk= 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=lKYKsRjd; 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="lKYKsRjd" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5b9706c84e5so826333eaf.1 for ; Thu, 13 Jun 2024 14:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314897; x=1718919697; 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=RXQOMqQZbkJLvo7lZ7g+/7mpUBAVXIRh6PGMOvNqgHU=; b=lKYKsRjdoGsXnwD34qY/NVnsLn58Sn565bQNbrEz/jIi38P5XhR8VAkBba5DlpP7N6 goKvyWpUc1NgMKsQXlqtnHsS8tI0RJuy9MMNzAV4HQ8i3j7aL/uSBE2I7Gdv7g8nKD+Q e7FpDt9RO5gtZA4Nzj21rkjqWAHZ7hEvstyHXhZDc1MhQP/gekqHWCohTVaCKON2xdlA XSu52nimpOCNnreifTFjybqYiZrvZOwzhg+fz0s1hLg3HulyoO5Ncq2wafN9bY3ervSp y43oBF12lqiLSYQgGOnlYMPUQuNk/FTViHKxgk5U0RDRICH8tAeW5pQzjJVLsLMFE+zq S6ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314897; x=1718919697; 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=RXQOMqQZbkJLvo7lZ7g+/7mpUBAVXIRh6PGMOvNqgHU=; b=eXsTjSiDitNOeeIFzNvS249WeyNOhsgezkvjtl1gj6bmKqySzNMZ9ENYeQc1aFWYHA E9Sgn6KDvo/E2QJF6BNXscS4ZxFpq7nGyv8dOhq+or2W8OUBPk7x+a1mA1jh+RtAv9be IDLGPAtEMQRXG9IDQhDXfX9JFmZJnsNSLom+Nt2SEeCIe2DkyYXnHJ3IHOvdg2NLrOdK g16qFCcp8jgE7u5mshpfGQu9xybrSU1R+7Rc/slkQ6EHE3MBgwsnXiAiKMngeyDjfmfw p2jJLHI5W3nBtkUuFKiS/DSV8wfm1rGaApUCCxvQ1V8UnQMQgEyC99pTUXpgKPLhQ3yS kbnQ== X-Gm-Message-State: AOJu0YzKz42XOzqJlsivlBgyYJHepunRW7G7VpawBk2gRHBg1BSDS69r tUsOFhbnIU4SDUAg7CsE7iedMugqRjt3xwsEsBSxOHPmAk3kw1oQgx2/nQ== X-Google-Smtp-Source: AGHT+IENB7uIyVBWvX+sOzwVwjNpU8GTx8qKvGvr+jVppMXoFlwWDXZtpqte9aKu3zmD4p2fgHcjpg== X-Received: by 2002:a05:6870:c6a9:b0:254:cdac:99a2 with SMTP id 586e51a60fabf-25842b804bdmr889740fac.55.1718314896712; Thu, 13 Jun 2024 14:41:36 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:36 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 01/23] gobi: Remove phonebook and stk atom creation Date: Thu, 13 Jun 2024 16:41:10 -0500 Message-ID: <20240613214134.1056517-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 | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/plugins/gobi.c b/plugins/gobi.c index 7c105eef992a..10ce2acc0cca 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -51,12 +51,9 @@ #define GOBI_WMS (1 << 2) #define GOBI_WDS (1 << 3) #define GOBI_PDS (1 << 4) -#define GOBI_PBM (1 << 5) -#define GOBI_UIM (1 << 6) -#define GOBI_CAT (1 << 7) -#define GOBI_CAT_OLD (1 << 8) -#define GOBI_VOICE (1 << 9) -#define GOBI_WDA (1 << 10) +#define GOBI_UIM (1 << 5) +#define GOBI_VOICE (1 << 6) +#define GOBI_WDA (1 << 7) enum qmi_protocol { QMI_PROTOCOL_QMUX, @@ -411,7 +408,6 @@ static void discover_cb(void *user_data) { struct ofono_modem *modem = user_data; struct gobi_data *data = ofono_modem_get_data(modem); - uint16_t major, minor; DBG(""); @@ -427,16 +423,8 @@ static void discover_cb(void *user_data) data->features |= GOBI_WDA; if (qmi_device_has_service(data->device, QMI_SERVICE_PDS)) data->features |= GOBI_PDS; - if (qmi_device_has_service(data->device, QMI_SERVICE_PBM)) - data->features |= GOBI_PBM; if (qmi_device_has_service(data->device, QMI_SERVICE_UIM)) data->features |= GOBI_UIM; - if (qmi_device_has_service(data->device, QMI_SERVICE_CAT)) - data->features |= GOBI_CAT; - if (qmi_device_get_service_version(data->device, - QMI_SERVICE_CAT_OLD, &major, &minor)) - if (major > 0) - data->features |= GOBI_CAT_OLD; if (qmi_device_has_service(data->device, QMI_SERVICE_VOICE)) data->features |= GOBI_VOICE; @@ -748,14 +736,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 Thu Jun 13 21:41: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: 13697492 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.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 4E87613FD66 for ; Thu, 13 Jun 2024 21:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314899; cv=none; b=TXMGCUwqIjgmqunNYFLG6S4Flf3yutfwlJPY3DfkWusUP6ZQ/Soui53Vdm8Dzgvl38Xc2Ct6xRK3EzoVIIxTX3uNiUj4yUEjv9teDL14rwUM+KDiIf6q5wvhlQ5CA2SqzTrj90Id03/wv9Umia9AFP1XRve4m6nC7mCSDRzyzpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314899; c=relaxed/simple; bh=QBF+sciQyaGmQX8QMmhepIuCOAVjsoEDOP/io7RtMAM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CC4ts4muJY3qnG3MVORZeGFPwhBBVVN8qv1lROOwOtTVsXFqea//BCtt2Pb3oKUAzgXKqytuppr30ukQTS20FqmXR9Jv4RlnxGxrgq2fdA6ig5es2rKGiBHy7doyFwqRvUEYScajwrZeI29e6j19p658BYRkIdtk+olEawW0xGI= 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=Ncm9Vdc3; arc=none smtp.client-ip=209.85.160.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="Ncm9Vdc3" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-2551f9437d3so876020fac.0 for ; Thu, 13 Jun 2024 14:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314897; x=1718919697; 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=Ncm9Vdc3FRToQd82CVlnL/ZNPGD6/oy62oGPhV5ynmPZ+qkuUf61huVhYHDMC2WkAv JSUAp4CVcLRRm2+hTQ1GqlNzIN4ITD9qACYg68pMtXuDboWLpWYD+hyUgbxRluFPNiTX aHVp/0kHsgIjtpTMcp7xtRq4S5Nh3zx6qFSpDrssx15IVcX6q0rFwyB3H1KLlifQpj+M EBWbTOHPtr47ZDvviHQ2rBEARs9HXxQ8mvIwa5jcOnZDX1wEZGQBNSQPE+nRTVK0Kxzi g8blWrHrmrgTuX/Xp8jqS4OxQ/bhEezOCg4oYK959OPIkE9FTzPy7NUAtKTatLsqMQ8y Llxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314897; x=1718919697; 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=oLzvXRkiCVCMIf8wASIuU1SzQvWdPHiyVYn6IfweG82mNuGtniCLR6BOBXEnft2vfg 68iFPPsR1VPs61e/t/wnfZkkBosMF4gxxaSiMpgIZlsDderhJBUpyasSBzwujlIENogB bfQq9vKtFV6Y+l6riqUH/rtnjGgxXNBkFFmH9FFb3x+S6lfbBR1vqxWHOINz+2Xr+Y1K yWF1xfYy2vnD69nw0SAmNABaYFrFs7zyAC1LM4FDYaVLb++UROpc2PxOE17LmLDS+Eor c6B5uMu3iaxQ2ZTdQhEbjQZXhxFz57/rs8CWtEdNppTH+vG0dY0imVbWmyuklhM1DCHi warA== X-Gm-Message-State: AOJu0YziKapb8vOzoyi2oWcGXJ7JC/JcMi04Gi8VX+1bDeRkk67dHiHx Gr4DNyR0IWjurQRraOBcscM2MYUlLQegppGdz9m9UVIM73C6UJGQFE+Xdw== X-Google-Smtp-Source: AGHT+IHPPXS5/24NRMYUpjU+jGeUxG2dF1XYLoWoaEWSYD7+vlsLXeXqVd8RSQtuRxh9GXsYbvYQPQ== X-Received: by 2002:a05:6870:9589:b0:254:de02:4c65 with SMTP id 586e51a60fabf-2584288e57emr1076015fac.6.1718314897321; Thu, 13 Jun 2024 14:41:37 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:37 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 02/23] qmi: lookup shared family directly by type Date: Thu, 13 Jun 2024 16:41:11 -0500 Message-ID: <20240613214134.1056517-2-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 Thu Jun 13 21:41: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: 13697494 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 73EE4143743 for ; Thu, 13 Jun 2024 21:41:39 +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=1718314901; cv=none; b=PwtGmqADj68/9SfK6Oac079Qm3tRGOOGrq4TfMRacPsFRyZoxgiYO1b08PKCD59yjWIuSOyHILt69fBXkBwgzWrSOnFR0g5ae9TQ9lZQCCZEe1mxRHCNKamRmr+J+ThYjyJDOMmgw81tSAJbSojqiXIqgIdzVIinUZnxxW+9WsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314901; c=relaxed/simple; bh=v3NYrCIbc8O3gNo5zAII2decMYYYS0rNP05Ofuq3Hrk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VTS48a9ZAWhM6iqTMU0U/+1XGc5Ce4LwIu+NhFN7qKhSpNv4vxXTMqS80z40DDycbOtwnRuR7FChGZdu3HCe/VS2wPUkVsjQXYbSVpA2RGy8ILRurNL8dWmpp9XUh8JsEm2TRKHc+DdtgfKhC/84dUXsgKMa/fmLZrpgw7BsmTE= 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=b/ejRpkN; 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="b/ejRpkN" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3d1d08c7c8aso828231b6e.2 for ; Thu, 13 Jun 2024 14:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314898; x=1718919698; 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=b/ejRpkNEqAzDPX55HW908xVeoR8Au+T7aItEKmQMBYKUBAaBDhaHNGU+UmpksPzx1 y6educqgaIMoRZgyRT5cesf5bEOhk3Ob4Y86gIxYqXtoKs9LPOJr8uHmaOOb58E+TfCb wKBqebrni37EyfeV4NfCR3m2mgfV94NnKkulz6ZhAycahICxDhAIo0mKHi2IBqBV0lKm wWpX+P4MRs5oCpL4Xx31FnWBeNGNQ0cBf3Q+k3rW+VcscQxtwuzoLCnFuZU77/lkCMaZ 3RieuNlQLRkfkag14hmZFz8yu87sVzdAeznW4QP6eSPdaJK6+8i7nKnCf4RKNFbPbBEt laBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314898; x=1718919698; 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=q+aBP6dlVuRE5awFciZ+6FlyKWRWy93J828KS3qqgQ6pZiM3ruIMkD/9LzD6FzW62J yGYwAyWIiX/VXf6gjdNZfM0FcZ3PLRrRXJPGS0Q7mH8AdfB+XCxpusZJ0LZRmIxRQEnX wTocYoLJll+JZAfwRhhT1Jc7eAxQHf6VVluNSN4xBuFxlc+etJbRuqV9IeIs9TC8uJME QXykrD60Y+a03tGbpuSuL4mkPF6wGz3+Dp5EOUONFZuQ4FaIaVyjd+da9RqwiE5Rd9km Lteunc+8tD2KsCRmScssSW0abu8TCz5QuCiyKDlqMzoO5kfqiZm87of8JCWPSV164Mig DiPg== X-Gm-Message-State: AOJu0YyMV3XlY8RI1Icj7Ll4PNOvStaSIN4adsVP+7yb4H/g3M1ExHEr 1dcdyPdguz4V/2g3BiHNp1but7FUw2sNMDq9e7ZT7dVTP9rgDGwn9NRM3Q== X-Google-Smtp-Source: AGHT+IHowmFy1ilDitpSAONm+LnPIMRUCFvtj8QDe+1db9a21U3MfKt1KnPLZMlFGdOmJp2O4E3UoA== X-Received: by 2002:a05:6870:d183:b0:254:e89e:fc1d with SMTP id 586e51a60fabf-25842b836bbmr893792fac.51.1718314897978; Thu, 13 Jun 2024 14:41:37 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:37 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 03/23] core: allow multiple args in atom constructors Date: Thu, 13 Jun 2024 16:41:12 -0500 Message-ID: <20240613214134.1056517-3-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 Thu Jun 13 21:41: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: 13697493 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.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 D3F7E143C7B for ; Thu, 13 Jun 2024 21:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314901; cv=none; b=KosnmhhvcOT8uicx7/lL8FqIKPIC9M2vZfz1N0V/f6gcuFNc8+6IDTuWfWfNRhSfpD65IajDIiY66Y77GI02RsoCj74gPtZAV9kWiVTVEuRxLu6WNoPSYwqMbZd0aHT1GUHDODtJd78f/g69rQBODzCREBZYsku5VJwmVtrBKhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314901; c=relaxed/simple; bh=oenWwScYhH6lxXUYh72CYQlds6Qy0EszKgFxHy7c5uc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JdtEjFiEzy71SkBqxx4SSqsEtNDo3kusY8KjHAXuNhdBeS5fcntmfMZRZkJqIwLE4m3s/nvem5VYc6DX9wlfyhZapa6M+A7JhNKVLbaIByq1HtQr2A404SzQ/m/UTTeGiH5LFCwNSenH5PO/JdVSl+nmOaHITyt/D9lArt2yypM= 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=Jmu5KFD7; arc=none smtp.client-ip=209.85.210.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="Jmu5KFD7" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6f9b4d69f53so831853a34.0 for ; Thu, 13 Jun 2024 14:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314899; x=1718919699; 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=Jmu5KFD7AeBeTG78YmU3yqUDImv1APlPUopgM+KC9UhteyEc/Lh5QzN/Pi4JYZfe37 Y8kX/EI3vUPtQ6f54J7Cccw2Fim895GObsE+FCfVz21GeLrKRQGowB3LxlQl0gaRYud1 bTTY9MTo6JmRuduBA312OvlR4RKJS9LnhM+K9TA/bbl/DjNAJUGFI/2ATgbvSU5vwZIi j10JDJ6eNlgMQa+BUH6t96PDqI4J/6CHJhvg9Fu2AAJhQnv6UKObl6FUgqnT46cEvMkr assmuOZY9tcTsrBN/7i9eV7JDCMl5003DmpKBVhPZ8DvX2VWHSi2NZ1p2gaUMHnwulrY +bfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314899; x=1718919699; 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=uIAVpDhGDMCSLn1Xoca39hZoWg8nYGOsTwV43L9D8OI2oieiP6EtQ/kOdj47/qhCAb 38iE8E2aUrZy+k5g1ylWCajcBnBh0E6FO5Fp9+pyLumhooPJr1ICj2RufT9ObN16tc3p M2BnQ924yi+ZYQRwRkjD11a0qoK3yfHd8xfzd3UAMeG5OKFzo+mul1gZM0Ch8qmJx5eR OZ4ZfQmVhqz7AmHYwBK5CoSfiFTH6mxZI3EtSf4vRr6d76hM0GKB/ktMqf6DoXYa8+uO 1tdxHjZ8xAemInt0bhcbBmzTx6XiSAblu9usiUC9XE3mp4kz5HiDVs5SdYqyWsbXw0Q2 eWSw== X-Gm-Message-State: AOJu0YxaxkgySzH7Q8+gXfCZVIzkYqUM6/n1eEo22WdQ74aP7is1Ljjo 6rhdREiY8MEavN/yAT/qC7y0PIxgbvlrzn10CzYsdqRYVfCyN47HWwRHFA== X-Google-Smtp-Source: AGHT+IHZSQLVgqqNB1ZsQq822OXlPqC69r3ybBa6R4n0aHMdcTPFiEfGgnukqkvj8YBbRVYw7qKXnw== X-Received: by 2002:a05:6870:89a0:b0:254:9c46:8877 with SMTP id 586e51a60fabf-258428de7fcmr808332fac.16.1718314898655; Thu, 13 Jun 2024 14:41:38 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:38 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 04/23] unit: Update unit tests to the new API Date: Thu, 13 Jun 2024 16:41:13 -0500 Message-ID: <20240613214134.1056517-4-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 Thu Jun 13 21:41: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: 13697495 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.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 96F0013FD66 for ; Thu, 13 Jun 2024 21:41:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314902; cv=none; b=WMVLgbGpVwX+cuyeoKU3G67sPJufzKjRRwBDHGEfKVPiOEnU+NyupMzWqgM61nT0iYlXJx7YA1AW3yQnwAhMNfvgpaJaiFA7YWgh5ztQUmS3yNINee3vfJZcGtj8r5PRxOI+pjJun2TEt1Vbu9COD05kaCvIjt9PAu4Gya0i4Dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314902; c=relaxed/simple; bh=q0KuagSasHgfO/XncaDRh/6BzWr6ELAnEle7dOCmhfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jfqQxm5ZJ6RpBSwnzpIKuiIIGi6qFOvHcAyWK7WPOKnJZbbs3bCZhnI9OGu/d8p5lF84BE1QhlotVZgmXNNlERBrqlx8FtLQPivcDYYkxAWudz+SafE7xTYd1wHZd3WxCd4rkznZbSG4AePVhAGP4up6cQ/qhazzSHyKYx41HqA= 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=HgR+7J5T; arc=none smtp.client-ip=209.85.160.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="HgR+7J5T" Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-24c9f73ccaaso843517fac.1 for ; Thu, 13 Jun 2024 14:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314899; x=1718919699; 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=HgR+7J5THeG2kFYjhN9YVpVNn437yvQjSQMh5fJwbfARVbMmrZV8VvrRWzqXX992NF cA+8cD2C4x+Aiq+QDcwq+ubMhrQxySsyyqt/BWIkAgmxI+USfhbQ+MJXBMEHuQkyqj2g ZF5sYTtybGnvGeLREqkowpuQSLp/5XDOD5DRXJLifDM4i/2pNQQdJyRwsc/l/ZUXL9RJ D59kN8BrWwcxsmlEcBubSb3hcky9/HPG2uIm01VzXEdTO4cD5gy7Y9WLXVgO++NI+gtr 1x++cbsvYbiMkoEuCbDXu++d74xwgTDVpdf8hHct13ifmpjGWk2/ATLEDkMXvuJbgTiQ tcXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314899; x=1718919699; 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=lm97qZP9IcUMC41IwStNXtMw1tpehP84CJPM+E2UuwBO+Ki5avGx45JR5FyTpFdax9 Gpk31UznmLvAmE5HftGtPhZx7bZcsmBMuFBu0KYLo8Q1ZH1wGvT6lZgDcjdCf1z8apFN Nc546gQVNCgm7Ol4miXcqrm+N0MN34JAjPpBu0wbZqEqPUZGqaJd11eRuiDdGr3OpaXt SqFY1i3QsvrAV1SJfud+4VCIXk3xOAUe1e1TJPorkbCuKAyX0oRErzLNsDa8WcXLMdnF SAEua01N10xiYNu2vilBPD38rfZDUe4rIShHY4wUlNTq60ulvnPJrAvx2LSnaoTVAE+V /7HA== X-Gm-Message-State: AOJu0Ywpl4PyZ9Z1H+4X2rLJ7aG4kt7qTDlsoiT2IQk0eASAB2fp5m9D stx0XB97K+YN/b6t6+FnpPIuxjMJzHOzltxh0SsJETLN+QavfcmsfEbpQQ== X-Google-Smtp-Source: AGHT+IEIeLGZp3O9mw2AZrKIDdOg61fLHb+Lj3YwOilJICgAO3M5drUYEGgvP1u/zGectETtxGiZsQ== X-Received: by 2002:a05:6870:6391:b0:254:c8ad:7355 with SMTP id 586e51a60fabf-25842911546mr875292fac.22.1718314899357; Thu, 13 Jun 2024 14:41:39 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:39 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 05/23] core: Support register on probe flag Date: Thu, 13 Jun 2024 16:41:14 -0500 Message-ID: <20240613214134.1056517-5-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 Thu Jun 13 21:41: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: 13697497 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.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 5A7D0145B0B for ; Thu, 13 Jun 2024 21:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314903; cv=none; b=EKeizbC6VAG2v4CrJlYtCvbFk/Mxdvndx/ltZGGgjTOrTsBuJ3pAl33W8bdSpvJIQSTXpWqmJuEGA9asJafZ5i3igKVjPxWVP+YhQB5J2NYRRfv/FGRe57GMCGT/BQJ5mtcFI9iUKcrKSgTNfb7pFedoPobtNoeSNURHofujHQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314903; c=relaxed/simple; bh=2dmAhmWZ/wPkyF9FB8Oet3/n6QpWt/Q86pnqLM+OQo8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lZFGTeNX14+a/FJ1bWM7pObJXgudKif73v2u2bLDngrXYh4WFir/OygxMr2HeQbDS+OCPnEbxL3kyeX0vGtH4ngP3AM/mgdvULNMctIWnI7yuDM9Fq6JT6sARlAgScWnpQSskxTz1/TvP60CbY4AeQwaRtfwJfwgkplVt4hgbvU= 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=d9zRrg0u; arc=none smtp.client-ip=209.85.160.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="d9zRrg0u" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-254871388d3so789561fac.1 for ; Thu, 13 Jun 2024 14:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314900; x=1718919700; 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=d9zRrg0uUl9pJJ9vMkd3uYI40OT3zTKt1z3wVtDnYhkYruTzcP2y5eLJ135QpcRsEU p/ioKjnCJYM7JYakVzN26V6tVW9Usqan0LbEpvNTHCB6/I1NtXjoRYhFL+m8zxAp9f3p iR3xpMKGlDC/of40nKDRn70YB68ZjrPXF/YYxCRPbaA2T88f89QBOikuFhJJC2WvOg44 Xwy3Hii7GTsAFE5a0Cl/tEHHQs1Nnm9vWyvvDyLaDGqw1Jhnyaf3W7nQbpI5j+U5nwMk m7oaeNUWdurTSDpFnsPvu5isXFxhisggPYpxGGRNI/ocLtqclg9w0l4+AtThESuDa9AM Clmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314900; x=1718919700; 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=bWK2GY/Enk4imyJfooJ6tuXNEfJpU+TVyT/oTbsDCFCWwRhNEBGNiuWKkCo7vfW6Vg 1MAQVjm9aFY4oFLhyZvIcqn9V3T693sLzBAMQwlGxNgIPaZH+zZHL034gknYTsoLkusi ycw0wyHD3k+Nf3wAhtl3vs0emwbfKwdnfHPJSYMM2HRVvkGlXro5XmpNHXT2m00777mQ z2G+ZQJBUcnWZSBn+KxYrr0Tq0ndKq3Fpcp3q2MTFpLhu+nSEbAY66zSOIz8w3SsUzTm 5Qpc88ob+LVVdIQ5WcykBYQvzTGKSmvmz6hKCvIflKG7baetY7L5M3hREFVf8IAfX6mK tAKw== X-Gm-Message-State: AOJu0YxX9Dj6wXDSHpMwe3HcoRWS0Wpc1hb7vQ74vYmtF+ppL1KdG8YJ QTPkPLllmAHJwecShepUNJzhhznhMWMdjjBzDyBQc8+pwWa5Tns0g1huXQ== X-Google-Smtp-Source: AGHT+IFlq7vopFANfVPxlGgS+9YxsCRDGBoX+IdyEX0dL9vkCcPSZrL65BCXQPOnB0syf3skOR2pCw== X-Received: by 2002:a05:6871:e020:b0:24c:afec:f1c with SMTP id 586e51a60fabf-25842b7d122mr798267fac.48.1718314900209; Thu, 13 Jun 2024 14:41:40 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:39 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 06/23] qmi: introduce qmi_service_clone Date: Thu, 13 Jun 2024 16:41:15 -0500 Message-ID: <20240613214134.1056517-6-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 Thu Jun 13 21:41: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: 13697496 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.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 0DC3F143743 for ; Thu, 13 Jun 2024 21:41:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314903; cv=none; b=MmatXGvFvnyOAMZu/rSTJYP1HwA1GL2d0EVxVDoaoB6FmUu0O5irySRy8yYfF8ciCS+om/Sd+KugD2AIEJZaplobFnlTPrWIiebaDvIXsqHvAbDUAhozwtwbtyMi9w5sAKY6FzXLgeOFog1iW/pS3c8hT65JOpHgHqNwG9AisT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314903; c=relaxed/simple; bh=WrA9m0TXFRn0loJpUZZcqiuLoxBOX1PtmZTmL8QYSnQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aqr7/S6UyCeoSN7LGp23fyAaHRlUb7Cqzqnt/sugICh3uddjpkLwFqBFOfvx1BtTR2LFupaR/v3HNMoG70qVzM7OmxQFV49e8nfexV6ve0GGaYTSnUuNcVO/QC25E9Wiacnr4pLsCC6jY/3fmSbw8iPAerhN+UjAr/cQAbz1tsI= 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=KsUt3Lrj; arc=none smtp.client-ip=209.85.210.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="KsUt3Lrj" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6fa0d077694so732622a34.0 for ; Thu, 13 Jun 2024 14:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314901; x=1718919701; 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=/CpejFktLLO6xCcx9x3+xi+oampP9zSGMTWvJ6CVFX0=; b=KsUt3LrjtWnBLYk1jfXTDonqgKtXH38O2HG+nE1hA+hrjD8kY0mr/4wFYWgI0Ri3TX lP8Uhg+c/Ocv6USympu1diS4UBI+WGJExuaGDtOJ7+YvmZd26CblH1p5pWRy7BeLQT2d UIxzq2bDfpv0HIjB9ekdPGOBa/hzzbsq1EKhvbBka5JZrUDMfKR9VewVx9aXBZoYe9n5 Mg6lpwPAAW3kJ5G2TjLwbYzxwZsoj9zCT2nZU4MLbvhuyulhiqjbnOZfRIBsbBlYHZ1p JTZe+WxJpDpJfnF1o5fVMKp8G9Unq1ZzG0c/E1FNVTUtkBs3RkzU9UUau1lZRuNscQiI 4Big== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314901; x=1718919701; 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=/CpejFktLLO6xCcx9x3+xi+oampP9zSGMTWvJ6CVFX0=; b=nTp9VvkmQpubO0+X5DFs5jiSDvEu48/BF0AV4uN5W7n1dL6awbT5oiKEjiWzFeAkEj XEJ9IoFU0e6TuxKyfKxLXMPXnrn4a1PdrpzNg8+YQYAdllrQujwW3W07TMBzT743NKbN fj4Jz+YEwU8wXSECCjMdavyuWlvuFkyPKqVqGH5b+0Fr6VU82lqI5cKnxrQU556KtVpe 8TdoeulzCsrb5iWplLETf8fL4ndwJtMnPY4ShEeKVEp3HPkYhCKhmuwlQB04TQdVunPc u8bPKlGEbrMiOa7oHuWiU+6KxGzzF9tR3ccUhCe+UuwoA2VeIY9OoqhTvpB3JJducQoM HR6Q== X-Gm-Message-State: AOJu0Yyyka1R3mDt39xpRJ2wKMe/CyjQ5zE6gKXEmrToH3cCajp79ooe 5nMYTf1iqxlN/ORYH6ZnwIZrIdErcxxmFpZreVJ/1MCg/BzleRIem5OPsA== X-Google-Smtp-Source: AGHT+IFvzM0FIhsBZjiX3a4D8LqPed9w8lqL+lUmhu5xwkjk0UiNZAIPkt6d/3YlDbgPRuLUaekqUQ== X-Received: by 2002:a05:6870:14d4:b0:258:476d:a793 with SMTP id 586e51a60fabf-258476dafe6mr330917fac.19.1718314900947; Thu, 13 Jun 2024 14:41:40 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:40 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 07/23] gobi: request needed services at .enable() Date: Thu, 13 Jun 2024 16:41:16 -0500 Message-ID: <20240613214134.1056517-7-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 10ce2acc0cca..ea4d633c3406 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -60,10 +60,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; @@ -161,6 +175,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) @@ -183,6 +215,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; @@ -376,34 +423,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; @@ -434,11 +489,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 Thu Jun 13 21:41: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: 13697498 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.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 BECF314659E for ; Thu, 13 Jun 2024 21:41:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314904; cv=none; b=C7XolvbMO1biCkTwOXTbzHx0y7m7g9Epq3TvP9RLY9KY7lzO4zRxaNaorGqHwXbKkkMGEVZUa1aTyw8zz6XiVCUJc3clOef/h/dKkz++M+zq43NErJi3K122meNQQglz0ach3E7/tFck/+hj1PzSUxSV2hu68YgqQyaDz1E5DHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314904; c=relaxed/simple; bh=yw9j6Ke1jitQxZ5FJckSf3kpQ9H4pDL+mAIx8YGPY48=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UX0YBPdMzI98qBjV8qghi3QLLE8XFfvMUDhQC0McslV+lquRTMH0TxS4YFmO2C5S0BiNwAqbUYpRHiibDoE+zSsCKB6SNuYnoyWQVHqjcQoSLz0gAWsq/4VT7vPLz7ZIK5FozY/7W/oRkr7aG4pGwEBRQ0gQnZjaNCHk8drOyXw= 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=S38fcAH/; arc=none smtp.client-ip=209.85.210.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="S38fcAH/" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6f98178ceb3so850885a34.0 for ; Thu, 13 Jun 2024 14:41:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314902; x=1718919702; 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=n9YB2++cE8QMzvUCw1n7wUwm7KsJ2TiLsuLWQ9/yzZw=; b=S38fcAH/46HLY09oUKaYwdTIL5MZTbf2SXYgkNOMRqqOHmkNCJbYAdwyVmIWs1a63W F2yHQSvVK5OrtEmc8cBGddZ2QiUF61wMDpJ/u1lEtV8XdLydRWTVqFoVWIxiWXRK1Gbw J3IygTlIPL/+l9XrWeRlOknejZ764Gg20zjcjgO26lgl1+Dfto2WwoKFiVvpURi790sN s71yNaTEkBcXW83poDHnR+SMw3h7+aCSOGB1vYq8mT9DOdWGOjRPFlKyIHP0w2+rT/AW 7TlWtAr5t7eFncCT8xBaUwJt5ok+J0cZpnVaxXwU9NzpX1mnx5p6kdlFFKRGhNmf5AOn LvoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314902; x=1718919702; 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=n9YB2++cE8QMzvUCw1n7wUwm7KsJ2TiLsuLWQ9/yzZw=; b=fwuYAIr71EHXqd+2LDz0sIwA6mj3sMghbk/2z5u4EtbWk2MZkIb/30Uck6yHhTtWdT roZ1WJM9geHIezqaDiZtNWoshdtA450G6/QrTjAyBXWHdLA8sU/Cu5NI0WnjZ5J8QHg4 6eRpMhBGAK6/XeKZHg2wm7/YPh3+BMGYUHQ2ce95WD47MMtSgnBkM2zAE1ArXBgQHsgc ZeS+ZXlp9cXtX2By1CfqoJqtql9vtkyPEMQpzZSB56rb7Waq6t/XBQJDsZHh51LJZAkc iCtnsFhXu454ND8tWqhyFm+/Nnn8tO5Yu2foZ8VxNvXu1mae6oG2gufrr6WUmZ8LgRuU Fygw== X-Gm-Message-State: AOJu0Yz3YhmTj/Lno58ZqneeGjA5Y3+/3rWFBwttpp0TchIXur+7c3jr mREuHpiB5U/zw9bTHy/4qRWX+irdVXMSApjT/POKOk9IRRIfsJh73C9Zlg== X-Google-Smtp-Source: AGHT+IF79Dtkp1xD1hy4jXXPJ5qAxBPK3vjwBJ//fCodJL8biZjE9VEwfGAwqQD36cvLkUJShfFhtg== X-Received: by 2002:a05:6870:15d5:b0:254:b781:2f71 with SMTP id 586e51a60fabf-25842be93a4mr996286fac.57.1718314901628; Thu, 13 Jun 2024 14:41:41 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:41 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 08/23] qmi: devinfo: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:17 -0500 Message-ID: <20240613214134.1056517-8-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 ea4d633c3406..1817f7b5ee2a 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -713,7 +713,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 Thu Jun 13 21:41: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: 13697499 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (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 7F81613FD66 for ; Thu, 13 Jun 2024 21:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314904; cv=none; b=bC0rIGh1KwObSy3wYmgtiiBXViST+5tgdBuXyS/cFNYFFTWepNRVn2Dlc7Q35x/Jct6i9FCBqBbCy7KNdAcauKO9FWFEmp4ktzd0X6fvPvn/a8NTwNeTUsmjBXbjCcy8VZU2jFg90V1/gewQYG+jJvi4IGv8mx1gKY8jLB3oMhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314904; c=relaxed/simple; bh=GAYy0hgVQuau0DVTOTluTy4cwDO1RwIEZz9a3hkOAyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J40kXzLRa1zlBULoG/Uhf0759ZZbhCG1R3ShVwy/jA8rcvX+3C1HiIsk+NvcxHXXyF/6TGff6/eAVJ95mkYwNCeS9b+pmWL7vUENQqVyfwoBntVV7k4eQkcF+k+qwaGEcn6r+OOWQBcUiDXXZPymvVxZgxHsAfnbfW+tNiH3eQI= 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=DadHNcdk; arc=none smtp.client-ip=209.85.167.171 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="DadHNcdk" Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3d229baccc4so785162b6e.1 for ; Thu, 13 Jun 2024 14:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314902; x=1718919702; 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=c3XD2rV2E6vwHXtFUIJfSGiwX6p4QMJKAlkCKhxbipM=; b=DadHNcdkZegcx7LZGCgF9VjP66oh8Iwcg2mHgDvoINmT+ASPgnaunigVcr27LuP4bO 82ss1R0+zMcd1zgP2fP4N59WVaBpOwQXb6/onoD3UJ05Lw2demojz0/KQmk3f+ZVxCpW ACfrAZb17deVfyFnMUAIRQrachfJh19pRVkCAf8tTXWOG+4ymkl+BK/NaUDjhhkpsSIR JH5JDtsPHtUeJUzWtuKY3dUsW3IlR/lUxjKC7xxY7lDm//OAevx0Dd0qpC4bPVkoDkTx MyFNhgdIwxUiuFgafBCBrUOPQvWi8eKYcdUtiGrGRCQ1PL4LQG1ua7RrLuHpQba1OWsc 4L2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314902; x=1718919702; 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=c3XD2rV2E6vwHXtFUIJfSGiwX6p4QMJKAlkCKhxbipM=; b=xBgXbbOn01alRDYmBv2aiHkbO2jA0K28PAS0QmPlrbVpXlXRwgUx7C60TwH0Q6SDJW SyamruXWizdS3vPsIhkYl6x6atvI+4oOEUzVaC2LIc7caHfV3GVSIQKN+bfbbASB+Hrm jzReCnfsiUOmwNGsGd0cIBg6eEix1Yj905M+r5GgOxpRUMNhA91xQ5KHje5ojcNeMLrB 0dlDcz6qiMUD3dAa6DV99y+0xNpjUlpIOPg7pKLht1u84098b5vp926V2jttNGl91UPq fH/esxVjKjepKKZ2ZOfCZTdaKwRtoynaWbnuH4ZtZjOb0ownK4ct2klFTX2UX8pYbDB9 YPfw== X-Gm-Message-State: AOJu0YzHTEeRNR9afC2csx1fUjNldhiwmniiAdzcr5kq/NiRBSSh15DM /fCn+lDr5VCJQr4Shh/nIM5lhMtKJnTLtoPbFukEYpwd3R5RRNi/YPPWww== X-Google-Smtp-Source: AGHT+IFjLCVSIYTspwbYwq/ouj0I+8ZrzZr/FbWMQjYbG5pmbY3ERN8XeQwkCNp/tAzBawRkrlDz8w== X-Received: by 2002:a05:6870:1494:b0:254:f00e:569b with SMTP id 586e51a60fabf-2584289164dmr985492fac.6.1718314902307; Thu, 13 Jun 2024 14:41:42 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:42 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 09/23] qmi: sim-legacy: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:18 -0500 Message-ID: <20240613214134.1056517-9-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 1817f7b5ee2a..deeccb7879f2 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -709,22 +709,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 available */ + 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 Thu Jun 13 21:41: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: 13697500 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.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 3A432143743 for ; Thu, 13 Jun 2024 21:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314905; cv=none; b=H+9sfWfJlMVr+kuQUj6BPPdhqwlx8qG2PwX+mCu7kcRWMWG47qd73PDLCqzd78/0Wv0Men5CvWpFaccJWuEUlCTP5qsfRcPX+GKvKF0+yhZ5L/JsLP3H8G6SNahmhRJSTtwqAlhlmxjpjOFJ7w0j4Jn3Z05S1QDHQy91l/6JurI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314905; c=relaxed/simple; bh=yOZ5qgCa69LvrotwRqxXLl+QInniKIJGduxndwKTOD0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pucv0vlPu7W3Bee8DC122Ym2zTChmPxnkp1ruGEVOJCru2nRQ7mjJlZi0MUfwuQiT5ZGPtxflM75o8i4GYREYPo4aW6bwfH/KUFeVfXAplT2/cAT0lJd95/KY1UMCquKmbmb4bO2Xr5aBQHkZLm6B56JEbYkW/IS+NA2a+oU3HM= 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=SrtlrUJy; arc=none smtp.client-ip=209.85.160.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="SrtlrUJy" Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-2550aa6f994so869022fac.3 for ; Thu, 13 Jun 2024 14:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314903; x=1718919703; 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=9lYkf6fn57/GQfylP9IZu+t22XH6Ky/iy/H3F5euBuE=; b=SrtlrUJyRuN+H1W5efkdwQR9tPE0jEkVcgA7layqTXeDacTpPew4ue9BtW9AEerLhR iu3xnWyJ99Wh/8KbkAnZw8IcwAdIY733M2jD2q6grdDSejkGx8SxJLGYmzwni7KOiKA1 pr2J8x2k/vu10xLQ0CzNM8dRfIsAnoSQ4AzUF6/bFh8yW7b8OGt0CrklLcrC1YlDbu4W t/ae54XYafRi4Uy2oOzJZ/WgL8IV+RAPEbNM4HohC/uuFlmrfgkO5LFutHmtps8bLqxi QBrjqtcZWBVRwfgyzYKUuOtnA7qxcgSxPX4VCYpxsVZH1qGxmDuE2U+EG/xWG5MDU6Xn hkaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314903; x=1718919703; 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=9lYkf6fn57/GQfylP9IZu+t22XH6Ky/iy/H3F5euBuE=; b=h8EpRQdB5heiPGXmGXcDAYdRuuenaRvyhQbURHWuu/rYE+KcLFw+ez6kJrOB7WXOSm zQH5VoYQ5HmOzMTVlwuRLmEd+2UuIUsRzIY4RYVikjOeES8qrQwrD9vfmcYNeWOlkxAO wyD0ktHiZKJvhumpXhfYamG0i3bUg/LKlJ3RNEyblWTn/16eepPi2/Vbgst9a9X2uZzb yxRqgHEfKu2YRMYKd2t0kIdjmiXyVisXJYQasVgY1B/Ld1EpdkGcpJjcNlq6SpS8z3iz gYCWb+uQw4sRbyoCNRLQPg/3pcIzOJzUDm0XaVdA+muXIb9tZJ6uTj3Ny1aBEFKkycqU yGMw== X-Gm-Message-State: AOJu0Yx6yQocljlDB5ByR2qMylc0lkcAFn/ds949OSBRveh+MH6GYWL2 Toxa9eBfQxeMX5snQGI2xLTM+6ZvI57FX/HCue4BybOHseAyhCPz8/1k8A== X-Google-Smtp-Source: AGHT+IHGX9lh8sbAg8UJ65oh/slkrsSOtOBicR9eZddFfWoFcfEukkJ7b4t0bQfWG/RUYjA7P0L5lQ== X-Received: by 2002:a05:6870:b149:b0:24f:c055:fc3b with SMTP id 586e51a60fabf-2584288f3a9mr1047736fac.11.1718314903092; Thu, 13 Jun 2024 14:41:43 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:42 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 10/23] qmi: voicecall: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:19 -0500 Message-ID: <20240613214134.1056517-10-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 deeccb7879f2..0494959dc838 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -722,7 +722,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 Thu Jun 13 21:41: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: 13697501 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 1B38014659E for ; Thu, 13 Jun 2024 21:41:44 +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=1718314906; cv=none; b=a1zjW4Y5Q0jERb1LNgKi8Mc9st1e8VVoV6XyM3S3tu9xidXYTIVn6/gc5VGwkx7Uwlj6JSzfue8dW2wmjQbORF+3GDDhesRTqyNSBVNJC4P1qk//YkohwF4zL9LwITgsY3ZdZPjqLsQh964/5749zo3jnET6VbnvhQBzP8oH45E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314906; c=relaxed/simple; bh=pz1PbvxYPyQZK4TtGlQZG6qYJbrPBWa4HMuGYxNGZOQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A/ixFDvGhRuNhISYc0X/B1p6wb/awgtP8oD8wPMV1EIKgYSI5iJh++w8CSfXTuFs2Za1iHUtdPOs8BuyfAb18lrfaIruUp1M/w1cXulgIgZzaw5EFLmqzhAbp8TB4/VrxuDAB2RFXngk8NfwY186QjQpsuT3A24NVu6cDmbEvZo= 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=folHUOc2; 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="folHUOc2" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5ba70a0ed75so798179eaf.1 for ; Thu, 13 Jun 2024 14:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314904; x=1718919704; 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=qsCSjlaa3wCPXb4u3HSezyBvJMvklEuUA0nVMbJyLzk=; b=folHUOc2A5FdO8ZVtgXcmqi2N3a3VSJC0RI6ZUaTMeGGHMHzq57/lbd1SHkPKnQbKj lK1di5WOHdcqwnIGqehiSuTx/Q6mW3pOq8HjaHopTHfi/PXGM3sfPP8q5F388uAG+uqG Ffr8G2ZE2V2wq4O8sZjQRnbXKOOIhVLNcWg+YurIhZVbXJcspbE9YYrcfj7mED8isKtT 1yVW+pvZAbTeTefxYgKDhdxz/XxZ+z9H22Lr+SjID5u/fCXscGMLjpmCQPQTunKNV1fe dnPokec0XnijwgbydFmixb46jLSLMLvKRGy/ZCRHQTHbrsqt4WcBEF69JdTV8zkucPqp LBaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314904; x=1718919704; 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=qsCSjlaa3wCPXb4u3HSezyBvJMvklEuUA0nVMbJyLzk=; b=GZ9/GZ1StubMqh5F2C0gFyoKB45N/p7nWeScY2ZpFkF0TH//VQ2DKBSsme/PaGrqzl 4RUt3tdfKBCVd2BHrcrRlgS7l0Fq1qGEK+4Z1Prxc9Vi1OLdgr27xoStPZjO1jrf/9uQ SIQyMaOa3l4dpKN20LLvtAHEFkIQ7oVEouOSJsMtJDPyuyyoSKzOdf8osVWPleecbCCe qrmzqClnCK/26CF19LHwez1PMAYHfMO+v3MrQ+Oy834jmaneocwHdhQQSEdLogr46jst j1Cg3rAgakE1l/piBCD6w+KNQUxE1EGO7aDP7nAGVz/GT1bPYc5ezEEcYinQPZ3A1Y++ dWag== X-Gm-Message-State: AOJu0Yzwv/FSMT18O4MrcaVPodiz28t+QvXQza5HbKMzOFRF6RhXDyXt LcwijB82Cyg7Q0FJYbSUsRUES3+HWmKqDgRdhVzryPWo89IjNneoVA80bw== X-Google-Smtp-Source: AGHT+IEEE9JG1j6seVY78eJVqtLqtx7QHmjgqgqu7vrC2OM/o75bOJhLnCAellTruyL/KmAFe7Je/Q== X-Received: by 2002:a05:6870:46a1:b0:254:85e0:51c3 with SMTP id 586e51a60fabf-25842af71c6mr989872fac.47.1718314903988; Thu, 13 Jun 2024 14:41:43 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:43 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 11/23] qmi: call-barring: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:20 -0500 Message-ID: <20240613214134.1056517-11-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 0494959dc838..7c6885b79c7c 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -835,7 +835,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 Thu Jun 13 21:41: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: 13697502 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.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 B4055146A8A for ; Thu, 13 Jun 2024 21:41:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314907; cv=none; b=kT5rU9QA5cB91p/olQVUOHB95bbVKetC/3dFeqvcfZv+wA/qbGngcNInMSjExw92PCge8jzwLiGPaZ3+bW2hcn3xPp2exPChztY9VWhSEnr8YAlhn71AvCQKS8m2N+DxsdiaSreQTmqdMOTRk7jkEczFvDuJcyjSuoOkqOcLRV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314907; c=relaxed/simple; bh=kBwyX8yEIIcD4snjHIDaz6qoC4OJqKDg5x3mIFk6FdE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EhUepulISzksvI5mZCdleLDXyU5ambm0+alL5PxAPmGdSSjmwaGblUHT0WsKDmuQO32dmoJD8im57CbpLy64L5LqrHrVhzf98rjtdXVm9tgCfy5nCxOZCmldp7yKpg/yTfbKf7QNhxfk7n/IDnln2C443bspfXEvq0bDqHBXzGc= 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=jtDJ92Ak; arc=none smtp.client-ip=209.85.160.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="jtDJ92Ak" Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-254c8e27c80so779843fac.2 for ; Thu, 13 Jun 2024 14:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314905; x=1718919705; 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=UDMY6Gv4vpIDjPQoiVLMdXZvuXP0bXGRAjAjXkvohVo=; b=jtDJ92AkXQ+owFDVlXTESo0GHCslRII9aWFRnY8WLJz2GKBwYGIanaL8G7B0ZQPfs3 reeQTKyQqqXJ0nQCT6psfu+xEf5Rg5jAh9ua5OFyiX9T2RI23TQpAHTsQhip6WuaFm56 hpIgb1j2qflaeBQCV8ldGq1O674iO44mQyLHsg1bsBokY9XvPj9W8KvWqRtu/b73GmlP ri74cAd/AEiDCnwI1A2Q+K+O0p5wDHO5k4c9jx+x/HM27R9rj0/6xIAzHzrS3WXEr7VE xuiHueIYJq5MXRcWmZKh17qif0VGmSCP1n59pWGXjQc5ZhE+9rGlEJ1UZ9lKFHwS0XG/ QW9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314905; x=1718919705; 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=UDMY6Gv4vpIDjPQoiVLMdXZvuXP0bXGRAjAjXkvohVo=; b=uohPpylC5Qj6l6oqSd4RL9mTV4qhslmTFbsMcbh5gsWWh77ajXgbCill8nIb/MKpCv rZpBgg+xfSLr+3ATe1sXO3EyqPWAe1U8E0vZSdjpxJUUMb5Zls5YJixhrtqp3CQ0gWmR ltN+xx/O8I2+Gza3H7KlNGUwBA1kqXdO9EdPgeeJ01RMEk2oAdL6riYecLBwO11Lg8vA ZrFWluMDjR3Ia+zX1ANFRTeBK6sfUNsLla0Z+LLb78ubL4LHaD8swOSvDAHbX6smKncf 8hvUwVc9vplOiFTqW8pg/vP9ov9aP6xfAp6naxXjp+r7wOUoWqA5EFnUNhkEtPfRoApg FTqw== X-Gm-Message-State: AOJu0Yx4oU7q+PMXz9rAo8PpREo+ClTIbWOWjDdayOFQjKAWzpOjQGNE CD6/Y247xviE/ea55Wqp/KzCFCO4Y6NsV44RGQpJ2NuerIOJrP4oZq4saA== X-Google-Smtp-Source: AGHT+IHIZcnEUoeaZlLF9KUXSvkXbly2nC4p7TU/yHbviZdVYfAU1mWYfCJrETGN44+nyNDo8wmUzw== X-Received: by 2002:a05:6870:6122:b0:22a:b358:268 with SMTP id 586e51a60fabf-258429987eemr956037fac.25.1718314904723; Thu, 13 Jun 2024 14:41:44 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:44 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 12/23] qmi: call-forwarding: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:21 -0500 Message-ID: <20240613214134.1056517-12-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 7c6885b79c7c..85ab427e9de5 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -838,7 +838,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 Thu Jun 13 21:41: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: 13697503 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.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 65BE913E03B for ; Thu, 13 Jun 2024 21:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314907; cv=none; b=rRA4KqKsQkqr8ssTfSmgO5klNYd5JeeUCMmt/RqhuNkySyIurt+wHLy3bfsILk1HIkojYjiKbSrSH5EnnqUPF3D+Y+iB2t1OmJ1SIihlEdjZuWR9VmNMz7x8tgJtJ8pcy2HFSY0E/rQrgxQG5SHG/sy4/d99aO0+xW96GN1QUpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314907; c=relaxed/simple; bh=gzLBEpSAHCybQcTakVHxzqn69rkLSZ1ITihpkdjlCpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BtcdIVvNqv0f8AMsiyFj0CGz3kKw4G5env41ZTX1SyYsi3RdWT3lbFviuzutTOZOvxXgRJAQYsOsrJgrrqYf6CbYG6xC9aRJJSruvAYWodbygpjrkhGXynmBGD14/Mywy/9FSF4xu247K8ktQ/kolfmhS8yG1zI0/TzC2qCWFIU= 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=a/EbQVCE; arc=none smtp.client-ip=209.85.160.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="a/EbQVCE" Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-24c0dbd2866so761875fac.0 for ; Thu, 13 Jun 2024 14:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314905; x=1718919705; 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=6IY/ZcEs08PB6xtvTE/xTtDyIm+yj5UsAZKTdlTcSgc=; b=a/EbQVCEvGtQpVKXJ21EPwRLSOUDvrwkPvW2ltfB1RBuYRE/CCaOJZh39cbT/T0GVE 7jcyJofQ23erOVM9FqJbKcvakGMVeqbqTiJsQahdw3MvkLASQQ85NMk5XZjK0HU1pRgM frd1hBBB9gTznLRziDzzLOw0NnyiVxD4D/5kttusmNkDFsUeWqhqXQte5A9VeWNOolEd clU3EWn7AF8uK2ieGsMtQgANZj+/zVRd5PGGX1zlTyoSRCfLyhJO6pkOV20HDBQb2u4j XSoxKSzl3lTEzxBILqSB6C2Ybmyqbxk/H4CVQjXtYTHRjolOOLdo7XX0auFEwX5mrhtX lhQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314905; x=1718919705; 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=6IY/ZcEs08PB6xtvTE/xTtDyIm+yj5UsAZKTdlTcSgc=; b=YJoPOj/NoaLs2Ls+T8m/umO+63to7/njUCJxU5Ao0X8N+nfJFcO+sCilTp1H6fGcq/ qCA1Eoz8gnH0WZCSWmE+Z+fHZCAQmxwq8Lr2iKR3zDsh1ip2C0ZUcqBYlwVO933p2vtA /2xE28l04kqspvhXlVzjEpGyRuEh/cWth6WrZcHBGYoir/JY3KFboPF2HeasYbHzYkIp vua3NpkNz1ory+MXkFfVk5ADUQkbTlJAauQw090YHFX9NYGcYnato9mUzkzIbTQJSI96 V6WEFLCNO1wbpZoqLpzHX8rQeu4GFY8BCsVA0e9iZWsMlzkzRJZArW5tPqswYFCJaxe9 UsWg== X-Gm-Message-State: AOJu0YyMdSyGwV7l+/4K3g4lL0KfE0ZGWr+EDcjzHDYRJd3klv6B1JMI C3yg91RC+gs90Oe5LLQQpLDWn/jSnpku4ARcg0g7YGVCuM51FXbOVXAq3g== X-Google-Smtp-Source: AGHT+IE04vhasmZRc9T795vSj6wBBpnZSuQNiFRTT/p7FlMUX3jxgD55/VMpu8zjqqZdPzXvYd81XQ== X-Received: by 2002:a05:6871:b28:b0:254:9ded:a3bf with SMTP id 586e51a60fabf-25842ba0b61mr910721fac.45.1718314905434; Thu, 13 Jun 2024 14:41:45 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:45 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 13/23] qmi: call-settings: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:22 -0500 Message-ID: <20240613214134.1056517-13-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 85ab427e9de5..17160354c273 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -834,7 +834,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 Thu Jun 13 21:41: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: 13697504 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.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 1869B14658C for ; Thu, 13 Jun 2024 21:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314908; cv=none; b=WQyI7OqCePjq+LxGnOFFI+uSpIJddRFyV7ShlW3ipYUNqtMo6pQk6dPSXVaD1txkfZFnYoKuIqg9uQlxlkbsqy9+TTPUYbpJFph/H7tZJaTGpX8jymo1Rs+LSjAxiqwluktamdF8qwwEP4UR6J+fTjpkavp827Wyydi7pxd7NK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314908; c=relaxed/simple; bh=Pv/eQ5BDg2gMSZ9lPotfJwamH1HCd62X9tq7yc5FW5I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U5lqPcl6SHxBRHH4B6Yu7M5ah0r+4DA8nakUAnFNmWNCfgotp/1qIFz9UrDYS2vvdwZ1uWbPPz9Ffdm+/sdAbObT2zh0c1mLdxMkNuvl+FhqAEctZhATzgnzlvsKAniVw7uS2P1HL/ijW4E1isXf4JN9pOvcuDBGf7eMpq1EVxk= 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=aFHYTXZg; arc=none smtp.client-ip=209.85.160.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="aFHYTXZg" Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-24c9f630e51so711992fac.1 for ; Thu, 13 Jun 2024 14:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314906; x=1718919706; 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=bAaJqmNisulnG7dmipuBrlZ2Lh6VNCRWfL30YlOXBmU=; b=aFHYTXZg6lyqGc2hGf11gpOTMIOEIu16EEpbmh1jA9lnSQDKDvYt1L0+oWFjHcBfPr vylTVjFG1BqEXhdF6YPmJDk+PaadGHkggjEZ9dx6BEIzdlHUOm52cEsN/f/tdJbvfCT4 u1opg/f98Qvp5wQ7oHYaJ4JLdRKircKaWpUfuTXU8L7u3xsmCe4aeUJSofoU1PX3t7P5 LR4TJx6dawLI46QliQWdWr+An/3XjCzwj2Y4N5K52RQYAbhgyimzNdb3ITLWyPtxWELz Obpyvbz5IfGJe5866CF1Hgj8wQ124r0vsts4CB6COCtT+LRkCZdzOso6wpicYZgBuZTf UATA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314906; x=1718919706; 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=bAaJqmNisulnG7dmipuBrlZ2Lh6VNCRWfL30YlOXBmU=; b=YoalsGLzK/aa7DzroNQa6dCWPyNiNenrMQxHpyrogMdQ2cB5x/NEgBgaAUxbP23auC 32y5f1XEdH7rifrgEgfau/h8qiePYBRXXqIlVmIqoUrV1AHC1HU7lO4F9/m0y3o6NXcH bWCJVVgstoNXN8myK6hisfwHiWXzkVzGQk85aZGgHe/r2jK+njs+AK+h5XcjsO9Z1W/K qou4QTM1KJtg9AJo6K0mR5tm+D8uBccRo3UcxU44LVGO3nizSRHzDy+Q/kJNSouEWKhe oIO9te8sCW6Pj0qhb0Sc/cHtotGxQcjrJRyJ/f0epL6muO8MWNJlwzq7nYY39ZMRQsud aF5A== X-Gm-Message-State: AOJu0Yyn3FPLHfi+ZwFJxwbsLn1wszEOA5wYhCQQKOY1IOkrZGMkVegg mX0egtieUmpch/qsvExa08Yvu91Vb0/tKQ+SCKTak3D5r43ogtL++H6RDA== X-Google-Smtp-Source: AGHT+IHlGlbeydfynnHANMYKk02ms9FHgqhtohDNroB4OSjfGyhwnUN0sTMS2AxgIS7Zc187idCGxQ== X-Received: by 2002:a05:6870:459f:b0:24c:4c82:4f15 with SMTP id 586e51a60fabf-2584297b8a4mr1021897fac.24.1718314906065; Thu, 13 Jun 2024 14:41:46 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:45 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 14/23] qmi: ussd: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:23 -0500 Message-ID: <20240613214134.1056517-14-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 17160354c273..456a5d2363eb 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -833,7 +833,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 Thu Jun 13 21:41:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697505 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.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 015D3149C7A for ; Thu, 13 Jun 2024 21:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314909; cv=none; b=S84NwHT9gtaBDQL67x6Im1MJGSCcZ6bPlJ/XQOjv8jQcK3EfB3Bnjn8RTLgWoG+WgrcZuv9PAbuhIENuVnrqpB7o2oRTx57MdoarwQINAdj9WRHXaHb1yWo3RYCOEXOrxh1sxWaJEojBA/g8wfRRNskbz4pTVuI3CbaVdR/JjTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314909; c=relaxed/simple; bh=W9FOmRt8//GX2XPQyKhyQ3Wg0ZpbweoYN2Mz0nVEyUc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j/Q0ygyg2MVIkFsEB11u+BZ07/0i1QeKvIfMIWNXD2A4NBdNtg4fx0F37hfqG75AGqrgNgeUyUkDrMj5BQyCawVbbf1IuyUIP1+3mD8EcY/NO3NNbN75NGpdhf8arvNe9GtcTd1ls02h72SeTGMplk8Gdw95XAYidzvEbCmPaSs= 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=VqzGAomQ; arc=none smtp.client-ip=209.85.160.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="VqzGAomQ" Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-2548a00c19eso815018fac.3 for ; Thu, 13 Jun 2024 14:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314907; x=1718919707; 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=gvx4czkjMt44o8hk1UAtUd2FH3DKAIjFAFWDF6DDg9k=; b=VqzGAomQ19X2gbdOgWImvurLWRR0DdMa906a0lhJP4X7Y/qNR8Rd6FN6v+z1wkZCnJ +Q6/lf6DVd93QwzkjYUlvVQMLvXXNBNuuo+lPzo8jLxvs2Z0WB+pMmObtYjYHqo9WVRo WNM9opl1AUyFcsyPKbjabJmfyJJhBODCJk14oMCrRXLB6Em+uovVWCeGCsHHiy8q5ynb kBDnrhVhEDq2o3u7v0uQDVCkd5frGAtN/OuIXjMx92PGYs6SEfLK36vAtkA2r6LzoIyg G6ssU1TFNt3SiaeOdT1oAEwY1LxSQ+M08yfN7mggTw1r07jGnPcNj4aOhB14Kk6UT77Y Kf4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314907; x=1718919707; 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=gvx4czkjMt44o8hk1UAtUd2FH3DKAIjFAFWDF6DDg9k=; b=brMQzwt9J4XBWib7s2lLJ/yZCwYyN3F93A76NwMpVgl5VV9hlJnafKomRhVd/UBYBq B/xv7et/sHddlJpLzFalof3VQr/sHdOx8mw0kmnOZ9WYGLBRnOFPVKY+HppuXoxiNE79 XFUFm9BHHTkpXsLW9TNQ+aOZ/SjLmTxOiFMX9J7I/LTuxhbYlAm2z9ZSB4ahPWQ8whYE ywjMoivqmAytOYsVTw4BaRwyCcaXvLMT+qGN05t0BrlxArl+2eET9U9afZT1twKjJSIw oAcsCh0cGbyRYkjbg10D/IPZ7p6JvxMsqQGw8ZZIpT/NdidoS0WJD3jkKUqQJk+WRgl9 8tqg== X-Gm-Message-State: AOJu0YwNvbDWSC1ZzG2IV6yKIClk13CWdqu8mlXQRPL2bBnX513YMi2+ 2rKy2qbdzXlQz1UH+lf+nLiT5ol+VHwHkDPGow5qpgDj17pc4EbfPIwUbQ== X-Google-Smtp-Source: AGHT+IFoxvYKXDXMbuFSwMXeuVgqFxm65MNYv37NQ/ck+sbzUNyk096EoLNrXnsu5zalugExyqAj0A== X-Received: by 2002:a05:6870:584:b0:258:38d5:652b with SMTP id 586e51a60fabf-2584288c927mr959055fac.1.1718314906708; Thu, 13 Jun 2024 14:41:46 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:46 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 15/23] qmi: location-reporting: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:24 -0500 Message-ID: <20240613214134.1056517-15-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 | 4 +-- 2 files changed, 16 insertions(+), 38 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 456a5d2363eb..a0f2fac3dede 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -725,9 +725,9 @@ 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) + if (data->features & GOBI_PDS) /* exclusive use, no need to clone */ ofono_location_reporting_create(modem, 0, "qmimodem", - data->device); + l_steal_ptr(data->pds)); } static void gobi_setup_gprs(struct ofono_modem *modem) From patchwork Thu Jun 13 21:41:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697506 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.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 881B913E03B for ; Thu, 13 Jun 2024 21:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314910; cv=none; b=pAJP0iqbun+WVhhXy3XyDTsk0ApOTd2ts+acidpB3Te150FrbunHjqELD+Ca609vVEWhujNFZifHRfcwZgAgJItTBco8dN0cEcPaYwmHNO8y5DBaHzvbjsn9cPs2rZm4MKsvIxfYiN/zNGPrXS2a8Q1lEGqCjZUdniRhWzwMp3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314910; c=relaxed/simple; bh=6ry95od5dvfdTZ05opWvIQFEO0jJGxLHS/XDfWkpd84=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oLHFaZRDeTjotDTjNVXCWr2DHBhyMBN/txgtLu/FnU83XJi35BBFQvibbyHNMFHoDc/mj2nvRAocpDLsNOaQpRjnZdsmHrI5PwGjQFrlb+x2P/pT38j+UokJj+ZHck3RQHvZ4wrIr0K6J+ER2xv//kkAo8CXMfsnBWVKHneBlfg= 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=aIvJvtgY; arc=none smtp.client-ip=209.85.160.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="aIvJvtgY" Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-2506fc3a6cfso706929fac.2 for ; Thu, 13 Jun 2024 14:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314907; x=1718919707; 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=QyVENghjreLJDIhPqQXX6lCWh/kuD0T4H2XDx7rysrQ=; b=aIvJvtgYik60cjJBvoN/OLGSMBLI71oToAF2DJ4eVdZFK3zfZJV90LNgia0Wklc2tQ gE9OdTLFgMFaLQoBmh2um90YUhTiZDcokJtQpj3rOuy5oNtUukbUWWEr/nWqVRTbVvYg KHdX3i9UDoILgo3pw1X5SLDNMFNPM0fX8JrxYgO6GJSb8BDVWBcX4oQ1HtmbfqZmGLn9 8mI3a6xaPgTCI78na7D4UBujk4SOHiEy5lBfrMfHWEDgxZUAUm2KKEWlBcrfO5ztJhA4 3a09uIn/o5fbwdI6CE2/mRN2pxnM2cz2cJKRFzXuIYky/vYtPvajcGQ47Ww9/0JZS3Sn j4+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314907; x=1718919707; 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=QyVENghjreLJDIhPqQXX6lCWh/kuD0T4H2XDx7rysrQ=; b=gglaUe6jE/2uBsUmOMFlquF35nI6I8MLk6MSCnXL5zIUIVMQLNrJGAmXUKv5XzMLI6 EsnlNA2/7crJy9zI2uLvRDtS9CE7vdOX7xPRR2xaRMgXcNNYqC9ruuWnwZVoVefEfhND 21NIpAeqqRJslm96vY9CbJNeeyTekybZtvewMppBIqp82MYLi5PXVylof6CgM9cSuZ75 dHSO/oXvz43F23D44KCAHqhLEgwQfe8x7OmysJin4ZJaGts4kqVRfqnNYrFbj4wg9E1n xUXd+/4AS/GlEtWcfiU6ssqs2h0auj80Sv5+3ouh7Yga7+nkPUq/0U/iJq5bFeoA/Sj3 HiIA== X-Gm-Message-State: AOJu0YzbbF0yDk6WZldA+9WHfuuO1GDMoQdyO+lE1oxqrJsnHudKmU5z W6KkMCLxh3hVbDly1ebjJYh5kQtYRCy1iKkmiZbzPYiSwNK5tJG89CjjkA== X-Google-Smtp-Source: AGHT+IFy2AOpEo7bv/0BKrS5hlvJYNvbnK+k7Xjn97ssy6C68MWMByRc74KHX75sS7Wg/aRwC7D+bQ== X-Received: by 2002:a05:6870:b14a:b0:254:a8d3:6fbb with SMTP id 586e51a60fabf-2584297b247mr961510fac.24.1718314907481; Thu, 13 Jun 2024 14:41:47 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:47 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 16/23] qmi: sms: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:25 -0500 Message-ID: <20240613214134.1056517-16-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 a0f2fac3dede..da27930c1e94 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -806,7 +806,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 Thu Jun 13 21:41:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697507 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 2DB401494BC for ; Thu, 13 Jun 2024 21:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314910; cv=none; b=RazhmlGYSQmtSb7FpGPEDQ6qmdvFOB1TTIipttD3vJ/t83e61TF1wLSR3PPlX0usefv4pfk1p4hjY8kPHPmO7c+h5WIr46iXqQ5w96TlPcD2qPyiiUxe13vBPZFSHnyP8fiTLX9CpCDDpfGEEr9Uv3H6ykJu9ysdRc29T/zPpAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314910; c=relaxed/simple; bh=c27u9gd96zTJsRU93FRYvSz0q/ey+JRPWh2N89SS8g8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u9NzFrpfyJTRY8kh+EUWArmDFjQuCX+Ax4ZwpYuAiHDyekA6NGMfWJJgq3YVhOo7tygQHfqpZoKQYP8cTHmIo91zNnzvyKvGLXjHFK8EhzfpsazRl/D+HchC/d5fo2hswvYVNTpzT8+msbd6Kw1eDBU7Q7F+7RwF9kDSIRxejmU= 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=DzGJssGx; arc=none smtp.client-ip=209.85.210.48 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="DzGJssGx" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6f8edde24b3so879302a34.2 for ; Thu, 13 Jun 2024 14:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314908; x=1718919708; 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=o6UH8GaMDRcfJBcwdkJWRkoS3tpfxDmSHlfCgha2m4A=; b=DzGJssGx+ZOg3lZ4ymgPtJmmL10wmJWOMh1AahpJseSUp5CP+C0zOR00gsdCCopvvz ESPRBgoM2e6ZOfGTyPxmr7B/pWtEI58tuv0Y9natesYVgKYxh36iv/w1UOlaPO2X9xTB HVnoNCm1UEyeov2D96r5C62GaQxX6DA0wBMijllK8BXjxWHOeQotn3tR+SHDQf/4lIYb nt/TSKItK+NmDdtNIXtJR5SgGF7u05wHCcV14X2OoJhVXw4FSbVgNlfjnNhqHrlIVDxP fXrA7y2rEk9by1l3Ig0JIuSsTWgkNlYFqVZeAHidvivXF8QGrQ5ykqypDNi97TXRwiMG TSeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314908; x=1718919708; 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=o6UH8GaMDRcfJBcwdkJWRkoS3tpfxDmSHlfCgha2m4A=; b=ujC8FFRAvqGTb9NfDKA+KyZa5eRcLj0UWxr2jsrSY2Kyrwxjw1Fn3b3gnnOGdrV/kw 2QuNvsB2qHCHLcRM1NOgm28uBo1lp9STfK2hw6yqP/OJhLKrM1ZSWRDy9BHY7IuuE3AT Oi2PS7WCAOAWKvmxZL2+zNA4HGOZ10juxzJjTh0hiBN8XbuGSVbmIiFHEhULwN4CzasY iGMwjAqps90kcSNhUrdVNJBVoX7rYovEe333VNHQSK92Uk2AqzY7SRpN8BLmhTP98S2k CCkRUiTc1kLIx/w0TRZuwu9JGnJ/4NOY2NTzoJY7p0ANNEKX/nbBW/H+n0TDl9nzxDPq v1aA== X-Gm-Message-State: AOJu0Yx8ak//mNzb2/zuNSm1+o8bE+pBU2G6DAR6NzpSHKdQXTVzoTCb hQrbinDIjFVRdT/j2s8j6WxLZKPCW3qM1Uvd7aJqZk03UPLuKpufLZQsWw== X-Google-Smtp-Source: AGHT+IGHhzjIxIPbCIc1eLC/QdPN8BqfoBtf5+Ne5Um8hh9akSe1SoLVsjoWUtto0tkxXFRaSODLgQ== X-Received: by 2002:a05:6870:3282:b0:256:d14c:6858 with SMTP id 586e51a60fabf-2584289476dmr889597fac.10.1718314908177; Thu, 13 Jun 2024 14:41:48 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:47 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 17/23] qmi: netreg: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:26 -0500 Message-ID: <20240613214134.1056517-17-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 da27930c1e94..34aa363cf82e 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -829,7 +829,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 Thu Jun 13 21:41:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697508 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.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 D90331474CC for ; Thu, 13 Jun 2024 21:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314911; cv=none; b=gubMlMoq8n5U70l4EZwUN1Ws4aYPVOwSqnH5fhL1ur5zs8FyWxyEd+ryfCMZgdEp2X+Z1kZSjx1/PSU+Eo24h9Io7JsdIILnQQ1K99gdu5lEY2rjQqHdE4jtYFGH45aIJ9n2m5eUiqJlACB/aJelQlbrMmOaFKT5OymDRkJgIgs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314911; c=relaxed/simple; bh=wzYdTRlhE+T1Gsu4ILYj5EuMI5N7BiwPoA/D/2ZAL70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aYR+vZEwWS/9tQ6LdofMJ0seZtNIwdgXDj1J/+GcDZuDOALWBw7a+GdD5ED037UdWF0YNCSNpLSH8f87KuyDTsL48bjwZE/iIcNqHeGwsCeK0m5yScoGw34TwqTXxMKghO4gWnBGISrhl8jcEBFcgkKN7DG/Epqfs13mmAyQQkw= 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=OWikDrJj; arc=none smtp.client-ip=209.85.160.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="OWikDrJj" Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-24c9f628e71so692729fac.1 for ; Thu, 13 Jun 2024 14:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314909; x=1718919709; 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=vf4SpEpnoCllwXBGINv/+E8pq+psrDRzlKTFTwE7q94=; b=OWikDrJjIkXDeTWtYI9M6Lhg+GM51VIrHaRswRGGLM17foTIy3CvPcF8TEIq1+IUgC tlUsxb9B0yZbczaDhkh42VSB/CVo4SPt7IsIFG58gdHGcz8AZK5tybRvve2iw0n4ggQs U4/3xCHWzz8Fev7MaYUdyt3VXqNu4F7HER4MKRL4MP965nWNXb4Kzcs+pw7hyCxKe0dg HeNEucZsHp3T1jvD7L8H1trsl8VP8lyY8HZXXGBFU1Yzmzz4p5vcZaX+L5BAufPCNjVp xQBTxDLZx74RTA2lJOAaOSOwDGbyawGYKxf+Hs70QffUs38i9YTVDMDQpBquCdZl/W2x 9ghg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314909; x=1718919709; 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=vf4SpEpnoCllwXBGINv/+E8pq+psrDRzlKTFTwE7q94=; b=pD1VcnZz1ceYmchmY7YHJLR3WTLJ4SeE01WOmi5Fmd79s3h9Ewx+GvXOZGpcJCdun2 XmL6Vs5W4gu6W8Z4ZDLRURslAvGMHQOvj9TZHyO/YvU22NJLUaeaw6WwoPgoTqaYtiIE vw3ZqLn/0zEBjd08fxgHQ3340kxIyNYewMUQc0ilkwGEwZ0yB4gYOKu2jOSfJhYN5SF+ roIT/AS86lA0Omr9etGY30fD1Z3FuzY0X7jtTboaBUJ9M6QoCWsYTR+kwzMohuddS8np JJZTZ47eT1EnyUHNZkfOWgWQ7GtzkxbKSAErJ7ObMgD1GDnxBi/RDQo4+DqpvPwMgISr Szuw== X-Gm-Message-State: AOJu0YwfZ+6Qz9K5ZrLmGSgMTiP00Gfww/gRODi0edrjXTUlgCQdmUVs m0QA5/VvDsmgc1aH4GtAcx1eOHhlVOj7gwi9VP9UzsyOOrqjIfQvSH8OAA== X-Google-Smtp-Source: AGHT+IGiM8v++Cq+iKVJ0PoAvJdlhRpVIu/4Ikj9fo0lEqkPD2qCnJCHy8wwg6a9SFI4ZVbzeyC7vA== X-Received: by 2002:a05:6870:440e:b0:24f:e100:ba2d with SMTP id 586e51a60fabf-25842b9b48fmr863568fac.54.1718314908831; Thu, 13 Jun 2024 14:41:48 -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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:48 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 18/23] qmi: netmon: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:27 -0500 Message-ID: <20240613214134.1056517-18-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 34aa363cf82e..8e16e63cd6e2 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -831,7 +831,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 Thu Jun 13 21:41:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697509 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.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 3A1751494BC for ; Thu, 13 Jun 2024 21:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314912; cv=none; b=eaxSK6chRVuD1J2NYmm2JovwkC2w9lSbCyWfb3TydM2Ww4yb8LI7G5ztSQnr4+jHU7bMXqEap2fa12mRMkrQ/YfluEO4DbtBK3gwhwjVsS9UQY5gVAbt/YHe6q8GOyPoWYCq8Lx1CjRRuJ7ALFNZnuTRdyaFfKauh4X1xwAYROw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314912; c=relaxed/simple; bh=z/wDdgwLXzFtlQ88C22rUmkqY+9SnBVNsbbyJMQsOOY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mPDxC8bR/tWbhZZZ3fUSWtFZlWO3biCJ0IAm6WC2GwNyCEvl2xLI5Nia1szz8h6T9JT8mv4jxGhSxBP5byHTnsO0H+3P6jI6TWFUgjHbNXB6dvs6NM1Sl2AimSxfPkOA5hxb0eelAh7mu/p8yQz6i9iH4nR6x1GVesyiFBTHgI8= 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=by36gxUe; arc=none smtp.client-ip=209.85.210.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="by36gxUe" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6f971cb3c9cso808818a34.1 for ; Thu, 13 Jun 2024 14:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314910; x=1718919710; 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=UIQ2/9ja8jDLNYCwjMa3M8cJJG3T9L6Kv6Drj4uEAxQ=; b=by36gxUeGqXuWDiuqF7sJ3nsK+Qsttk3mbwdvrgrsLNKDJScXWTuUIJTDs1Cae+Wd+ n4UM9Bsfp06UVtoqQSFG0a7Q87Mebj3fEdho9PN9PHsaXcXDFMIdE3T7K9yTXzI+TYoE WVMV3QJdNUACnW7KvMxEzFP6vBe/KbN1CsiRi/9yPAM90n6UucF32t3x6eWvoXke5Ja7 r95SGR9cJclH3JfeS6nI9byg1FCuhATAomiamr5TvPs9rxb7DQyRJOHPoO2uIFQ5TrFQ 255iV8jlRn5PHSNyrfaNbFP4cdamwEt0VgYJBiKEPANWN9mLnJEg77nrzZatAbNcSCNe OPqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314910; x=1718919710; 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=UIQ2/9ja8jDLNYCwjMa3M8cJJG3T9L6Kv6Drj4uEAxQ=; b=d7WM7tIWiZoW73pO72eWWmIWPm1vHIPk9xBelSIg52Y/sQCFO9bnG1RAQbq/yooeL0 Hi6QOmtb2LAHSo+ZCdKi8HkrhXip7VOVoxopXMbI6Ag89PY//XFPr3y2N7+JI3+B9jhn qRzSwfKQfBc+VYzwQh8c+tGuSWuKtgE/QmhW87WGXVkPYCgwIHrskwyXwt6FdPHQWoQE UnhDEc2mVpwJRNpw8jbb0AvnRCvQgTQKugJBA7QVNwnkbpuuhl2iQZCmS5o5F35NdO63 dRDLWX7wC88L5gD037ULY3M7ueHOhkFH7RwnEzqIW8HUiKHw8h2GK+4cw7Kq3ouMuTQT qPLA== X-Gm-Message-State: AOJu0Yy1aj/dcvt+1DkTOn84nm1jBThyNcOzIIOfCouALQpf7Tnrd+US 5Ab7E+i8jYHkJOsFCHSeh/sm5h/+/vsHfXxezBO68eV/cGSWbBwaeEahZg== X-Google-Smtp-Source: AGHT+IHF2S1s5/j4lpaAp5LCRiPcnpZqwzUPvhECeVjM7Xk18nZL6iL/s9IPD7TgpKbUMNlYmPkMlw== X-Received: by 2002:a05:6871:3a24:b0:258:4978:7584 with SMTP id 586e51a60fabf-25849788d54mr16979fac.58.1718314909483; Thu, 13 Jun 2024 14:41: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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:49 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 19/23] qmi: lte: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:28 -0500 Message-ID: <20240613214134.1056517-19-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 8e16e63cd6e2..6d48f0d1bc5b 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -800,7 +800,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_WDS) + 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 Thu Jun 13 21:41:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697510 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.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 4AEDA149DFA for ; Thu, 13 Jun 2024 21:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314912; cv=none; b=KCPsWhw6n8l0C+HcpaXJFJU8OvrZ5vO72+oEd/rzC67idaM8f5i++6deaYPGR3X/v8yC6EwYkv6iI2v5Qi3hNdR74DKtU34sbVRwL9KwQUGhkw243KDKrDYrbjMYMWhCG5M0D0cez2q0WM5LxIsKMGBjfQD8EeQj2cQxJ8agETk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314912; c=relaxed/simple; bh=VtKlecnWaKy1v+FZXs9+kRI4Djw9IPrUYvfH1fcBVWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tJ9NE4e0j0E/Ll+5bzr5GXj29GGSESTxp1+Zv1swsN/m3rZMoEiFeu0lPSb6++oiCH0NVSeC1SlFy7bDtStv7X8QzQSZOtxnHkLKK9Y2jjf6eIwDxyTrPHy4XgStXdslfQLFYzwPvGmztS6O9N8pCssLHnih69CzPsURHCCSovU= 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=SzU4UpzD; arc=none smtp.client-ip=209.85.210.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="SzU4UpzD" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6f8edde24b3so879325a34.2 for ; Thu, 13 Jun 2024 14:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314910; x=1718919710; 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=0eg8Rm8Z35K3O5WUGa2SC5AaT7K/qn0BBD7rtdxwVJg=; b=SzU4UpzDe44FFsHKJXDhletgdZhZIiadFflLFnB5HAKiMnyEp0UOyT7S25Wi6/yVxf G7YA5j0uM45UZWo0g9Lrv1yEzqV2JAilnw2H88KgB1iEYpSjBjJGIXMksdW7Ukix0wAt 0lX8fIufAB0jrBrO7YTxjWvtEvJlgCEqOeCypqNamsUXMRBFI0iilAkflY0WRdj0bXLy Efy4CRYJtNDhOe7PVMkDEn1xRlT9SVROuSvvtXiIMA2iUzOCP7rm//fQoRC8wVC1buPm bVDSyhCWB39krfqemnQqDXHabfM3b+0eqlFtuvf8evlmkeSabbEXvNzrNyj4whwuqUgO YW9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314910; x=1718919710; 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=0eg8Rm8Z35K3O5WUGa2SC5AaT7K/qn0BBD7rtdxwVJg=; b=ts3UZwoBc3mnqhzO9ng7TgyYzyKIecA4GkRV+diM2LBYY5X+p9G3XIdvSQKcL7nPk9 1cvt8I+2qWqDR7wuNao26leUzZbb0gJJiKTgn6EnpN7F0bNdBwe2fqm/gslxDkbxSqJ8 vlLiolfbeBPX8wi8ClPjWZetnQAbjbkFEBufDE/5DfhP9UOu0e/d7e0IIX9si3ztCXww vlD+i2uSuIxR0fASZsYj62v7KNmk1dmNqPWkXID9DCM+FofUYLBvroKUTZldLNOMkRpb ekIoUVLvjxrYlsqH74fxfpsqvAhCV/hkDFhwCLLDMSJM02+G/F+cynWnqafv0ZfhEeuQ afbw== X-Gm-Message-State: AOJu0YwijsaBbDKisyR6rNO6RbOV8laYjimHwXj1X7YPhOuZb7v83Epd KMDSlYnvr/vxopudbjMtdx0GoFxgl4vUHwECSqVHfh2RodBmYAm5ox/WZw== X-Google-Smtp-Source: AGHT+IE4eJkASo3VlBZHS7QtlD0id6mgt8lt8goCuPKqj4sOiFA8WKCxIYEeU5YTulG/3Ys4bBJNVw== X-Received: by 2002:a05:6871:5c9:b0:254:a753:d1bc with SMTP id 586e51a60fabf-25842ba2060mr991328fac.37.1718314910157; Thu, 13 Jun 2024 14:41: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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:49 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 20/23] qmi: gprs-context: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:29 -0500 Message-ID: <20240613214134.1056517-20-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 6d48f0d1bc5b..65629e92ba09 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -752,7 +752,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)); @@ -778,7 +778,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 Thu Jun 13 21:41:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697511 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.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 076C31474CC for ; Thu, 13 Jun 2024 21:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314913; cv=none; b=JSiWGdDxlzIHUbHkFw3nRhzIjqLEIrogZcLZYQSAUSaZngW/xLzlkVvdJhoirn+grMy8tJX8kCrprrPnaZVsGqmD3adu0QUQJoxxy2mhXvVN27FppcZxiZrHAAzYS0XIDUEYhlB0YT8xO6M+CHuQXRZJ1o8GecSLg6lYvoaa7sU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314913; c=relaxed/simple; bh=erhE26Tah8EhqtMcTdHywPBO4QQKdsUhXl/3VPciB1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tve5NaB/yzpXCz96uqQ7xuWftPYWGC2ianyyWXg2cm3QXbAi+iZ5tsizs3a/VUwXig5Dq/PZOZ6d3fYq2YMCk7f/SFFIozCX1dQ4ol7KOtdktml3Klglpuh/4InVXbd36LnTtleT07tKepzgdmZdS6IQI0n0AyiJ1JIA5TcdqL8= 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=MbhTTitO; arc=none smtp.client-ip=209.85.210.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="MbhTTitO" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6f97a4c4588so865812a34.2 for ; Thu, 13 Jun 2024 14:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314911; x=1718919711; 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=6doADjhR3/6vf/kwwBjBRt4gMtz7KBOLEestHrhR/BU=; b=MbhTTitORxam/4XK0snAUI/kmea2YVsVU74ATixEZy5MPVv66Ga21m4xWA+rTAunu1 5qc15uAo9CAIFdPjo4g2bxfBwEI0/Qwqg5qEmFo9Om6EQqPJUYOGDMpB1scmt/99VWPj BrwF/fboVSTRfgcQ2E1ZKdc1A4ifLL1Mj9N/8p4XnCILc7BX+1nwBtuLLYm5zcdBNgpf zUbuPv/acSDgr1DrFXRwUjcHd6XxsDyF1ABsRbt1K/Moboe23Ebk4Uu10Ty/p9IODLi8 B2Ob8SV05CJLsCbV929S2rna8c3SffyYk/PBm2hEEUccqzLHFCEoS57Hevy3PoQAW74o CQdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314911; x=1718919711; 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=6doADjhR3/6vf/kwwBjBRt4gMtz7KBOLEestHrhR/BU=; b=KqU7zZDBmPWrZwUyZsj2IicKppj7Lsc44RHzn4IcjIzk+WNs355WgXnHUI61X00iEH OQ2TppiVnr+29TDa/5928atncLYDZeNtb0/kb9xnGhSPe+s2E/SK44oMhGvJ5MjCLBhO ikWywSOivbYHB3PwwhADMnH07oI0y7B8yx50vdcaj8ggpHBfwrni18puzPvzDTLuUJ/N vUr4FPBnxomqpvlwxpwYFhzivWVNqAMcSsGTDx7jsiiZLhR0sO1A1bsUDsCCyZVIjBCO q5w9Dq1oK+JNesHL5zP3F2I2xnVMGN2duCnNVrU3MzXBIa2mNNvAfSdLXL4esSUSRgun /2PA== X-Gm-Message-State: AOJu0YzzmuoJvL841Fa3TpN3waJcU/qErhQ3CX3OkWapdzSWZXpileSf uz8wHXBNS8qoNFBOKX1c/8rcFip0WuodxYYtvw0XrGUJqgkFVK2JtXME6Q== X-Google-Smtp-Source: AGHT+IHjrC7BiZm/Ur6LX0yjpXksiWz3VKyW2iV6nie8OCncW/21hQ9A68pVZoxFQpM6EEoGd10LvA== X-Received: by 2002:a05:6870:f145:b0:24f:d9bd:2754 with SMTP id 586e51a60fabf-25842af0687mr926689fac.40.1718314910987; Thu, 13 Jun 2024 14:41: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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:50 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 21/23] qmi: sim: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:30 -0500 Message-ID: <20240613214134.1056517-21-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 | 96 +++++++++--------------------------------- plugins/gobi.c | 4 +- 2 files changed, 23 insertions(+), 77 deletions(-) diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c index 67925239f2b5..876274fa87b4 100644 --- a/drivers/qmimodem/sim.c +++ b/drivers/qmimodem/sim.c @@ -44,14 +44,12 @@ struct sim_status { }; struct sim_data { - struct qmi_device *qmi_dev; struct qmi_service *dms; struct qmi_service *uim; uint32_t event_mask; uint8_t app_type; uint32_t retry_count; struct l_timeout *retry_timer; - uint16_t card_status_indication_id; }; static int create_fileid_data(uint8_t app_type, int fileid, @@ -827,9 +825,7 @@ static void event_registration_cb(struct qmi_result *result, void *user_data) DBG("event mask 0x%04x", data->event_mask); if (data->event_mask & 0x0001) { - data->card_status_indication_id = - qmi_service_register(data->uim, - QMI_UIM_GET_CARD_STATUS_EVENT, + qmi_service_register(data->uim, QMI_UIM_GET_CARD_STATUS_EVENT, card_status_notify, sim, NULL); } @@ -841,68 +837,32 @@ 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_param_free(param); + 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 +875,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 65629e92ba09..7ded86c52b96 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -716,7 +716,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 available */ ofono_sim_create(modem, 0, "qmimodem_legacy", qmi_service_clone(data->dms)); From patchwork Thu Jun 13 21:41:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697512 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) (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 CFD081494BC for ; Thu, 13 Jun 2024 21:41:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314914; cv=none; b=LF7Eqj/fCjmjf+Ity1f3APAbVF7sZO642YtNw8NZgD8E8i0KaK34T6wJIm8q9fFzRkuKuUr9jv7Woi6icl7kc6cpMEjRJ5cbRYI2y46JFCBFWxEY1ZRYy7ulB1ajiiXtkvthN85GmjUiZn9WQFcNuQRXDgHSVQ0bqY11sJpPviI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314914; c=relaxed/simple; bh=yshPWH0DKrmeyvPBMbOQC6teqXTeC4PeCGax6pr5yhE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dULe2p2Cq/I9aSE0YDVaMGFxKNz0IX5MkGZ3iqmgV2rqdeL1d5Bf6xaAzTsnLqIPccL+04TyqIV+zXRMboD0tYEoqJ6zPWdsWcComGrhIColhUpV9K3muXwPtoK3WyXWsVn5PPeJL3eHiecKhYvx3L9ZwPUoVqq5Q4Pi6bXuhiI= 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=WjK5waYc; arc=none smtp.client-ip=209.85.160.51 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="WjK5waYc" Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-2548a00c19eso815054fac.3 for ; Thu, 13 Jun 2024 14:41:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314912; x=1718919712; 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=DW/pce/bOqMWBRHsaDRAYAn1WCtKDItF8daMWFarSP0=; b=WjK5waYci5ThVnzlkXnRn0SLdCUU+NDJXUnM1vLt0EpTPo/ARUIZ5IwkzXW+sRYb6E JxZQDBCO+uaqBnGMK8XRnrJzbYSNro9bAqdAnYiJin+f+EozwEDP46sMb2uzyciMmw3Z YLm7Tewvmw5VVqBR7v6e+ZD1BUfTcTJdTMXPEeBiVagrrrC2Ah2PHmyV2D5kFcTvQbrw DyDaS2jF5fkaWH8Y3AjrMVGG/xZuX6o2eN6pQigbATdV8iQEDYdnNkSLmhpBpOOd8oJC OERTJL7pvwPh4AIphjZvuFtd+vbLZS6Pnk2zZc4Nb+7EN5by55tP7iaFdw0zc9bWT7Zv P1zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314912; x=1718919712; 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=DW/pce/bOqMWBRHsaDRAYAn1WCtKDItF8daMWFarSP0=; b=MJZUIHjxlto19XQSa9VUlt8ifhbmWIJbgzzVYrQPn7T81QcyG2VjGv1iyn9WHivxd7 8Js24yXMKdJu8uneMFqycZ84yK2acYuiTAgSxKAfwT5c/TrSKaJQPj4zqvyc8rgi3Tje NAk38zQmXVrRd5Nqu/W9Oe9CoH+v/gG8CyfUKkCcwDPgRc9fJbld6KI6BN9GzCAsjMoo +nJFi+aMqgrDBTYjI3GtjJRABcffg9erKf8IMtuxfR4H3Ql7y+wCpaPrqsJdbiMkIDE6 5DGrVnMwpQMWmM/Koxsaayi+nlGqWH+h4zvhTf9DHvFi14HezuWwmvUkGuBLYbOIv5jT XMeQ== X-Gm-Message-State: AOJu0Yw4AerpH7ISRE5qTL8k80VRtlsHIGYF4rWlmRw5SajzrW/sqG/A UkpYw1DuccJjJ/hjFLv/3Xlq4eALZji8VH9itQiy0zjbdL60ozEmc6FeGQ== X-Google-Smtp-Source: AGHT+IGHwec1Tbpb9gAFtcfEamCJ3ufoyJaJzj+urIvPQuvmHLBpx+oCy6uYS90KgSBvE8JTA0UwDw== X-Received: by 2002:a05:6870:ac0e:b0:254:88ed:c9ae with SMTP id 586e51a60fabf-25842998b78mr939238fac.34.1718314911662; Thu, 13 Jun 2024 14:41: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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:51 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 22/23] qmi: gprs: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:31 -0500 Message-ID: <20240613214134.1056517-22-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 7ded86c52b96..1a866490d41c 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -742,7 +742,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 Thu Jun 13 21:41:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13697513 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.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 6B499149DFA for ; Thu, 13 Jun 2024 21:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314914; cv=none; b=OYQMu/yVZ7FRYOUD0gbMBgVxIP+BiCyVnBfVXa62IdyNMQEHbt+e3fiNo4Rs72KX5t95FjdvUk35CnOS8/hXuxfJVtX/hZWWsuDzK77G/XNVysTNICuh1ybatlFJV7MCeFj7Oqp0fBsQ9WDyyD5AkNoSRihhypeGkROTi0W+Hs8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718314914; c=relaxed/simple; bh=isa3czjh/e+xPdF5+OkrJWpJ/jxtiJ7rJloXoPFCLqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C2GNkssMbxiiNOFrNUGiR5M7QFKOCrmJg/MmSbFNt93I+crXZL2dh2z7qUOI0zxuJEQJk22kVhWQ1moIUOo+Wbqs+2D1QB2eRJRUVS9Fozi2F0/pwwdOtMmJJq+AhKaeutdHyiAibFcvu/yXQo+EwVkn6OWvhrGCDmwe+Gl8D0Y= 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=fkfyaMUo; arc=none smtp.client-ip=209.85.160.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="fkfyaMUo" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-250c0555a63so755734fac.1 for ; Thu, 13 Jun 2024 14:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718314912; x=1718919712; 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=pT1g+0cCov0gjryw82CAVve6oNmT4iBbWPPSMobdXeg=; b=fkfyaMUoMRJapTg+HmbVfaNZOGYiSkichDVRxGNQKMYbt4QI3v8Qb+V6xxz2X/5/fh MDl6QKAykZ0ncJ5HyOR682p5H+NuBooiQiafIKM+iz8Y7ZYSWsoH3ZkHjag5EFGJbylX U/mw6F8Q1WorU0AgxmREeQSragSpYh1nrtrF4PhPPTr8jMpeAf2yNqODPJaEH7ChOzPW ZxWisRAstsg9Mu6fvNGmQOlzTY+mrsYh/syzZMYQf8dFfKs47Pxq/w9AEXNu1Sg3bksl szPBYIXbMrDNxg9ARw9v8a6930E1e++a1VjrTtDSHQ7C8NwAMjNTRHYtIY3pO5ZMIc7W Stqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718314912; x=1718919712; 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=pT1g+0cCov0gjryw82CAVve6oNmT4iBbWPPSMobdXeg=; b=uDtITa1AXX7VtbgEQ982+MZN3QX09/Cx6PfUD3wnmFAjSVow1saals4TriPdA6to+j BasinFgdhlAhb/q+Q47M2oQnmAO1ExmvWo6fTgap4rb2KiCOtI4TXsU8I3TxCaehwtSA J8nuq4PyBDRyRFajIkA66ZDYmfOF+zQn4LcGQ/GuNHXlXGD5ZKsdxpEWuGSj6dbbxQoh 3Y+IvuvjFLYBpAP9dWrWlPMYxla7q5sXFGTzpsRG5PLKPvFUZWuzTPnen7Dp4mYTaelk XDpEeatv379Koh8D8oXLp19I1etx79RsHAcR+Rou69bVzY+mo6sUrggQkzZpyaaieq9T m0Kg== X-Gm-Message-State: AOJu0YwC4SVVd/uywqqItr7REUrU/7ryy5NNLeg3B2s69gAc0zUGM6Ia uR1eIbjQsI8ecWNqqLMA7YFJz5rNskCsaRQSbJMhI73OhstuqEAwvEKXiQ== X-Google-Smtp-Source: AGHT+IFw3G9Qj7gC8OywYORFoNE8i2Zeq9kyaOD11HyG6BSBpHeCvfGi6nS6NIhNQjJMBgNdUyssvA== X-Received: by 2002:a05:6870:c1cf:b0:254:9d28:648 with SMTP id 586e51a60fabf-258428de92bmr894342fac.16.1718314912387; Thu, 13 Jun 2024 14:41: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 586e51a60fabf-2569930f768sm601589fac.41.2024.06.13.14.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 14:41:51 -0700 (PDT) From: Denis Kenzior To: ofono@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH v2 23/23] qmi: radio-settings: Drop use of qmi_service_create_shared Date: Thu, 13 Jun 2024 16:41:32 -0500 Message-ID: <20240613214134.1056517-23-denkenz@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com> References: <20240613214134.1056517-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 1a866490d41c..5402bedcc22e 100644 --- a/plugins/gobi.c +++ b/plugins/gobi.c @@ -809,7 +809,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",