diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2021-06-24 16:48:04 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-28 12:56:48 +0000 |
commit | f4362c1b541ad3ca10b8cb2f7b72c8063dea6fd8 (patch) | |
tree | 12bc6fb0778f367a2331dd39acec48fddd99fc13 /zephyr/shim/src/watchdog.c | |
parent | 5d9859ffa6bc1687818bbc3c955a20c7e0a2db07 (diff) | |
download | chrome-ec-f4362c1b541ad3ca10b8cb2f7b72c8063dea6fd8.tar.gz |
zephyr: use DEVICE_DT_GET for various shim modules
Convert various device_get_binding to DEVICE_DT_GET, which is processed
at link time and more efficient. Same pattern on different modules where
the output is checked using device_is_ready.
BRANCH=none
BUG=none
TEST=zmake configure -b -B ~/build-volteer/ zephyr/projects/volteer/volteer
TEST=zmake configure -b -B ~/build-it8xxx2_evb/ zephyr/projects/it8xxx2_evb
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: If426420da2c61b3bc02eb77e122469a1a40799f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2985463
Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/shim/src/watchdog.c')
-rw-r--r-- | zephyr/shim/src/watchdog.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/zephyr/shim/src/watchdog.c b/zephyr/shim/src/watchdog.c index 13d380bfcb..2895868757 100644 --- a/zephyr/shim/src/watchdog.c +++ b/zephyr/shim/src/watchdog.c @@ -26,9 +26,9 @@ int watchdog_init(void) const struct device *wdt; struct wdt_timeout_cfg wdt_config; - wdt = device_get_binding(DT_LABEL(DT_NODELABEL(twd0))); - if (!wdt) { - LOG_ERR("Watchdog get binding failed"); + wdt = DEVICE_DT_GET(DT_NODELABEL(twd0)); + if (!device_is_ready(wdt)) { + LOG_ERR("Error: device %s is not ready", wdt->name); return -1; } @@ -62,11 +62,9 @@ void watchdog_reload(void) { const struct device *wdt; - wdt = device_get_binding(DT_LABEL(DT_NODELABEL(twd0))); - if (!wdt) { - LOG_ERR("Watchdog get binding failed"); - return; - } + wdt = DEVICE_DT_GET(DT_NODELABEL(twd0)); + if (!device_is_ready(wdt)) + LOG_ERR("Error: device %s is not ready", wdt->name); wdt_feed(wdt, 0); } |