From 8f8927d94aaee3daad951fe2944d4b2aab9bcaad Mon Sep 17 00:00:00 2001 From: Hrishikesh Dhayagude Date: Mon, 21 Oct 2019 22:23:37 +0530 Subject: [PATCH] nimble: Use the stop event to validate instead of an argument --- porting/nimble/include/nimble/nimble_port.h | 2 -- porting/nimble/src/nimble_port.c | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/porting/nimble/include/nimble/nimble_port.h b/porting/nimble/include/nimble/nimble_port.h index c36ea26a1..fe9592764 100644 --- a/porting/nimble/include/nimble/nimble_port.h +++ b/porting/nimble/include/nimble/nimble_port.h @@ -25,8 +25,6 @@ #define NIMBLE_CORE (CONFIG_BT_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BT_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY) #define NIMBLE_STACK_SIZE CONFIG_BT_NIMBLE_TASK_STACK_SIZE -#define NIMBLE_PORT_DEINIT_EV_ARG -1 - #ifdef __cplusplus extern "C" { #endif diff --git a/porting/nimble/src/nimble_port.c b/porting/nimble/src/nimble_port.c index ef2574b40..7438a1c79 100644 --- a/porting/nimble/src/nimble_port.c +++ b/porting/nimble/src/nimble_port.c @@ -77,13 +77,11 @@ void nimble_port_run(void) { struct ble_npl_event *ev; - int arg; while (1) { ev = ble_npl_eventq_get(&g_eventq_dflt, BLE_NPL_TIME_FOREVER); ble_npl_event_run(ev); - arg = (int)ble_npl_event_get_arg(ev); - if (arg == NIMBLE_PORT_DEINIT_EV_ARG) { + if (ev == &ble_hs_ev_stop) { break; } } @@ -122,7 +120,7 @@ nimble_port_stop(void) ble_npl_sem_pend(&ble_hs_stop_sem, BLE_NPL_TIME_FOREVER); ble_npl_event_init(&ble_hs_ev_stop, nimble_port_stop_cb, - (void *)NIMBLE_PORT_DEINIT_EV_ARG); + NULL); ble_npl_eventq_put(&g_eventq_dflt, &ble_hs_ev_stop); /* Wait till the event is serviced */