From 6b33c03892da7609814d20d039bf60793c6cc149 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 14 Jul 2022 11:09:19 -0500 Subject: [PATCH] samples: lps22hh: Convert to use DEVICE_DT_GET_ONE Move to use DEVICE_DT_GET_ONE instead of device_get_binding. This is more generic than the hardcoded string that was being used. Signed-off-by: Kumar Gala --- samples/sensor/lps22hh/src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/sensor/lps22hh/src/main.c b/samples/sensor/lps22hh/src/main.c index 69aa4c9c39..6974a8f78d 100644 --- a/samples/sensor/lps22hh/src/main.c +++ b/samples/sensor/lps22hh/src/main.c @@ -50,10 +50,10 @@ static void lps22hh_handler(const struct device *dev, void main(void) { - const struct device *dev = device_get_binding("LPS22HH"); + const struct device *dev = DEVICE_DT_GET_ONE(st_lps22hh); - if (dev == NULL) { - printf("Could not get LPS22HH device\n"); + if (!device_is_ready(dev)) { + printk("sensor: device not ready.\n"); return; }