refactor: Move to k_work_delayable API.

* Move to new `k_work_delayable` APIs introduced in Zephyr 2.6.

See: https://docs.zephyrproject.org/latest/releases/release-notes-2.6.html#api-changes
This commit is contained in:
Peter Johanson
2021-11-05 04:13:38 +00:00
committed by Pete Johanson
parent 28ef19488d
commit 53dae35710
11 changed files with 52 additions and 70 deletions

View File

@@ -35,13 +35,12 @@ static void endpoints_save_preferred_work(struct k_work *work) {
settings_save_one("endpoints/preferred", &preferred_endpoint, sizeof(preferred_endpoint));
}
static struct k_delayed_work endpoints_save_work;
static struct k_work_delayable endpoints_save_work;
#endif
static int endpoints_save_preferred() {
#if IS_ENABLED(CONFIG_SETTINGS)
k_delayed_work_cancel(&endpoints_save_work);
return k_delayed_work_submit(&endpoints_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE));
return k_work_reschedule(&endpoints_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE));
#else
return 0;
#endif
@@ -182,7 +181,7 @@ static int zmk_endpoints_init(const struct device *_arg) {
return err;
}
k_delayed_work_init(&endpoints_save_work, endpoints_save_preferred_work);
k_work_init_delayable(&endpoints_save_work, endpoints_save_preferred_work);
settings_load_subtree("endpoints");
#endif