@@ -2538,17 +2538,25 @@ const char *qmi_service_get_identifier(struct qmi_service *service)
return __service_type_to_string(service->family->info.service_type);
}
-bool qmi_service_get_version(struct qmi_service *service,
- uint16_t *major, uint16_t *minor)
+/**
+ * qmi_service_get_version:
+ * @service: lightweight service handle
+ * @out_version: version output
+ *
+ * Returns the version of the service this handle is currently referring to.
+ * On QMUX this corresponds to the 'major' version of the service. On QRTR,
+ * this corresponds to the lower 8 bits of the 'instance' attribute and is thus
+ * limited to uint8_t.
+ *
+ * Returns: #false if the service handle is NULL, #true on success.
+ */
+bool qmi_service_get_version(struct qmi_service *service, uint8_t *out_version)
{
if (!service)
return false;
- if (major)
- *major = service->family->info.major;
-
- if (minor)
- *minor = service->family->info.minor;
+ if (out_version)
+ *out_version = service->family->info.major;
return true;
}
@@ -142,8 +142,7 @@ 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);
-bool qmi_service_get_version(struct qmi_service *service,
- uint16_t *major, uint16_t *minor);
+bool qmi_service_get_version(struct qmi_service *service, uint8_t *out_version);
uint16_t qmi_service_send(struct qmi_service *service,
uint16_t message, struct qmi_param *param,
@@ -232,15 +232,14 @@ static void test_create_services(const void *data)
for (i = 0; i < TEST_SERVICE_COUNT; i++) {
struct qmi_service *service;
- uint16_t major, minor;
+ uint8_t version;
service_type = unique_service_type(i);
service = qmi_qrtr_node_get_service(info->node, service_type);
assert(service);
- assert(qmi_service_get_version(service, &major, &minor));
- assert(major == unique_service_version(i));
- assert(minor == 0);
+ assert(qmi_service_get_version(service, &version));
+ assert(version == unique_service_version(i));
qmi_service_free(service);
}