diff mbox series

[23/23] qmi: radio-settings: Drop use of qmi_service_create_shared

Message ID 20240607224746.903769-23-denkenz@gmail.com (mailing list archive)
State Superseded
Headers show
Series [01/23] gobi: Remove phonebook and stk atom creation | expand

Commit Message

Denis Kenzior June 7, 2024, 10:47 p.m. UTC
---
 drivers/qmimodem/radio-settings.c | 56 ++++++-------------------------
 plugins/gobi.c                    |  4 ++-
 2 files changed, 13 insertions(+), 47 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/radio-settings.c b/drivers/qmimodem/radio-settings.c
index 2e428b9d0c2e..8463c84bf1ed 100644
--- a/drivers/qmimodem/radio-settings.c
+++ b/drivers/qmimodem/radio-settings.c
@@ -198,59 +198,22 @@  error:
 	CALLBACK_WITH_FAILURE(cb, -1, data);
 }
 
-static void create_dms_cb(struct qmi_service *service, void *user_data)
+static int qmi_radio_settings_probev(struct ofono_radio_settings *rs,
+					unsigned int vendor, va_list args)
 {
-	struct ofono_radio_settings *rs = user_data;
-	struct settings_data *data = ofono_radio_settings_get_data(rs);
-
-	DBG("");
-
-	if (!service)
-		return;
-
-	data->dms = service;
-}
-
-static void create_nas_cb(struct qmi_service *service, void *user_data)
-{
-	struct ofono_radio_settings *rs = user_data;
-	struct settings_data *data = ofono_radio_settings_get_data(rs);
-
-	DBG("");
-
-	if (!service) {
-		ofono_error("Failed to request NAS service");
-		ofono_radio_settings_remove(rs);
-		return;
-	}
-
-	if (!qmi_service_get_version(service, &data->major, &data->minor)) {
-		ofono_error("Failed to get NAS service version");
-		ofono_radio_settings_remove(rs);
-		return;
-	}
-
-	data->nas = service;
-
-	ofono_radio_settings_register(rs);
-}
-
-static int qmi_radio_settings_probe(struct ofono_radio_settings *rs,
-					unsigned int vendor, void *user_data)
-{
-	struct qmi_device *device = user_data;
+	struct qmi_service *dms = va_arg(args, struct qmi_service *);
+	struct qmi_service *nas = va_arg(args, struct qmi_service *);
 	struct settings_data *data;
 
 	DBG("");
 
 	data = l_new(struct settings_data, 1);
+	data->dms = dms;
+	data->nas = nas;
 
-	ofono_radio_settings_set_data(rs, data);
+	qmi_service_get_version(data->nas, &data->major, &data->minor);
 
-	qmi_service_create_shared(device, QMI_SERVICE_DMS,
-						create_dms_cb, rs, NULL);
-	qmi_service_create_shared(device, QMI_SERVICE_NAS,
-						create_nas_cb, rs, NULL);
+	ofono_radio_settings_set_data(rs, data);
 
 	return 0;
 }
@@ -270,7 +233,8 @@  static void qmi_radio_settings_remove(struct ofono_radio_settings *rs)
 }
 
 static const struct ofono_radio_settings_driver driver = {
-	.probe		= qmi_radio_settings_probe,
+	.flags		= OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE,
+	.probev		= qmi_radio_settings_probev,
 	.remove		= qmi_radio_settings_remove,
 	.set_rat_mode	= qmi_set_rat_mode,
 	.query_rat_mode = qmi_query_rat_mode,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index b7a8240edd3c..549ccc6c9d7b 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -820,7 +820,9 @@  static void gobi_post_sim(struct ofono_modem *modem)
 					qmi_service_clone(data->wds));
 
 	if (data->features & GOBI_NAS)
-		ofono_radio_settings_create(modem, 0, "qmimodem", data->device);
+		ofono_radio_settings_create(modem, 0, "qmimodem",
+					qmi_service_clone(data->dms),
+					qmi_service_clone(data->nas));
 
 	if (data->features & GOBI_WMS)
 		ofono_sms_create(modem, 0, "qmimodem",