diff mbox series

[3/8] qmi: Move and rename QMUX sync logic

Message ID 20240226153459.1463304-3-denkenz@gmail.com (mailing list archive)
State Accepted
Commit 051150db7f67f1b2850014089bf2850bfedbe714
Headers show
Series [1/8] qmi: Use FAM instead of allocating a member | expand

Commit Message

Denis Kenzior Feb. 26, 2024, 3:34 p.m. UTC
This logic is QMUX only, move it to be spatially near the rest of QMUX
specific logic and just above where these functions are used.
---
 drivers/qmimodem/qmi.c | 58 +++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 29 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index be6f6f7bd601..b08c1642c8c1 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -1079,34 +1079,6 @@  static void discover_data_free(void *user_data)
 	l_free(data);
 }
 
-static void qmi_device_sync_callback(uint16_t message, uint16_t length,
-					const void *buffer, void *user_data)
-{
-	struct discover_data *data = user_data;
-
-	if (data->func)
-		data->func(data->user_data);
-
-	__qmi_device_discovery_complete(data->device, &data->super);
-}
-
-/* sync will release all previous clients */
-static bool qmi_device_sync(struct qmi_device *device,
-				struct discover_data *data)
-{
-	struct qmi_request *req;
-
-	__debug_device(device, "Sending sync to reset QMI");
-
-	req = __request_alloc(QMI_SERVICE_CONTROL, 0x00,
-				QMI_CTL_SYNC, NULL, 0,
-				qmi_device_sync_callback, data);
-
-	__request_submit(device, req);
-
-	return true;
-}
-
 int qmi_device_discover(struct qmi_device *device, qmi_discover_func_t func,
 				void *user_data, qmi_destroy_func_t destroy)
 {
@@ -1402,6 +1374,34 @@  static struct qmi_request *find_control_request(struct qmi_device *device,
 	return req;
 }
 
+static void qmux_sync_callback(uint16_t message, uint16_t length,
+					const void *buffer, void *user_data)
+{
+	struct discover_data *data = user_data;
+
+	if (data->func)
+		data->func(data->user_data);
+
+	__qmi_device_discovery_complete(data->device, &data->super);
+}
+
+/* sync will release all previous clients */
+static bool qmi_device_qmux_sync(struct qmi_device *device,
+					struct discover_data *data)
+{
+	struct qmi_request *req;
+
+	__debug_device(device, "Sending sync to reset QMI");
+
+	req = __request_alloc(QMI_SERVICE_CONTROL, 0x00,
+				QMI_CTL_SYNC, NULL, 0,
+				qmux_sync_callback, data);
+
+	__request_submit(device, req);
+
+	return true;
+}
+
 static void qmux_discover_callback(uint16_t message, uint16_t length,
 					const void *buffer, void *user_data)
 {
@@ -1479,7 +1479,7 @@  done:
 	/* if the device support the QMI call SYNC over the CTL interface */
 	if ((qmux->control_major == 1 && qmux->control_minor >= 5) ||
 			qmux->control_major > 1) {
-		qmi_device_sync(data->device, data);
+		qmi_device_qmux_sync(data->device, data);
 		return;
 	}