summaryrefslogtreecommitdiffstats
path: root/include/state.h
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2019-09-11 21:27:38 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-14 12:52:10 +0200
commit9bbaa740f6a86f04a27b5ed79ed7d6697123eae5 (patch)
treea688d3e428d924e72559c7cad97c168c6fbd19ac /include/state.h
parenta672ca37ab530c3d8c88144ebcd9cb51b8cd9739 (diff)
downloadbarebox-9bbaa740f6a86f04a27b5ed79ed7d6697123eae5.tar.gz
barebox-9bbaa740f6a86f04a27b5ed79ed7d6697123eae5.tar.xz
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>
Diffstat (limited to 'include/state.h')
-rw-r--r--include/state.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/state.h b/include/state.h
index a49155ef27..d98b781c20 100644
--- a/include/state.h
+++ b/include/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 */