summaryrefslogtreecommitdiffstats
path: root/commands/of_display_timings.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/of_display_timings.c')
-rw-r--r--commands/of_display_timings.c51
1 files changed, 9 insertions, 42 deletions
diff --git a/commands/of_display_timings.c b/commands/of_display_timings.c
index 365ff80c36..232074fce7 100644
--- a/commands/of_display_timings.c
+++ b/commands/of_display_timings.c
@@ -1,20 +1,7 @@
-/*
- * of_display_timings.c - list and select display_timings
- *
- * Copyright (c) 2014 Teresa Gámez <t.gamez@phytec.de> PHYTEC Messtechnik GmbH
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: © 2014 Teresa Gámez <t.gamez@phytec.de>, PHYTEC Messtechnik GmbH
+
+/* of_display_timings.c - list and select display_timings */
#include <common.h>
#include <filetype.h>
@@ -80,29 +67,9 @@ static int do_of_display_timings(int argc, char *argv[])
/* Check if external dtb given */
if (dtbfile) {
- void *fdt;
- size_t size;
-
- fdt = read_file(dtbfile, &size);
- if (!fdt) {
- pr_err("unable to read %s: %s\n", dtbfile,
- strerror(errno));
- return -errno;
- }
-
- if (file_detect_type(fdt, size) != filetype_oftree) {
- pr_err("%s is not a oftree file.\n", dtbfile);
- free(fdt);
- return -EINVAL;
- }
-
- root = of_unflatten_dtb(fdt);
-
- free(fdt);
-
+ root = of_read_file(dtbfile);
if (IS_ERR(root))
return PTR_ERR(root);
-
} else {
root = of_get_root_node();
}
@@ -111,9 +78,9 @@ static int do_of_display_timings(int argc, char *argv[])
int found = 0;
const char *node = "display-timings";
- for_each_node_by_name_from(display, root, node) {
+ for_each_node_by_name_address_from(display, root, node) {
for_each_child_of_node(display, timings) {
- printf("%s\n", timings->full_name);
+ printf("%pOF\n", timings);
found = 1;
}
}
@@ -126,13 +93,13 @@ static int do_of_display_timings(int argc, char *argv[])
int found = 0;
const char *node = "display-timings";
- for_each_node_by_name_from(display, root, node) {
+ for_each_node_by_name_address_from(display, root, node) {
timings = of_parse_phandle_from(display, root,
"native-mode", 0);
if (!timings)
continue;
- printf("%s\n", timings->full_name);
+ printf("%pOF\n", timings);
found = 1;
}