From 08905f2a44d02efcf4bb243c9f838241ecbd2c86 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 4 May 2017 12:21:01 +0200 Subject: state: Binding: remove @0 from node name The '@0' suffix is for nodes which have a reg property, so do not use this suffix in the state example node which does not have a reg property. Signed-off-by: Sascha Hauer --- Documentation/devicetree/bindings/barebox/barebox,state.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst index 00fb592614..51b874a8be 100644 --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst @@ -74,7 +74,7 @@ Optional properties: Example:: - state: state@0 { + state: state { magic = <0x27031977>; compatible = "barebox,state"; backend-type = "raw"; -- cgit v1.2.3 From 49831918036ab3292870dc2c6035292e6af47ae1 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 4 May 2017 12:27:21 +0200 Subject: state: Make an alias mandatory The userspace barebox-state utility gets confused when no alias exists. Make the alias mandatory, so that people make it right^tm without having to ask. Signed-off-by: Sascha Hauer --- Documentation/devicetree/bindings/barebox/barebox,state.rst | 6 ++++++ common/state/state.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst index 51b874a8be..06a0d100c8 100644 --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst @@ -32,6 +32,8 @@ Required properties: * ``backend``: contains a phandle to the device/partition which holds the actual state data. * ``backend-type``: should be ``raw`` or ``dtb``. +* additionally a state node must have an alias in the /aliases/ node pointing + to it. Optional properties: @@ -74,6 +76,10 @@ Optional properties: Example:: + /aliases { + state = &state; + }; + state: state { magic = <0x27031977>; compatible = "barebox,state"; diff --git a/common/state/state.c b/common/state/state.c index c3c8b768c7..41bee0fdc5 100644 --- a/common/state/state.c +++ b/common/state/state.c @@ -567,8 +567,10 @@ struct state *state_new_from_node(struct device_node *node, char *path, uint32_t stridesize; alias = of_alias_get(node); - if (!alias) - alias = node->name; + if (!alias) { + pr_err("State node %s does not have an alias in the /aliases/ node\n", node->full_name); + return ERR_PTR(-EINVAL); + } state = state_new(alias); if (IS_ERR(state)) -- cgit v1.2.3