samples: drivers: soc_flash_nrf: use DEVICE_DT_GET

Flash device can be obtained 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:20:40 +01:00 committed by Carles Cufí
parent f8c0e3907e
commit efd2872e43

View file

@ -9,6 +9,7 @@
#include <drivers/flash.h>
#include <storage/flash_map.h>
#include <device.h>
#include <devicetree.h>
#include <stdio.h>
@ -44,11 +45,9 @@ void main(void)
printf("\nNordic nRF5 Flash Testing\n");
printf("=========================\n");
flash_dev =
device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL);
if (!flash_dev) {
printf("Nordic nRF5 flash driver was not found!\n");
flash_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
if (!device_is_ready(flash_dev)) {
printf("Flash device not ready\n");
return;
}