mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Borleis <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 6/7] state: add debugging help
Date: Tue, 15 Aug 2017 15:46:35 +0200	[thread overview]
Message-ID: <20170815134636.21236-7-jbe@pengutronix.de> (raw)
In-Reply-To: <20170815134636.21236-1-jbe@pengutronix.de>

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 <jbe@pengutronix.de>
---
 common/state/backend_storage.c | 7 ++++++-
 common/state/state.c           | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index d6e7adcf5..2e2478cb6 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 121ba0c6d..18ffbe29a 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;
 	}
 
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-08-15 13:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 13:46 Rework of the state/bootchooser feature documentaiton Juergen Borleis
2017-08-15 13:46 ` [PATCH 1/7] docs/DS1307: fix layout Juergen Borleis
2017-08-15 13:46 ` [PATCH 2/7] state: keep backward compatibility Juergen Borleis
2017-08-15 13:46 ` [PATCH 3/7] bootchooser: avoid a use after free Juergen Borleis
2017-08-15 13:46 ` [PATCH 4/7] bootchooser: allow an empty namespace Juergen Borleis
2017-08-15 13:46 ` [PATCH 5/7] docs: remove build warning Juergen Borleis
2017-08-15 13:46 ` Juergen Borleis [this message]
2017-08-15 13:46 ` [PATCH 7/7] docs: rework and extend the 'state' and 'bootchooser' documentation Juergen Borleis
2017-09-06 12:19 ` Rework of the state/bootchooser feature documentaiton Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170815134636.21236-7-jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox