Skip to content

Commit 6eb371f

Browse files
committed
fb: initialize devices at compile time
Initialize devices at compile time, allowing to constify device pointer. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 38448be commit 6eb371f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/fb/cfb_shell.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
#define HELP_INIT "call \"cfb init\" first"
2020
#define HELP_PRINT "<col: pos> <row: pos> \"<text>\""
2121

22-
static const struct device *dev;
22+
static const struct device *const dev =
23+
DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
2324
static const char * const param_name[] = {
2425
"height", "width", "ppt", "rows", "cols"};
2526

@@ -410,7 +411,6 @@ static int cmd_init(const struct shell *shell, size_t argc, char *argv[])
410411
{
411412
int err;
412413

413-
dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
414414
if (!device_is_ready(dev)) {
415415
shell_error(shell, "Display device not ready");
416416
return -ENODEV;

0 commit comments

Comments
 (0)