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:
parent
eb270fa3f9
commit
c0c471b8f2
1 changed files with 8 additions and 8 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue