From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH v2 2/6] qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER request
Date: Wed, 1 May 2024 18:21:29 -0500 [thread overview]
Message-ID: <20240501232144.14025-2-denkenz@gmail.com> (raw)
In-Reply-To: <20240501232144.14025-1-denkenz@gmail.com>
This will allow request to be re-arranged into a new sequence
easier in the future.
---
drivers/qmimodem/gprs.c | 42 +++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/drivers/qmimodem/gprs.c b/drivers/qmimodem/gprs.c
index bca1897ea02f..dbd461731d94 100644
--- a/drivers/qmimodem/gprs.c
+++ b/drivers/qmimodem/gprs.c
@@ -101,7 +101,7 @@ static void get_lte_attach_param_cb(struct qmi_result *result, void *user_data)
DBG("");
if (qmi_result_set_error(result, &error)) {
- ofono_error("Failed to query LTE attach params: %hd", error);
+ ofono_error("get_lte_attach_param_cb: %hd", error);
goto noapn;
}
@@ -275,7 +275,8 @@ static void qmi_attached_status(struct ofono_gprs *gprs,
l_free(cbd);
}
-static void get_default_profile_cb(struct qmi_result *result, void *user_data)
+static void get_default_profile_number_cb(struct qmi_result *result,
+ void *user_data)
{
static const uint8_t RESULT_DEFAULT_PROFILE_NUMBER = 0x1;
struct ofono_gprs *gprs = user_data;
@@ -312,9 +313,8 @@ error:
ofono_gprs_remove(gprs);
}
-static void create_wds_cb(struct qmi_service *service, void *user_data)
+static int get_default_profile_number_request(struct ofono_gprs *gprs)
{
- struct ofono_gprs *gprs = user_data;
struct gprs_data *data = ofono_gprs_get_data(gprs);
struct {
uint8_t type;
@@ -323,7 +323,27 @@ 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 qmi_param *param;
+ struct qmi_param *param = qmi_param_new();
+
+ /*
+ * Query the default profile. We never change the default profile
+ * number, so querying it once should be sufficient
+ */
+ qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p);
+
+ if (qmi_service_send(data->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);
DBG("");
@@ -334,18 +354,8 @@ static void create_wds_cb(struct qmi_service *service, void *user_data)
data->wds = service;
- /*
- * Query the default profile. We never change the default profile
- * number, so querying it once should be sufficient
- */
- param = qmi_param_new();
- qmi_param_append(param, QMI_WDS_PARAM_PROFILE_TYPE, sizeof(p), &p);
-
- if (qmi_service_send(data->wds, QMI_WDS_GET_DEFAULT_PROFILE_NUMBER,
- param, get_default_profile_cb, gprs, NULL) > 0)
+ if (get_default_profile_number_request(gprs) >= 0)
return;
-
- qmi_param_free(param);
error:
ofono_gprs_remove(gprs);
}
--
2.44.0
next prev parent reply other threads:[~2024-05-01 23:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 23:21 [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier Denis Kenzior
2024-05-01 23:21 ` Denis Kenzior [this message]
2024-05-01 23:21 ` [PATCH v2 3/6] qmi: gprs: register and listen to event reports Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 4/6] qmi: gprs: Register for other notifications Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 5/6] qmi: wds: add utility to parse Data System Status tlv Denis Kenzior
2024-05-01 23:21 ` [PATCH v2 6/6] qmi: gprs: Obtain LTE attach parameters after indication Denis Kenzior
2024-05-02 13:50 ` [PATCH v2 1/6] qmi: gprs: register to NAS indications earlier 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=20240501232144.14025-2-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