mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] state: only build circular backend if MTD is enabled
Date: Fri, 22 Jul 2016 15:00:19 +0200	[thread overview]
Message-ID: <1469192421-15748-1-git-send-email-l.stach@pengutronix.de> (raw)

The circular backend depends on MTD symbols and is only useful
if MTD is present. Exclude it from the build if MTD is not enabled.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 common/state/Makefile          | 2 +-
 common/state/backend_storage.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/state/Makefile b/common/state/Makefile
index 23f72862b995..3e0e2c6e5516 100644
--- a/common/state/Makefile
+++ b/common/state/Makefile
@@ -5,5 +5,5 @@ obj-y += backend_format_dtb.o
 obj-y += backend_format_raw.o
 obj-y += backend_storage.o
 obj-y += backend_bucket_direct.o
-obj-y += backend_bucket_circular.o
+obj-$(CONFIG_MTD) += backend_bucket_circular.o
 obj-y += backend_bucket_cached.o
diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index c4508a8aba67..5dc8c5026733 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -471,7 +471,7 @@ int state_storage_init(struct state_backend_storage *storage,
 		       off_t offset, size_t max_size, uint32_t stridesize,
 		       const char *storagetype)
 {
-	int ret;
+	int ret = -ENODEV;
 	struct mtd_info_user meminfo;
 
 	INIT_LIST_HEAD(&storage->buckets);
@@ -479,7 +479,9 @@ int state_storage_init(struct state_backend_storage *storage,
 	storage->name = storagetype;
 	storage->stridesize = stridesize;
 
-	ret = mtd_get_meminfo(path, &meminfo);
+	if (IS_ENABLED(CONFIG_MTD))
+		ret = mtd_get_meminfo(path, &meminfo);
+
 	if (!ret && !(meminfo.flags & MTD_NO_ERASE)) {
 		bool non_circular = false;
 		if (!storagetype) {
-- 
2.8.1


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

             reply	other threads:[~2016-07-22 13:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 13:00 Lucas Stach [this message]
2016-07-22 13:00 ` [PATCH 2/3] commands: fbtest: select IMAGE_RENDERER Lucas Stach
2016-07-22 13:00 ` [PATCH 3/3] nand: mrvl: don't double cast error pointer Lucas Stach
2016-07-25  8:20   ` Sascha Hauer
2016-07-25  8:27     ` 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=1469192421-15748-1-git-send-email-l.stach@pengutronix.de \
    --to=l.stach@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