tests: drivers: clock_control: nrf_onoff_and_bt: use DEVICE_DT_GET

Use DEVICE_DT_GET to obtain a reference to the chosen entropy device.
The device is now global, and readiness is checked at the test setup
fixture.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-02-25 18:55:41 +01:00 committed by Marti Bolivar
commit 9a02676d9e

View file

@ -20,11 +20,14 @@ static bool test_end;
#include <hal/nrf_gpio.h>
static const struct device *entropy = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
static struct onoff_manager *hf_mgr;
static uint32_t iteration;
static void setup(void)
{
zassert_true(device_is_ready(entropy), NULL);
hf_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
zassert_true(hf_mgr, NULL);
@ -101,8 +104,6 @@ static void test_onoff_interrupted(void)
{
const struct device *clock_dev =
device_get_binding(DT_LABEL(DT_INST(0, nordic_nrf_clock)));
const struct device *entropy =
device_get_binding(DT_CHOSEN_ZEPHYR_ENTROPY_LABEL);
struct onoff_client cli;
uint64_t start_time = k_uptime_get();
uint64_t elapsed;
@ -196,8 +197,6 @@ static void test_bt_interrupted(void)
{
const struct device *clock_dev =
device_get_binding(DT_LABEL(DT_INST(0, nordic_nrf_clock)));
const struct device *entropy =
device_get_binding(DT_CHOSEN_ZEPHYR_ENTROPY_LABEL);
uint64_t start_time = k_uptime_get();
uint64_t elapsed;
uint64_t checkpoint = 1000;