tests: cpp: add a pm device reference

On some architecture (qemu_x86) this tests generate an unused reference
warning for the PM device structure, as nothing in the structure macro
definition is referencing itself.

Reference the struct in the device define, keep the compiler happy.

Also change one of the device priority to dodge a

'__device_dts_ord_8' causes a section type conflict with
'__device_dts_ord_9'

error with llvm.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2024-09-18 17:21:18 +00:00 committed by Anas Nashif
commit b094167114

View file

@ -145,10 +145,11 @@ ZTEST_SUITE(cxx_tests, NULL, NULL, NULL, NULL, NULL);
*
* DEVICE_DEFINE(dev_id, name, * init_fn, pm, data, config, level, prio, api)
*/
DEVICE_DT_DEFINE(DT_NODELABEL(test_dev0_boot), NULL, NULL, NULL, NULL, POST_KERNEL, 33, NULL);
DEVICE_DT_DEFINE(DT_NODELABEL(test_dev1_dfr), NULL, NULL, NULL, NULL, POST_KERNEL, 33, NULL);
static int fake_pm_action(const struct device *dev,
enum pm_device_action pm_action) { return -1; }
PM_DEVICE_DT_DEFINE(DT_NODELABEL(test_dev0_boot), fake_pm_action);
DEVICE_DT_DEFINE(DT_NODELABEL(test_dev0_boot), NULL,
PM_DEVICE_DT_GET(DT_NODELABEL(test_dev0_boot)), NULL, NULL, POST_KERNEL, 34, NULL);