diff mbox series

[2/4] qmi: Add more service info to qmi_service

Message ID 20240228215319.153068-2-steve.schrock@getcruise.com (mailing list archive)
State Superseded
Headers show
Series [1/4] qmi: Create a method to find a service by type | expand

Commit Message

Steve Schrock Feb. 28, 2024, 9:53 p.m. UTC
QRTR will need to know the node and port for writes.
---
 drivers/qmimodem/qmi.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index aca4df0d..a297a77f 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -118,9 +118,7 @@  struct qmi_device_qmux {
 struct qmi_service {
 	int ref_count;
 	struct qmi_device *device;
-	uint8_t type;
-	uint16_t major;
-	uint16_t minor;
+	struct qmi_service_info info;
 	uint8_t client_id;
 	uint16_t next_notify_id;
 	struct l_queue *notify_list;
@@ -315,7 +313,7 @@  static void __service_find_by_type(const void *key, void *value,
 	if (L_PTR_TO_UINT(key) & 0x80000000)
 		return;
 
-	if (service->type == data->type)
+	if (service->info.service_type == data->type)
 		data->found_service = service;
 }
 
@@ -1689,17 +1687,18 @@  static void qmux_client_create_callback(uint16_t message, uint16_t length,
 	service->ref_count = 1;
 	service->device = data->device;
 
-	service->type = data->type;
-	service->major = data->major;
-	service->minor = data->minor;
+	service->info.service_type = data->type;
+	service->info.major = data->major;
+	service->info.minor = data->minor;
 
 	service->client_id = client_id->client;
 	service->notify_list = l_queue_new();
 
 	__debug_device(device, "service created [client=%d,type=%d]",
-					service->client_id, service->type);
+					service->client_id,
+					service->info.service_type);
 
-	hash_id = service->type | (service->client_id << 8);
+	hash_id = service->info.service_type | (service->client_id << 8);
 
 	l_hashmap_replace(device->service_list, L_UINT_TO_PTR(hash_id),
 				service, (void **) &old_service);
@@ -2528,12 +2527,12 @@  void qmi_service_unref(struct qmi_service *service)
 	qmi_service_cancel_all(service);
 	qmi_service_unregister_all(service);
 
-	hash_id = service->type | (service->client_id << 8);
+	hash_id = service->info.service_type | (service->client_id << 8);
 
 	l_hashmap_remove(device->service_list, L_UINT_TO_PTR(hash_id));
 
 	if (device->ops->client_release)
-		device->ops->client_release(device, service->type,
+		device->ops->client_release(device, service->info.service_type,
 							service->client_id);
 
 	l_free(service);
@@ -2544,7 +2543,7 @@  const char *qmi_service_get_identifier(struct qmi_service *service)
 	if (!service)
 		return NULL;
 
-	return __service_type_to_string(service->type);
+	return __service_type_to_string(service->info.service_type);
 }
 
 bool qmi_service_get_version(struct qmi_service *service,
@@ -2554,10 +2553,10 @@  bool qmi_service_get_version(struct qmi_service *service,
 		return false;
 
 	if (major)
-		*major = service->major;
+		*major = service->info.major;
 
 	if (minor)
-		*minor = service->minor;
+		*minor = service->info.minor;
 
 	return true;
 }
@@ -2631,7 +2630,7 @@  uint16_t qmi_service_send(struct qmi_service *service,
 	data->user_data = user_data;
 	data->destroy = destroy;
 
-	req = __request_alloc(service->type, service->client_id,
+	req = __request_alloc(service->info.service_type, service->client_id,
 				message,
 				param ? param->data : NULL,
 				param ? param->length : 0,