diff options
author | Denis Kenzior <denkenz@gmail.com> | 2024-02-22 23:32:33 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2024-02-26 09:34:21 -0600 |
commit | 051150db7f67f1b2850014089bf2850bfedbe714 (patch) | |
tree | 3de00210f951598ef1a4d3e518cce05353e6e6a8 | |
parent | 1a801dfb93db62ba2eb5e290e952274fad304d15 (diff) | |
download | ofono-051150db7f67f1b2850014089bf2850bfedbe714.tar.gz |
qmi: Move and rename QMUX sync logic
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.
-rw-r--r-- | drivers/qmimodem/qmi.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index be6f6f7bd..b08c1642c 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; } |