From c8906fef79cefce3fe8c24cd0d01d164614d579f Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Thu, 30 Apr 2020 21:46:13 +0200 Subject: [PATCH] device: Instantiate all device instance as constant As they are set at build time. Fixes #27399 Signed-off-by: Tomasz Bursztyka --- include/device.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/device.h b/include/device.h index 1e3061a99a8..e2516045576 100644 --- a/include/device.h +++ b/include/device.h @@ -126,7 +126,7 @@ extern "C" { #define DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, \ data_ptr, cfg_ptr, level, prio, api_ptr) \ Z_DEVICE_DEFINE_PM(dev_name) \ - static Z_DECL_ALIGN(struct device) \ + static const Z_DECL_ALIGN(struct device) \ DEVICE_NAME_GET(dev_name) __used \ __attribute__((__section__(".device_" #level STRINGIFY(prio)))) = { \ .name = drv_name, \ @@ -167,7 +167,7 @@ extern "C" { * * @param name Device name */ -#define DEVICE_DECLARE(name) static struct device DEVICE_NAME_GET(name) +#define DEVICE_DECLARE(name) static const struct device DEVICE_NAME_GET(name) typedef void (*device_pm_cb)(struct device *dev, int status, void *context, void *arg);