From: Patrick Delaunay <patrick.delaunay@foss.st.com>
To: <u-boot@lists.denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>,
Nandor Han <nandor.han@vaisala.com>,
Simon Glass <sjg@chromium.org>,
U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: [PATCH] reboot-mode: migrate uclass to livetree
Date: Mon, 20 Sep 2021 18:27:20 +0200 [thread overview]
Message-ID: <20210920182717.1.I218b17a86b820ee611e9dd643c1fb40e2b480257@changeid> (raw)
Use dev_ function to support a live tree.
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
drivers/reboot-mode/reboot-mode-uclass.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/reboot-mode/reboot-mode-uclass.c b/drivers/reboot-mode/reboot-mode-uclass.c
index bb7a355fbf..2b38aa26b8 100644
--- a/drivers/reboot-mode/reboot-mode-uclass.c
+++ b/drivers/reboot-mode/reboot-mode-uclass.c
@@ -10,8 +10,6 @@
#include <exports.h>
#include <reboot-mode/reboot-mode.h>
-DECLARE_GLOBAL_DATA_PTR;
-
int dm_reboot_mode_update(struct udevice *dev)
{
struct reboot_mode_ops *ops = reboot_mode_get_ops(dev);
@@ -66,25 +64,20 @@ int dm_reboot_mode_pre_probe(struct udevice *dev)
return -EINVAL;
#if CONFIG_IS_ENABLED(OF_CONTROL)
- const int node = dev_of_offset(dev);
const char *mode_prefix = "mode-";
const int mode_prefix_len = strlen(mode_prefix);
- int property;
+ struct ofprop property;
const u32 *propvalue;
const char *propname;
- plat_data->env_variable = fdt_getprop(gd->fdt_blob,
- node,
- "u-boot,env-variable",
- NULL);
+ plat_data->env_variable = dev_read_string(dev, "u-boot,env-variable");
if (!plat_data->env_variable)
plat_data->env_variable = "reboot-mode";
plat_data->count = 0;
- fdt_for_each_property_offset(property, gd->fdt_blob, node) {
- propvalue = fdt_getprop_by_offset(gd->fdt_blob,
- property, &propname, NULL);
+ dev_for_each_property(property, dev) {
+ propvalue = dev_read_prop_by_prop(&property, &propname, NULL);
if (!propvalue) {
dev_err(dev, "Could not get the value for property %s\n",
propname);
@@ -100,9 +93,8 @@ int dm_reboot_mode_pre_probe(struct udevice *dev)
struct reboot_mode_mode *next = plat_data->modes;
- fdt_for_each_property_offset(property, gd->fdt_blob, node) {
- propvalue = fdt_getprop_by_offset(gd->fdt_blob,
- property, &propname, NULL);
+ dev_for_each_property(property, dev) {
+ propvalue = dev_read_prop_by_prop(&property, &propname, NULL);
if (!propvalue) {
dev_err(dev, "Could not get the value for property %s\n",
propname);
--
2.25.1
next reply other threads:[~2021-09-20 16:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-20 16:27 Patrick Delaunay [this message]
2021-09-21 1:11 ` [PATCH] reboot-mode: migrate uclass to livetree Simon Glass
2021-10-05 22:02 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210920182717.1.I218b17a86b820ee611e9dd643c1fb40e2b480257@changeid \
--to=patrick.delaunay@foss.st.com \
--cc=nandor.han@vaisala.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=uboot-stm32@st-md-mailman.stormreply.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.