tests: drivers: flash_simulator: use DEVICE_DT_GET

Obtain the flash controller at compile time using DEVICE_DT_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-03-23 15:28:54 +01:00 committed by Carles Cufí
parent a5a768ec0f
commit 6135c164f7

View file

@ -32,7 +32,7 @@
(((((((0xff & pat) << 8) | (0xff & pat)) << 8) | \
(0xff & pat)) << 8) | (0xff & pat))
static const struct device *flash_dev;
static const struct device *flash_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
static uint8_t test_read_buf[TEST_SIM_FLASH_SIZE];
static uint32_t p32_inc;
@ -76,10 +76,8 @@ static void test_init(void)
{
int rc;
flash_dev = device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL);
zassert_true(flash_dev != NULL,
"Simulated flash driver was not found!");
zassert_true(device_is_ready(flash_dev),
"Simulated flash device not ready");
rc = flash_erase(flash_dev, FLASH_SIMULATOR_BASE_OFFSET,
FLASH_SIMULATOR_FLASH_SIZE);