drivers: modem: Use modem command await function
Use the modem command await function where appropriate. Signed-off-by: Joakim Andersson <joerchan@gmail.com>
This commit is contained in:
parent
25341410a7
commit
b2bb1ffc1b
@ -570,13 +570,7 @@ int modem_cmd_send_ext(struct modem_iface *iface,
|
||||
iface->write(iface, data->eol, data->eol_len);
|
||||
|
||||
if (sem) {
|
||||
ret = k_sem_take(sem, timeout);
|
||||
|
||||
if (ret == 0) {
|
||||
ret = data->last_error;
|
||||
} else if (ret == -EAGAIN) {
|
||||
ret = -ETIMEDOUT;
|
||||
}
|
||||
ret = modem_cmd_handler_await(data, sem, timeout);
|
||||
}
|
||||
|
||||
if (!(flags & MODEM_NO_UNSET_CMDS)) {
|
||||
|
||||
@ -423,13 +423,8 @@ static ssize_t send_socket_data(void *obj,
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
ret = k_sem_take(&mdata.sem_response, timeout);
|
||||
|
||||
if (ret == 0) {
|
||||
ret = modem_cmd_handler_get_error(&mdata.cmd_handler_data);
|
||||
} else if (ret == -EAGAIN) {
|
||||
ret = -ETIMEDOUT;
|
||||
}
|
||||
ret = modem_cmd_handler_await(&mdata.cmd_handler_data, &mdata.sem_response, timeout);
|
||||
|
||||
exit:
|
||||
/* unset handler commands and ignore any errors */
|
||||
@ -496,13 +491,7 @@ static ssize_t send_cert(struct modem_socket *sock,
|
||||
k_sleep(MDM_PROMPT_CMD_DELAY);
|
||||
modem_cmd_send_data_nolock(&mctx.iface, cert_data, cert_len);
|
||||
|
||||
ret = k_sem_take(&mdata.sem_response, K_MSEC(1000));
|
||||
|
||||
if (ret == 0) {
|
||||
ret = modem_cmd_handler_get_error(&mdata.cmd_handler_data);
|
||||
} else if (ret == -EAGAIN) {
|
||||
ret = -ETIMEDOUT;
|
||||
}
|
||||
ret = modem_cmd_handler_await(&mdata.cmd_handler_data, &mdata.sem_response, K_MSEC(1000));
|
||||
|
||||
exit:
|
||||
/* unset handler commands and ignore any errors */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user