summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/board/hostfile.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-10-12 08:26:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-10-13 08:45:15 +0200
commit62013777e6041b7437c233686a60d1454e9ff06d (patch)
tree6f61e16dacd806639a9488d98a64ecdfdf2fbe2b /arch/sandbox/board/hostfile.c
parent606300a214f544403ffbc1c8169abbf89cb2b8c5 (diff)
downloadbarebox-62013777e6041b7437c233686a60d1454e9ff06d.tar.gz
barebox-62013777e6041b7437c233686a60d1454e9ff06d.tar.xz
sandbox: hostfile: maintain created temp files over reset
Currently, hostfils without a barebox,filename are assigned a new temporary file on every start. For use of a hostfile syscon for reboot mode or reset source, we will need to persist the changes over a regular reset. This can easily be done by passing through all automatically created temporary file with an explicit --image option on subsequent runs. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/board/hostfile.c')
-rw-r--r--arch/sandbox/board/hostfile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 2d4e5d55ea..e3e38b7119 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -191,14 +191,22 @@ static int of_hostfile_fixup(struct device_node *root, void *ctx)
{
struct hf_info *hf = ctx;
struct device_node *node;
+ bool name_only = false;
int ret;
- node = of_new_node(root, hf->devname);
+ node = of_get_child_by_name(root, hf->devname);
+ if (node)
+ name_only = true;
+ else
+ node = of_new_node(root, hf->devname);
ret = of_property_write_string(node, "barebox,filename", hf->filename);
if (ret)
return ret;
+ if (name_only)
+ return 0;
+
ret = of_property_write_string(node, "compatible", hostfile_dt_ids->compatible);
if (ret)
return ret;