tests: pm: initialize devices at compile time and fix ready checks

Initialize tests devices a,c at compile time. Also fix ready check (was
wrongly checking for NULL).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
diff --git a/tests/subsys/pm/device_wakeup_api/src/main.c b/tests/subsys/pm/device_wakeup_api/src/main.c
index 22b020b..2ae6879 100644
--- a/tests/subsys/pm/device_wakeup_api/src/main.c
+++ b/tests/subsys/pm/device_wakeup_api/src/main.c
@@ -9,10 +9,8 @@
 #include <zephyr/pm/pm.h>
 #include <zephyr/pm/device.h>
 
-#define DEV_NAME DT_NODELABEL(gpio0)
-
-
-static const struct device *dev;
+static const struct device *const dev =
+	DEVICE_DT_GET(DT_NODELABEL(gpio0));
 static uint8_t sleep_count;
 
 
@@ -80,8 +78,7 @@
 {
 	bool ret = false;
 
-	dev = DEVICE_DT_GET(DEV_NAME);
-	zassert_not_null(dev, "Failed to get device");
+	zassert_true(device_is_ready(dev), "Device not ready");
 
 	ret = pm_device_wakeup_is_capable(dev);
 	zassert_true(ret, "Device not marked as capable");
diff --git a/tests/subsys/pm/power_domain/src/main.c b/tests/subsys/pm/power_domain/src/main.c
index 18dc382..bf7ed9d 100644
--- a/tests/subsys/pm/power_domain/src/main.c
+++ b/tests/subsys/pm/power_domain/src/main.c
@@ -14,7 +14,10 @@
 #define TEST_DEVA DT_NODELABEL(test_dev_a)
 #define TEST_DEVB DT_NODELABEL(test_dev_b)
 
-static const struct device *domain, *deva, *devb, *devc;
+static const struct device *const domain = DEVICE_DT_GET(TEST_DOMAIN);
+static const struct device *const deva = DEVICE_DT_GET(TEST_DEVA);
+static const struct device *const devb = DEVICE_DT_GET(TEST_DEVB);
+static const struct device *devc;
 static int testing_domain_on_notitication;
 static int testing_domain_off_notitication;
 
@@ -125,9 +128,6 @@
 	int ret;
 	enum pm_device_state state;
 
-	domain = DEVICE_DT_GET(TEST_DOMAIN);
-	deva = DEVICE_DT_GET(TEST_DEVA);
-	devb = DEVICE_DT_GET(TEST_DEVB);
 	devc = DEVICE_GET(devc);
 
 	pm_device_init_suspended(domain);
diff --git a/tests/subsys/pm/power_mgmt/src/main.c b/tests/subsys/pm/power_mgmt/src/main.c
index fae73f7..775fb2b 100644
--- a/tests/subsys/pm/power_mgmt/src/main.c
+++ b/tests/subsys/pm/power_mgmt/src/main.c
@@ -31,9 +31,10 @@
 static const struct device *device_dummy;
 static struct dummy_driver_api *api;
 
-static const struct device *device_a;
-static const struct device *device_c;
-
+static const struct device *const device_a =
+	DEVICE_DT_GET(DT_INST(0, test_device_pm));
+static const struct device *const device_c =
+	DEVICE_DT_GET(DT_INST(2, test_device_pm));
 
 /*
  * According with the initialization level, devices A, B and C are
@@ -375,11 +376,8 @@
 
 ZTEST(power_management_1cpu, test_device_order)
 {
-	device_a = DEVICE_DT_GET(DT_INST(0, test_device_pm));
-	zassert_not_null(device_a, "Failed to get device");
-
-	device_c = DEVICE_DT_GET(DT_INST(2, test_device_pm));
-	zassert_not_null(device_c, "Failed to get device");
+	zassert_true(device_is_ready(device_a), "device a not ready");
+	zassert_true(device_is_ready(device_c), "device c not ready");
 
 	testing_device_order = true;
 	enter_low_power = true;