Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH v2 19/23] qmi: lte: Drop use of qmi_service_create_shared
Date: Thu, 13 Jun 2024 16:41:28 -0500	[thread overview]
Message-ID: <20240613214134.1056517-19-denkenz@gmail.com> (raw)
In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com>

---
 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);
-- 
2.45.0


  parent reply	other threads:[~2024-06-13 21:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 21:41 [PATCH v2 01/23] gobi: Remove phonebook and stk atom creation Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 02/23] qmi: lookup shared family directly by type Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 03/23] core: allow multiple args in atom constructors Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 04/23] unit: Update unit tests to the new API Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 05/23] core: Support register on probe flag Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 06/23] qmi: introduce qmi_service_clone Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 07/23] gobi: request needed services at .enable() Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 08/23] qmi: devinfo: Drop use of qmi_service_create_shared Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 09/23] qmi: sim-legacy: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 10/23] qmi: voicecall: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 11/23] qmi: call-barring: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 12/23] qmi: call-forwarding: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 13/23] qmi: call-settings: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 14/23] qmi: ussd: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 15/23] qmi: location-reporting: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 16/23] qmi: sms: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 17/23] qmi: netreg: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 18/23] qmi: netmon: " Denis Kenzior
2024-06-13 21:41 ` Denis Kenzior [this message]
2024-06-13 21:41 ` [PATCH v2 20/23] qmi: gprs-context: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 21/23] qmi: sim: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 22/23] qmi: gprs: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 23/23] qmi: radio-settings: " Denis Kenzior
2024-06-14 15:10 ` [PATCH v2 01/23] gobi: Remove phonebook and stk atom creation patchwork-bot+ofono

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240613214134.1056517-19-denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox