drivers: modem: gsm: Convert gsm_finalize_connection to work
Convert gsm_finalize_connection into a work so that the caller work won't have to run again when gsm_finalize_connection reschedule gsm_configure_work on error. Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
parent
c063c44028
commit
db31558c7d
1 changed files with 7 additions and 3 deletions
|
@ -598,9 +598,11 @@ static void rssi_handler(struct k_work *work)
|
|||
|
||||
}
|
||||
|
||||
static void gsm_finalize_connection(struct gsm_modem *gsm)
|
||||
static void gsm_finalize_connection(struct k_work *work)
|
||||
{
|
||||
int ret = 0;
|
||||
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
|
||||
struct gsm_modem *gsm = CONTAINER_OF(dwork, struct gsm_modem, gsm_configure_work);
|
||||
|
||||
/* If already attached, jump right to RSSI readout */
|
||||
if (gsm->attached) {
|
||||
|
@ -947,7 +949,8 @@ static void mux_setup(struct k_work *work)
|
|||
LOG_INF("PPP channel %d connected to %s",
|
||||
DLCI_PPP, gsm->ppp_dev->name);
|
||||
|
||||
gsm_finalize_connection(gsm);
|
||||
k_work_init_delayable(&gsm->gsm_configure_work, gsm_finalize_connection);
|
||||
(void)gsm_work_reschedule(&gsm->gsm_configure_work, K_NO_WAIT);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1010,8 @@ static void gsm_configure(struct k_work *work)
|
|||
return;
|
||||
}
|
||||
|
||||
gsm_finalize_connection(gsm);
|
||||
k_work_init_delayable(&gsm->gsm_configure_work, gsm_finalize_connection);
|
||||
(void)gsm_work_reschedule(&gsm->gsm_configure_work, K_NO_WAIT);
|
||||
}
|
||||
|
||||
void gsm_ppp_start(const struct device *dev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue