samples: vcnl4040: 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: Kumar Gala <galak@kernel.org>
diff --git a/samples/sensor/vcnl4040/src/main.c b/samples/sensor/vcnl4040/src/main.c
index 47be2cf..4fba38a 100644
--- a/samples/sensor/vcnl4040/src/main.c
+++ b/samples/sensor/vcnl4040/src/main.c
@@ -130,12 +130,10 @@
void main(void)
{
- const struct device *vcnl;
+ const struct device *vcnl = DEVICE_DT_GET_ONE(vishay_vcnl4040);
- printf("get device vcnl4040\n");
- vcnl = device_get_binding(DT_LABEL(DT_INST(0, vishay_vcnl4040)));
- if (!vcnl) {
- printf("Device not found.\n");
+ if (!device_is_ready(vcnl)) {
+ printk("sensor: device not ready.\n");
return;
}