diff mbox series

[06/23] qmi: introduce qmi_service_clone

Message ID 20240607224746.903769-6-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
Allows obtaining a new lightweight qmi_service handle from an existing
handle.  All outstanding requests (sent using qmi_service_send) and
registrations (qmi_service_register) will be automatically canceled when
the lightweight handle is freed.
---
 drivers/qmimodem/qmi.c | 8 ++++++++
 drivers/qmimodem/qmi.h | 1 +
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 1b3fa34f685c..91469dc2e00c 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -2918,6 +2918,14 @@  static bool qmi_service_unregister_all(struct qmi_service *service)
 	return true;
 }
 
+struct qmi_service *qmi_service_clone(struct qmi_service *service)
+{
+	if (!service)
+		return NULL;
+
+	return service_create(service->family);
+}
+
 void qmi_service_free(struct qmi_service *service)
 {
 	if (!service)
diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h
index 227c498ab41d..821e54443658 100644
--- a/drivers/qmimodem/qmi.h
+++ b/drivers/qmimodem/qmi.h
@@ -139,6 +139,7 @@  typedef void (*qmi_create_func_t)(struct qmi_service *service, void *user_data);
 bool qmi_service_create_shared(struct qmi_device *device,
 				uint16_t type, qmi_create_func_t func,
 				void *user_data, qmi_destroy_func_t destroy);
+struct qmi_service *qmi_service_clone(struct qmi_service *service);
 void qmi_service_free(struct qmi_service *service);
 
 const char *qmi_service_get_identifier(struct qmi_service *service);