reboot-mode: migrate uclass to livetree
Use dev_ function to support a live tree. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
455f2d15bf
commit
c3ef4550a2
@ -10,8 +10,6 @@
|
|||||||
#include <exports.h>
|
#include <exports.h>
|
||||||
#include <reboot-mode/reboot-mode.h>
|
#include <reboot-mode/reboot-mode.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
|
||||||
|
|
||||||
int dm_reboot_mode_update(struct udevice *dev)
|
int dm_reboot_mode_update(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct reboot_mode_ops *ops = reboot_mode_get_ops(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;
|
return -EINVAL;
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||||
const int node = dev_of_offset(dev);
|
|
||||||
const char *mode_prefix = "mode-";
|
const char *mode_prefix = "mode-";
|
||||||
const int mode_prefix_len = strlen(mode_prefix);
|
const int mode_prefix_len = strlen(mode_prefix);
|
||||||
int property;
|
struct ofprop property;
|
||||||
const u32 *propvalue;
|
const u32 *propvalue;
|
||||||
const char *propname;
|
const char *propname;
|
||||||
|
|
||||||
plat_data->env_variable = fdt_getprop(gd->fdt_blob,
|
plat_data->env_variable = dev_read_string(dev, "u-boot,env-variable");
|
||||||
node,
|
|
||||||
"u-boot,env-variable",
|
|
||||||
NULL);
|
|
||||||
if (!plat_data->env_variable)
|
if (!plat_data->env_variable)
|
||||||
plat_data->env_variable = "reboot-mode";
|
plat_data->env_variable = "reboot-mode";
|
||||||
|
|
||||||
plat_data->count = 0;
|
plat_data->count = 0;
|
||||||
|
|
||||||
fdt_for_each_property_offset(property, gd->fdt_blob, node) {
|
dev_for_each_property(property, dev) {
|
||||||
propvalue = fdt_getprop_by_offset(gd->fdt_blob,
|
propvalue = dev_read_prop_by_prop(&property, &propname, NULL);
|
||||||
property, &propname, NULL);
|
|
||||||
if (!propvalue) {
|
if (!propvalue) {
|
||||||
dev_err(dev, "Could not get the value for property %s\n",
|
dev_err(dev, "Could not get the value for property %s\n",
|
||||||
propname);
|
propname);
|
||||||
@ -100,9 +93,8 @@ int dm_reboot_mode_pre_probe(struct udevice *dev)
|
|||||||
|
|
||||||
struct reboot_mode_mode *next = plat_data->modes;
|
struct reboot_mode_mode *next = plat_data->modes;
|
||||||
|
|
||||||
fdt_for_each_property_offset(property, gd->fdt_blob, node) {
|
dev_for_each_property(property, dev) {
|
||||||
propvalue = fdt_getprop_by_offset(gd->fdt_blob,
|
propvalue = dev_read_prop_by_prop(&property, &propname, NULL);
|
||||||
property, &propname, NULL);
|
|
||||||
if (!propvalue) {
|
if (!propvalue) {
|
||||||
dev_err(dev, "Could not get the value for property %s\n",
|
dev_err(dev, "Could not get the value for property %s\n",
|
||||||
propname);
|
propname);
|
||||||
|
Loading…
Reference in New Issue
Block a user