From b6a35329fe07bc4e4d34506d541853c076692140 Mon Sep 17 00:00:00 2001 From: Juergen Borleis Date: Tue, 15 Aug 2017 15:46:35 +0200 Subject: state: add debugging help While working on the state documentation it turns out to be helpful to have more debug messages while a developer implements a 'state' variable set and tries to configure it correctly. Signed-off-by: Juergen Borleis Signed-off-by: Sascha Hauer --- common/state/backend_storage.c | 7 ++++++- common/state/state.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'common/state') diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c index d6e7adcf55..2e2478cb6f 100644 --- a/common/state/backend_storage.c +++ b/common/state/backend_storage.c @@ -146,6 +146,7 @@ int state_storage_read(struct state_backend_storage *storage, struct state_backend_storage_bucket *bucket, *bucket_used = NULL; int ret; + dev_dbg(storage->dev, "Checking redundant buckets...\n"); /* * Iterate over all buckets. The first valid one we find is the * one we want to use. @@ -164,8 +165,12 @@ int state_storage_read(struct state_backend_storage *storage, ret = format->verify(format, magic, bucket->buf, &bucket->len, flags); if (!ret && !bucket_used) bucket_used = bucket; + if (ret) + dev_info(storage->dev, "Ignoring broken bucket %d@0x%08lx...\n", bucket->num, bucket->offset); } + dev_dbg(storage->dev, "Checking redundant buckets finished.\n"); + if (!bucket_used) { dev_err(storage->dev, "Failed to find any valid state copy in any bucket\n"); @@ -386,7 +391,7 @@ int state_storage_init(struct state *state, const char *path, dev_warn(storage->dev, "using old format circular storage type.\n"); circular = false; } else { - dev_warn(storage->dev, "unknown storage type '%s'\n", storagetype); + dev_dbg(storage->dev, "unknown storage type '%s'\n", storagetype); return -EINVAL; } return state_storage_mtd_buckets_init(storage, &meminfo, circular); diff --git a/common/state/state.c b/common/state/state.c index 121ba0c6d3..18ffbe29a4 100644 --- a/common/state/state.c +++ b/common/state/state.c @@ -608,11 +608,13 @@ struct state *state_new_from_node(struct device_node *node, char *path, ret = of_property_read_string(node, "backend-type", &backend_type); if (ret) { + dev_dbg(&state->dev, "Missing 'backend-type' property\n"); goto out_release_state; } ret = of_property_read_u32(node, "backend-stridesize", &stridesize); if (ret) { + dev_dbg(&state->dev, "'backend-stridesize' property undefined, trying to continue without\n"); stridesize = 0; } -- cgit v1.2.3