Skip to content

Commit c8906fe

Browse files
Tomasz Bursztykacarlescufi
authored andcommitted
device: Instantiate all device instance as constant
As they are set at build time. Fixes #27399 Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 2fcf762 commit c8906fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ extern "C" {
126126
#define DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, \
127127
data_ptr, cfg_ptr, level, prio, api_ptr) \
128128
Z_DEVICE_DEFINE_PM(dev_name) \
129-
static Z_DECL_ALIGN(struct device) \
129+
static const Z_DECL_ALIGN(struct device) \
130130
DEVICE_NAME_GET(dev_name) __used \
131131
__attribute__((__section__(".device_" #level STRINGIFY(prio)))) = { \
132132
.name = drv_name, \
@@ -167,7 +167,7 @@ extern "C" {
167167
*
168168
* @param name Device name
169169
*/
170-
#define DEVICE_DECLARE(name) static struct device DEVICE_NAME_GET(name)
170+
#define DEVICE_DECLARE(name) static const struct device DEVICE_NAME_GET(name)
171171

172172
typedef void (*device_pm_cb)(struct device *dev,
173173
int status, void *context, void *arg);

0 commit comments

Comments
 (0)