diff mbox series

[v3,16/33] qmi: sms: Require at WMS version 1.2+

Message ID 20240620145139.1135899-16-denkenz@gmail.com (mailing list archive)
State Accepted
Commit 9d2a30df34e6d50aed1c2b7726e7e556e742a677
Headers show
Series [v3,01/33] qmi: Remove qmi_free() | expand

Commit Message

Denis Kenzior June 20, 2024, 2:51 p.m. UTC
Move the version check from the SMS atom driver to the gobi modem
driver.  Do not request WMS unless version 1.2 is supported.
---
 drivers/qmimodem/sms.c | 12 ------------
 plugins/gobi.c         | 13 +++++++++++--
 2 files changed, 11 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/sms.c b/drivers/qmimodem/sms.c
index 2ac06a40bdd6..3e2bef6e38b7 100644
--- a/drivers/qmimodem/sms.c
+++ b/drivers/qmimodem/sms.c
@@ -22,8 +22,6 @@ 
 
 struct sms_data {
 	struct qmi_service *wms;
-	uint16_t major;
-	uint16_t minor;
 	struct qmi_wms_read_msg_id rd_msg_id;
 	struct qmi_wms_result_msg_list *msg_list;
 	uint32_t rd_msg_num;
@@ -263,16 +261,11 @@  static void qmi_bearer_query(struct ofono_sms *sms,
 
 	DBG("");
 
-	if (data->major < 1 || (data->major == 1 && data->minor < 2))
-		goto error;
-
 	if (qmi_service_send(data->wms, QMI_WMS_GET_DOMAIN_PREF, NULL,
 					get_domain_pref_cb, cbd, l_free) > 0)
 		return;
 
-error:
 	CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
-
 	l_free(cbd);
 }
 
@@ -301,9 +294,6 @@  static void qmi_bearer_set(struct ofono_sms *sms, int bearer,
 
 	DBG("bearer %d", bearer);
 
-	if (data->major < 1 || (data->major == 1 && data->minor < 2))
-		goto error;
-
 	domain = bearer_to_domain(bearer);
 
 	param = qmi_param_new_uint8(QMI_WMS_PARAM_DOMAIN, domain);
@@ -314,7 +304,6 @@  static void qmi_bearer_set(struct ofono_sms *sms, int bearer,
 
 	qmi_param_free(param);
 
-error:
 	CALLBACK_WITH_FAILURE(cb, cbd->data);
 	l_free(cbd);
 }
@@ -747,7 +736,6 @@  static int qmi_sms_probe(struct ofono_sms *sms,
 	data->wms = wms;
 	memset(&data->rd_msg_id, 0, sizeof(data->rd_msg_id));
 	data->msg_mode = QMI_WMS_MESSAGE_MODE_GSMWCDMA;
-	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);
diff --git a/plugins/gobi.c b/plugins/gobi.c
index 23d16e251196..63eb847eb680 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -441,6 +441,8 @@  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;
+	uint16_t minor;
 
 	DBG("");
 
@@ -448,8 +450,6 @@  static void discover_cb(void *user_data)
 		data->features |= GOBI_DMS;
 	if (qmi_device_has_service(data->device, QMI_SERVICE_NAS))
 		data->features |= GOBI_NAS;
-	if (qmi_device_has_service(data->device, QMI_SERVICE_WMS))
-		data->features |= GOBI_WMS;
 	if (qmi_device_has_service(data->device, QMI_SERVICE_WDS))
 		data->features |= GOBI_WDS;
 	if (qmi_device_has_service(data->device, QMI_SERVICE_WDA))
@@ -461,6 +461,15 @@  static void discover_cb(void *user_data)
 	if (qmi_device_has_service(data->device, QMI_SERVICE_VOICE))
 			data->features |= GOBI_VOICE;
 
+	if (qmi_qmux_device_get_service_version(data->device, QMI_SERVICE_WMS,
+						&major, &minor)) {
+		if (major < 1 || (major == 1 && minor < 2))
+			ofono_warn("unsupported WMS version: %u.%u, need: 1.2",
+					major, minor);
+		else
+			data->features |= GOBI_WMS;
+	}
+
 	if (!(data->features & GOBI_DMS)) {
 		if (++data->discover_attempts < 3 &&
 				!qmi_device_discover(data->device, discover_cb,