samples: adxl372: drop device_get_binding/DT_INST

Use DEVICE_DT_GET_ANY.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-04-26 14:00:15 -07:00 committed by Carles Cufí
commit 72795c3e6c

View file

@ -48,10 +48,14 @@ void main(void)
int i; int i;
char meter[200]; char meter[200];
const struct device *dev = device_get_binding(DT_LABEL(DT_INST(0, adi_adxl372))); const struct device *dev = DEVICE_DT_GET_ANY(adi_adxl372);
if (dev == NULL) { if (!dev) {
printf("Could not get %s device\n", DT_LABEL(DT_INST(0, adi_adxl372))); printf("Devicetree has no adi,adxl372 node\n");
return;
}
if (!device_is_ready(dev)) {
printf("Device %s is not ready\n", dev->name);
return; return;
} }