Skip to content

Commit

Permalink
device: Instantiate all device instance as constant
Browse files Browse the repository at this point in the history
As they are set at build time.

Fixes zephyrproject-rtos#27399

Signed-off-by: Tomasz Bursztyka <[email protected]>
  • Loading branch information
Tomasz Bursztyka authored and carlescufi committed Sep 2, 2020
1 parent 2fcf762 commit c8906fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c8906fe

Please sign in to comment.