summaryrefslogtreecommitdiffstats
path: root/common/state
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-02-20 12:21:00 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-02-22 08:22:11 +0100
commita66a8d79871c3763cd488cd5e785415a5dbc36de (patch)
tree5b6b2120d4dcd9e43d06c8637cc7090186bbefc6 /common/state
parent359966df3721803a1e0873c98182e7280029b068 (diff)
downloadbarebox-a66a8d79871c3763cd488cd5e785415a5dbc36de.tar.gz
state: remove unused arguments from state_new_from_node()
state_new_from_node() has arguments describing the backend path. These are never used in barebox, the backend path is always derived from the device nodes backend description. Remove these arguments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state')
-rw-r--r--common/state/state.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/common/state/state.c b/common/state/state.c
index cb97932..c5a3fee 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -567,17 +567,10 @@ void state_release(struct state *state)
/*
* state_new_from_node - create a new state instance from a device_node
*
- * @node The device_node describing the new state instance
- * @path Path to the backend device. If NULL the path is constructed
- * using the path in the backend property of the DT.
- * @offset Offset in the device path. May be 0 to start at the beginning.
- * @max_size Maximum size of the area used. This may be 0 to use the full
- * size.
* @readonly This is a read-only state. Note that with this option set,
* there are no repairs done.
*/
-struct state *state_new_from_node(struct device_node *node, char *path,
- off_t offset, size_t max_size, bool readonly)
+struct state *state_new_from_node(struct device_node *node, bool readonly)
{
struct state *state;
int ret = 0;
@@ -585,6 +578,7 @@ struct state *state_new_from_node(struct device_node *node, char *path,
const char *storage_type = NULL;
const char *alias;
uint32_t stridesize;
+ struct device_node *partition_node;
alias = of_alias_get(node);
if (!alias) {
@@ -596,26 +590,20 @@ struct state *state_new_from_node(struct device_node *node, char *path,
if (IS_ERR(state))
return state;
- if (!path) {
- struct device_node *partition_node;
-
- partition_node = of_parse_phandle(node, "backend", 0);
- if (!partition_node) {
- dev_err(&state->dev, "Cannot resolve \"backend\" phandle\n");
- ret = -EINVAL;
- goto out_release_state;
- }
-
- ret = of_find_path_by_node(partition_node, &path, 0);
- if (ret) {
- if (ret != -EPROBE_DEFER)
- dev_err(&state->dev, "state failed to parse path to backend: %s\n",
- strerror(-ret));
- goto out_release_state;
- }
+ partition_node = of_parse_phandle(node, "backend", 0);
+ if (!partition_node) {
+ dev_err(&state->dev, "Cannot resolve \"backend\" phandle\n");
+ ret = -EINVAL;
+ goto out_release_state;
}
- state->backend_path = xstrdup(path);
+ ret = of_find_path_by_node(partition_node, &state->backend_path, 0);
+ if (ret) {
+ if (ret != -EPROBE_DEFER)
+ dev_err(&state->dev, "state failed to parse path to backend: %s\n",
+ strerror(-ret));
+ goto out_release_state;
+ }
ret = of_property_read_string(node, "backend-type", &backend_type);
if (ret) {
@@ -635,8 +623,8 @@ struct state *state_new_from_node(struct device_node *node, char *path,
if (ret)
goto out_release_state;
- ret = state_storage_init(state, path, offset,
- max_size, stridesize, storage_type);
+ ret = state_storage_init(state, state->backend_path, 0,
+ 0, stridesize, storage_type);
if (ret)
goto out_release_state;