Skip to content

Commit

Permalink
platform: rtos becomes scheduler to allow more generic implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
joelguittet committed May 25, 2024
1 parent 8c3271d commit 2186a1c
Show file tree
Hide file tree
Showing 19 changed files with 340 additions and 340 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ mkdir -p build
cd build

# Build weak use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/weak" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="generic/weak" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/weak" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)

# Build ESP-IDF use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/cryptoauthlib" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_NET_TYPE="esp-idf" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="freertos" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="esp-idf/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/cryptoauthlib" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)

# Build Zephyr use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/cryptoauthlib" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_NET_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="zephyr" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="zephyr/nvs" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/cryptoauthlib" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)

# Build Posix use case
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="posix" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="posix" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/curl" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="posix" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="posix" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="posix" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="posix" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/curl" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="posix" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="posix" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=ON -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="posix" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="posix" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/curl" -DCONFIG_MENDER_PLATFORM_RTOS_TYPE="posix" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="posix" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
cmake .. -G "Unix Makefiles" -DCONFIG_MENDER_PLATFORM_FLASH_TYPE="posix" -DCONFIG_MENDER_PLATFORM_LOG_TYPE="posix" -DCONFIG_MENDER_PLATFORM_NET_TYPE="generic/curl" -DCONFIG_MENDER_PLATFORM_SCHEDULER_TYPE="posix" -DCONFIG_MENDER_PLATFORM_STORAGE_TYPE="posix" -DCONFIG_MENDER_PLATFORM_TLS_TYPE="generic/mbedtls" -DCONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE=ON -DCONFIG_MENDER_CLIENT_CONFIGURE_STORAGE=OFF -DCONFIG_MENDER_CLIENT_ADD_ON_INVENTORY=ON -DCONFIG_MENDER_CLIENT_ADD_ON_TROUBLESHOOT=ON
make -j$(nproc)
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ if (NOT CONFIG_MENDER_PLATFORM_NET_TYPE)
else()
message(STATUS "Using custom '${CONFIG_MENDER_PLATFORM_NET_TYPE}' platform network implementation")
endif()
if (NOT CONFIG_MENDER_PLATFORM_RTOS_TYPE)
message(STATUS "Using default 'generic/weak' platform RTOS implementation")
set(CONFIG_MENDER_PLATFORM_RTOS_TYPE "generic/weak")
if (NOT CONFIG_MENDER_PLATFORM_SCHEDULER_TYPE)
message(STATUS "Using default 'generic/weak' platform scheduler implementation")
set(CONFIG_MENDER_PLATFORM_SCHEDULER_TYPE "generic/weak")
else()
message(STATUS "Using custom '${CONFIG_MENDER_PLATFORM_RTOS_TYPE}' platform RTOS implementation")
message(STATUS "Using custom '${CONFIG_MENDER_PLATFORM_SCHEDULER_TYPE}' platform scheduler implementation")
endif()
if (NOT CONFIG_MENDER_PLATFORM_STORAGE_TYPE)
message(STATUS "Using default 'generic/weak' platform storage implementation")
Expand Down Expand Up @@ -180,7 +180,7 @@ file(GLOB SOURCES_TEMP
"${CMAKE_CURRENT_LIST_DIR}/platform/flash/${CONFIG_MENDER_PLATFORM_FLASH_TYPE}/src/mender-flash.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/log/${CONFIG_MENDER_PLATFORM_LOG_TYPE}/src/mender-log.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/net/${CONFIG_MENDER_PLATFORM_NET_TYPE}/src/mender-http.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/rtos/${CONFIG_MENDER_PLATFORM_RTOS_TYPE}/src/mender-rtos.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/scheduler/${CONFIG_MENDER_PLATFORM_SCHEDULER_TYPE}/src/mender-scheduler.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/storage/${CONFIG_MENDER_PLATFORM_STORAGE_TYPE}/src/mender-storage.c"
"${CMAKE_CURRENT_LIST_DIR}/platform/tls/${CONFIG_MENDER_PLATFORM_TLS_TYPE}/src/mender-tls.c"
)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ The source code is separated into three main directories:
* `mender-log`: logging API.
* `mender-http`: implementation of HTTP client.
* `mender-websocket`: implementation of websocket client.
* `mender-rtos`: implementation of RTOS related functions.
* `mender-scheduler`: implementation of scheduler related functions.
* `mender-tls`: provide TLS support.
* `add-ons` contains source files of the mender add-ons:
* `mender-inventory`: provide inventory key/value pairs to display inventory data on the mender server. This add-on is highly recommended and should be included by default. It is proposed as an add-on only to give the possibility to reduce the final code size for user who don't need it.
Expand Down
34 changes: 17 additions & 17 deletions add-ons/src/mender-configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "mender-client.h"
#include "mender-configure.h"
#include "mender-log.h"
#include "mender-rtos.h"
#include "mender-scheduler.h"
#include "mender-storage.h"

#ifdef CONFIG_MENDER_CLIENT_ADD_ON_CONFIGURE
Expand Down Expand Up @@ -103,7 +103,7 @@ mender_configure_init(mender_configure_config_t *config, mender_configure_callba
memcpy(&mender_configure_callbacks, callbacks, sizeof(mender_configure_callbacks_t));

/* Create configure mutex */
if (MENDER_OK != (ret = mender_rtos_mutex_create(&mender_configure_mutex))) {
if (MENDER_OK != (ret = mender_scheduler_mutex_create(&mender_configure_mutex))) {
mender_log_error("Unable to create configure mutex");
goto END;
}
Expand Down Expand Up @@ -144,11 +144,11 @@ mender_configure_init(mender_configure_config_t *config, mender_configure_callba
#endif /* CONFIG_MENDER_CLIENT_CONFIGURE_STORAGE */

/* Create mender configure work */
mender_rtos_work_params_t configure_work_params;
mender_scheduler_work_params_t configure_work_params;
configure_work_params.function = mender_configure_work_function;
configure_work_params.period = mender_configure_config.refresh_interval;
configure_work_params.name = "mender_configure";
if (MENDER_OK != (ret = mender_rtos_work_create(&configure_work_params, &mender_configure_work_handle))) {
if (MENDER_OK != (ret = mender_scheduler_work_create(&configure_work_params, &mender_configure_work_handle))) {
mender_log_error("Unable to create configure work");
goto END;
}
Expand All @@ -172,7 +172,7 @@ mender_configure_activate(void) {
mender_err_t ret;

/* Activate configure work */
if (MENDER_OK != (ret = mender_rtos_work_activate(mender_configure_work_handle))) {
if (MENDER_OK != (ret = mender_scheduler_work_activate(mender_configure_work_handle))) {
mender_log_error("Unable to activate configure work");
return ret;
}
Expand All @@ -187,7 +187,7 @@ mender_configure_get(mender_keystore_t **configuration) {
mender_err_t ret;

/* Take mutex used to protect access to the configuration key-store */
if (MENDER_OK != (ret = mender_rtos_mutex_take(mender_configure_mutex, -1))) {
if (MENDER_OK != (ret = mender_scheduler_mutex_take(mender_configure_mutex, -1))) {
mender_log_error("Unable to take mutex");
return ret;
}
Expand All @@ -201,7 +201,7 @@ mender_configure_get(mender_keystore_t **configuration) {
END:

/* Release mutex used to protect access to the configuration key-store */
mender_rtos_mutex_give(mender_configure_mutex);
mender_scheduler_mutex_give(mender_configure_mutex);

return ret;
}
Expand All @@ -215,7 +215,7 @@ mender_configure_set(mender_keystore_t *configuration) {
mender_err_t ret;

/* Take mutex used to protect access to the configuration key-store */
if (MENDER_OK != (ret = mender_rtos_mutex_take(mender_configure_mutex, -1))) {
if (MENDER_OK != (ret = mender_scheduler_mutex_take(mender_configure_mutex, -1))) {
mender_log_error("Unable to take mutex");
return ret;
}
Expand Down Expand Up @@ -273,7 +273,7 @@ mender_configure_set(mender_keystore_t *configuration) {
}

/* Release mutex used to protect access to the configuration key-store */
mender_rtos_mutex_give(mender_configure_mutex);
mender_scheduler_mutex_give(mender_configure_mutex);

return ret;
}
Expand All @@ -284,7 +284,7 @@ mender_configure_execute(void) {
mender_err_t ret;

/* Trigger execution of the work */
if (MENDER_OK != (ret = mender_rtos_work_execute(mender_configure_work_handle))) {
if (MENDER_OK != (ret = mender_scheduler_work_execute(mender_configure_work_handle))) {
mender_log_error("Unable to trigger configure work");
return ret;
}
Expand All @@ -298,14 +298,14 @@ mender_configure_exit(void) {
mender_err_t ret;

/* Deactivate mender configure work */
mender_rtos_work_deactivate(mender_configure_work_handle);
mender_scheduler_work_deactivate(mender_configure_work_handle);

/* Delete mender configure work */
mender_rtos_work_delete(mender_configure_work_handle);
mender_scheduler_work_delete(mender_configure_work_handle);
mender_configure_work_handle = NULL;

/* Take mutex used to protect access to the configure key-store */
if (MENDER_OK != (ret = mender_rtos_mutex_take(mender_configure_mutex, -1))) {
if (MENDER_OK != (ret = mender_scheduler_mutex_take(mender_configure_mutex, -1))) {
mender_log_error("Unable to take mutex");
return ret;
}
Expand All @@ -314,8 +314,8 @@ mender_configure_exit(void) {
mender_configure_config.refresh_interval = 0;
mender_utils_keystore_delete(mender_configure_keystore);
mender_configure_keystore = NULL;
mender_rtos_mutex_give(mender_configure_mutex);
mender_rtos_mutex_delete(mender_configure_mutex);
mender_scheduler_mutex_give(mender_configure_mutex);
mender_scheduler_mutex_delete(mender_configure_mutex);

return ret;
}
Expand All @@ -326,7 +326,7 @@ mender_configure_work_function(void) {
mender_err_t ret;

/* Take mutex used to protect access to the configuration key-store */
if (MENDER_OK != (ret = mender_rtos_mutex_take(mender_configure_mutex, -1))) {
if (MENDER_OK != (ret = mender_scheduler_mutex_take(mender_configure_mutex, -1))) {
mender_log_error("Unable to take mutex");
return ret;
}
Expand Down Expand Up @@ -374,7 +374,7 @@ mender_configure_work_function(void) {
#endif /* CONFIG_MENDER_CLIENT_CONFIGURE_STORAGE */

/* Release mutex used to protect access to the configuration key-store */
mender_rtos_mutex_give(mender_configure_mutex);
mender_scheduler_mutex_give(mender_configure_mutex);

return ret;
}
Expand Down
Loading

0 comments on commit 2186a1c

Please sign in to comment.