summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Ölmann <u.oelmann@pengutronix.de>2018-12-18 14:57:46 +0100
committerRoland Hieber <rhi@pengutronix.de>2019-01-07 12:26:50 +0100
commit5562d51ae4b2ed0f7a660b65593c32fede3e6ca3 (patch)
tree2b4d3a362aa61796d5a5e743eba203090d32fbaf
parent13fe6c4bb08209f43616b9233b742335254f3edd (diff)
downloaddt-utils-5562d51ae4b2ed0f7a660b65593c32fede3e6ca3.tar.gz
dt-utils-5562d51ae4b2ed0f7a660b65593c32fede3e6ca3.tar.xz
state: use the given backend storage type name
This ports the following barebox commit: | commit 84ec1554e2a7b80202c01d6e04201bd5ea986cb7 | Author: Juergen Borleis <jbe@pengutronix.de> | Date: Thu Aug 17 11:32:32 2017 +0200 | | state: use the given backend storage type name | | Change 119f92b27e131a0cb506fe8d8bffe8010fb14a3d already tried to fix it, but | forgets the 'direct' usecase. | | The 'backend-storage-type' node is optional. Its default depends on the | capability of the used backend memory, which means "circular" or NULL. | The latter defaults to 'direct' in the routines. | If it is NULL, the devicetree fixup routine skips exporting a | 'backend-storage-type' node to the kernel's devicetree. | | But currently if the 'backend-storage-type' node is explicitly given as | 'direct', it will be skipped silently and set to NULL instead. In this | case the user of the 'barebox-state' tool then ends up with the warning: | | "No backend-storage-type found, using default" | | which is annoying, because it was given. | | Storing the given value will still use a NULL if the | 'backend-storage-type' node isn't defined, but stores everything else if | it is defined. Then the 'backend-storage-type' node is present in the | kernel's devicetree as well. | | Signed-off-by: Juergen Borleis <jbe@pengutronix.de> | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
-rw-r--r--src/barebox-state/backend_storage.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/barebox-state/backend_storage.c b/src/barebox-state/backend_storage.c
index b36c956..0ac28c6 100644
--- a/src/barebox-state/backend_storage.c
+++ b/src/barebox-state/backend_storage.c
@@ -357,11 +357,12 @@ static int state_storage_file_buckets_init(struct state_backend_storage *storage
* @param dev_offset Offset in the device to start writing at.
* @param max_size Maximum size of the data. May be 0 for infinite.
* @param stridesize Distance between two copies of the data. Not relevant for MTD
- * @param storagetype Type of the storage backend. This may be NULL where we
- * autoselect some backwardscompatible backend options
+ * @param storagetype Type of the storage backend. May be NULL for autoselection.
* @return 0 on success, -errno otherwise
*
- * Depending on the filetype, we create mtd buckets or normal file buckets.
+ * If the backend memory needs to be erased prior a write, the @b storagetype
+ * defaults to 'circular' storage backend type, for backend memories like RAMs
+ * or EEPROMs @b storagetype defaults to the 'direct' storage backend type.
*/
int state_storage_init(struct state *state, const char *path,
off_t offset, size_t max_size, uint32_t stridesize,
@@ -373,6 +374,7 @@ int state_storage_init(struct state *state, const char *path,
INIT_LIST_HEAD(&storage->buckets);
storage->dev = &state->dev;
+ storage->name = storagetype;
storage->stridesize = stridesize;
storage->offset = offset;
storage->max_size = max_size;
@@ -385,7 +387,6 @@ int state_storage_init(struct state *state, const char *path,
storage->name = "circular";
circular = true;
} else if (!strcmp(storagetype, "noncircular")) {
- storage->name = "noncircular";
dev_warn(storage->dev, "using old format circular storage type.\n");
circular = false;
} else {