summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2015-05-13 12:12:30 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-05-15 07:03:49 +0200
commit65a8f2f8f1066b589560b1f09f3ae1da485335eb (patch)
tree8d5e3dc5d28357478ff895436e393923c9e88bae /common
parent74840ebe98f81ad839f4808ea5daf3cd27ac42f5 (diff)
downloadbarebox-65a8f2f8f1066b589560b1f09f3ae1da485335eb.tar.gz
barebox-65a8f2f8f1066b589560b1f09f3ae1da485335eb.tar.xz
state: backend: support phandle and of_path references
This patch improves the backend property, it can be either a phandle or a of_path. During probe() of the state driver the backend property is dereferenced and the resulting of_path is saved in the state context. In a later patch it will be used to generate a phandle reference to the backend during DT fixup. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/state.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/common/state.c b/common/state.c
index 744a6f8250..d6060bb7df 100644
--- a/common/state.c
+++ b/common/state.c
@@ -54,6 +54,7 @@ struct state_backend {
int (*load)(struct state_backend *backend, struct state *state);
int (*save)(struct state_backend *backend, struct state *state);
const char *name;
+ const char *of_path;
const char *path;
};
@@ -903,7 +904,7 @@ out:
* @state The state instance to work on
* @path The path where the state will be stored to
*/
-int state_backend_dtb_file(struct state *state, const char *path)
+int state_backend_dtb_file(struct state *state, const char *of_path, const char *path)
{
struct state_backend_dtb *backend_dtb;
struct state_backend *backend;
@@ -918,6 +919,7 @@ int state_backend_dtb_file(struct state *state, const char *path)
backend->load = state_backend_dtb_load;
backend->save = state_backend_dtb_save;
+ backend->of_path = xstrdup(of_path);
backend->path = xstrdup(path);
backend->name = "dtb";
@@ -1133,8 +1135,8 @@ out_free:
* device @size may be 0. The two copies are spread to different
* eraseblocks if approriate for this device.
*/
-int state_backend_raw_file(struct state *state, const char *path, off_t offset,
- size_t size)
+int state_backend_raw_file(struct state *state, const char *of_path,
+ const char *path, off_t offset, size_t size)
{
struct state_backend_raw *backend_raw;
struct state_backend *backend;
@@ -1159,6 +1161,7 @@ int state_backend_raw_file(struct state *state, const char *path, off_t offset,
backend->load = state_backend_raw_load;
backend->save = state_backend_raw_save;
+ backend->of_path = xstrdup(of_path);
backend->path = xstrdup(path);
backend->name = "raw";