samples: jesd216: drop device_get_binding/DT_INST

Use DEVICE_DT_GET/DT_COMPAT_GET_ANY_STATUS_OKAY.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-04-26 13:31:32 -07:00 committed by Carles Cufí
commit c0c471b8f2

View file

@ -12,13 +12,13 @@
#include <inttypes.h> #include <inttypes.h>
#include <string.h> #include <string.h>
#if DT_NODE_HAS_STATUS(DT_INST(0, jedec_spi_nor), okay) #if DT_HAS_COMPAT_STATUS_OKAY(jedec_spi_nor)
#define FLASH_DEVICE DT_LABEL(DT_INST(0, jedec_spi_nor)) #define FLASH_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(jedec_spi_nor)
#elif DT_NODE_HAS_STATUS(DT_INST(0, nordic_qspi_nor), okay) #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_qspi_nor)
#define FLASH_DEVICE DT_LABEL(DT_INST(0, nordic_qspi_nor)) #define FLASH_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(nordic_qspi_nor)
#else #else
#error Unsupported flash driver #error Unsupported flash driver
#define FLASH_DEVICE "" #define FLASH_NODE DT_INVALID_NODE
#endif #endif
typedef void (*dw_extractor)(const struct jesd216_param_header *php, typedef void (*dw_extractor)(const struct jesd216_param_header *php,
@ -274,10 +274,10 @@ static void dump_bytes(const struct jesd216_param_header *php,
void main(void) void main(void)
{ {
const struct device *dev = device_get_binding(FLASH_DEVICE); const struct device *dev = DEVICE_DT_GET(FLASH_NODE);
if (!dev) { if (!device_is_ready(dev)) {
printf("%s: device not found\n", FLASH_DEVICE); printf("%s: device not ready\n", dev->name);
return; return;
} }