diff mbox series

[08/23] qmi: devinfo: Drop use of qmi_service_create_shared

Message ID 20240607224746.903769-8-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
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 mbox series

Patch

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 c82dd70d25e1..1a31e7a2b17d 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -725,7 +725,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";