From f3895311ef49171b58b5ea1f06942408c8685a1e Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Fri, 22 Jul 2016 15:00:19 +0200 Subject: state: only build circular backend if MTD is enabled 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 Signed-off-by: Sascha Hauer --- common/state/Makefile | 2 +- common/state/backend_storage.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'common/state') diff --git a/common/state/Makefile b/common/state/Makefile index 23f72862b9..3e0e2c6e55 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 c4508a8aba..5dc8c50267 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) { -- cgit v1.2.3