From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Pengutronix Public Open-Source-Development <oss-tools@pengutronix.de>
Cc: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
Subject: [OSS-Tools] [PATCH dt-utils 11/13] state: harmonize code with barebox
Date: Mon, 30 Sep 2019 09:26:11 +0200 [thread overview]
Message-ID: <20190930072613.17956-12-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20190930072613.17956-1-u.oelmann@pengutronix.de>
This ports the following barebox commit:
| commit cdbeddf62b7a01f09f00e0fe94430789f4b0b05e
| Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
| Date: Wed Sep 11 21:27:38 2019 +0200
|
| state: provide dummy implementations for some functions when STATE is
| disabled
|
| This allows to simplify some callers as can be seen from the
| phytec-som-am335x/board.c change. (The check for state != NULL could be
| dropped already before.)
|
| Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
configure.ac | 2 ++
src/state.h | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/configure.ac b/configure.ac
index 30332620190d..c2486af9436f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,6 +43,8 @@ AS_IF([test "x${enable_state_backward_compatibility}" = "xyes"], [
AC_DEFINE(CONFIG_MTD, [1], [Statically define to be enabled to harmonize barebox' & dt-utils' code base.])
+AC_DEFINE(CONFIG_STATE, [1], [Statically define to be enabled to harmonize barebox' & dt-utils' code base.])
+
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
my_CFLAGS="-Wall \
diff --git a/src/state.h b/src/state.h
index a49155ef2779..d98b781c2089 100644
--- a/src/state.h
+++ b/src/state.h
@@ -5,6 +5,7 @@
struct state;
+#if IS_ENABLED(CONFIG_STATE)
struct state *state_new_from_node(struct device_node *node, bool readonly);
void state_release(struct state *state);
@@ -19,4 +20,39 @@ void state_info(void);
int state_read_mac(struct state *state, const char *name, u8 *buf);
+#else /* #if IS_ENABLED(CONFIG_STATE) */
+
+static inline struct state *state_new_from_node(struct device_node *node,
+ bool readonly)
+{
+ return ERR_PTR(-ENOSYS);
+}
+
+static inline struct state *state_by_name(const char *name)
+{
+ return NULL;
+}
+
+static inline struct state *state_by_node(const struct device_node *node)
+{
+ return NULL;
+};
+
+static inline int state_load(struct state *state)
+{
+ return -ENOSYS;
+}
+
+static inline int state_save(struct state *state)
+{
+ return -ENOSYS;
+}
+
+static inline int state_read_mac(struct state *state, const char *name, u8 *buf)
+{
+ return -ENOSYS;
+}
+
+#endif /* #if IS_ENABLED(CONFIG_STATE) / #else */
+
#endif /* __STATE_H */
--
2.23.0
_______________________________________________
OSS-Tools mailing list
OSS-Tools@pengutronix.de
next prev parent reply other threads:[~2019-09-30 7:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-30 7:26 [OSS-Tools] [PATCH dt-utils 00/13] Harmonize dt-utils' and barebox' shared code base Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 01/13] state: Fix lseek error check in state_backend_bucket_direct_read() Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 02/13] state: Fix lseek error check in state_backend_bucket_direct_write() Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 03/13] state: Fix lseek error check in state_mtd_peb_read() Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 04/13] state: Fix lseek error check in state_mtd_peb_write() Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 05/13] state: check length Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 06/13] state: backend_bucket_circular: mark block as bad if mtd_peb_torture() failed Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 07/13] state: drop unused code and declarations for non-existing functions Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 08/13] state: keep backward compatibility Ulrich Ölmann
2019-10-22 9:46 ` Roland Hieber
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 09/13] state: backend_storage: harmonize code with barebox Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 10/13] state: " Ulrich Ölmann
2019-09-30 7:26 ` Ulrich Ölmann [this message]
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 12/13] configure: remove build time option '--disable-logging' Ulrich Ölmann
2019-09-30 7:26 ` [OSS-Tools] [PATCH dt-utils 13/13] configure: remove build time option '--enable-debug' Ulrich Ölmann
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=20190930072613.17956-12-u.oelmann@pengutronix.de \
--to=u.oelmann@pengutronix.de \
--cc=oss-tools@pengutronix.de \
/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