drivers: sensor: dps310: Convert sample to use DEVICE_DT_GET_ONE
Move to use DEVICE_DT_GET_ONE instead of device_get_binding as
we work on phasing out use of DTS 'label' property.
Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
diff --git a/samples/sensor/dps310/src/main.c b/samples/sensor/dps310/src/main.c
index c14ebe9..5cd97d2 100644
--- a/samples/sensor/dps310/src/main.c
+++ b/samples/sensor/dps310/src/main.c
@@ -12,10 +12,10 @@
void main(void)
{
printk("Hello DPS310\n");
- const struct device *dev = device_get_binding(DT_LABEL(DT_INST(0, infineon_dps310)));
+ const struct device *dev = DEVICE_DT_GET_ONE(infineon_dps310);
- if (dev == NULL) {
- printk("Could not get DPS310 device\n");
+ if (!device_is_ready(dev)) {
+ printk("Device %s is not ready\n", dev->name);
return;
}