* [PATCH 1/2] state: drop unused code and declarations for non-existing functions
@ 2019-09-11 19:27 Uwe Kleine-König
2019-09-11 19:27 ` [PATCH 2/2] state: provide dummy implementations for some functions when STATE is disabled Uwe Kleine-König
2019-09-12 6:44 ` [PATCH 1/2] state: drop unused code and declarations for non-existing functions Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2019-09-11 19:27 UTC (permalink / raw)
To: barebox
state_get_name() is not used and so can be removed.
state_backend_dtb_file() and state_backend_raw_file() were dropped in
c999b507da98 ("state: Refactor state framework").
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
common/state/state.c | 7 -------
include/state.h | 5 -----
2 files changed, 12 deletions(-)
diff --git a/common/state/state.c b/common/state/state.c
index 3f5d43ecbf73..b168387eef0b 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -714,13 +714,6 @@ struct state *state_by_node(const struct device_node *node)
return NULL;
}
-int state_get_name(const struct state *state, char const **name)
-{
- *name = xstrdup(state->name);
-
- return 0;
-}
-
int state_read_mac(struct state *state, const char *name, u8 *buf)
{
struct state_variable *svar;
diff --git a/include/state.h b/include/state.h
index 4e995a19efe0..a49155ef2779 100644
--- a/include/state.h
+++ b/include/state.h
@@ -5,17 +5,12 @@
struct state;
-int state_backend_dtb_file(struct state *state, const char *of_path,
- const char *path);
-int state_backend_raw_file(struct state *state, const char *of_path,
- const char *path, off_t offset, size_t size);
struct state *state_new_from_node(struct device_node *node, bool readonly);
void state_release(struct state *state);
struct state *state_by_name(const char *name);
struct state *state_by_node(const struct device_node *node);
-int state_get_name(const struct state *state, char const **name);
int state_load_no_auth(struct state *state);
int state_load(struct state *state);
--
2.23.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] state: provide dummy implementations for some functions when STATE is disabled
2019-09-11 19:27 [PATCH 1/2] state: drop unused code and declarations for non-existing functions Uwe Kleine-König
@ 2019-09-11 19:27 ` Uwe Kleine-König
2019-09-12 6:44 ` [PATCH 1/2] state: drop unused code and declarations for non-existing functions Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2019-09-11 19:27 UTC (permalink / raw)
To: barebox
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>
---
arch/arm/boards/phytec-som-am335x/board.c | 14 ++++-----
include/state.h | 36 +++++++++++++++++++++++
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/arch/arm/boards/phytec-som-am335x/board.c b/arch/arm/boards/phytec-som-am335x/board.c
index 441d56348cc7..c25f33ae20d5 100644
--- a/arch/arm/boards/phytec-som-am335x/board.c
+++ b/arch/arm/boards/phytec-som-am335x/board.c
@@ -124,15 +124,11 @@ static int physom_devices_init(void)
ARRAY_SIZE(nandslots));
am33xx_bbu_emmc_mlo_register_handler("MLO.emmc", "/dev/mmc1");
- if (IS_ENABLED(CONFIG_STATE)) {
- state = state_by_name("am335x_phytec_mac_state");
- if (state)
- for (state_i = 0; state_i < 2; state_i++) {
- state_ret = state_read_mac(state,
- eth_names[state_i], &mac[0]);
- if (!state_ret && is_valid_ether_addr(&mac[0]))
- eth_register_ethaddr(state_i, mac);
- }
+ state = state_by_name("am335x_phytec_mac_state");
+ for (state_i = 0; state_i < 2; state_i++) {
+ state_ret = state_read_mac(state, eth_names[state_i], &mac[0]);
+ if (!state_ret && is_valid_ether_addr(&mac[0]))
+ eth_register_ethaddr(state_i, mac);
}
if (IS_ENABLED(CONFIG_PHYTEC_SOM_AM335X_OF_AUTOENABLE)) {
diff --git a/include/state.h b/include/state.h
index a49155ef2779..d98b781c2089 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 */
--
2.23.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] state: drop unused code and declarations for non-existing functions
2019-09-11 19:27 [PATCH 1/2] state: drop unused code and declarations for non-existing functions Uwe Kleine-König
2019-09-11 19:27 ` [PATCH 2/2] state: provide dummy implementations for some functions when STATE is disabled Uwe Kleine-König
@ 2019-09-12 6:44 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2019-09-12 6:44 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: barebox
On Wed, Sep 11, 2019 at 09:27:37PM +0200, Uwe Kleine-König wrote:
> state_get_name() is not used and so can be removed.
> state_backend_dtb_file() and state_backend_raw_file() were dropped in
> c999b507da98 ("state: Refactor state framework").
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> common/state/state.c | 7 -------
> include/state.h | 5 -----
> 2 files changed, 12 deletions(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-12 6:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 19:27 [PATCH 1/2] state: drop unused code and declarations for non-existing functions Uwe Kleine-König
2019-09-11 19:27 ` [PATCH 2/2] state: provide dummy implementations for some functions when STATE is disabled Uwe Kleine-König
2019-09-12 6:44 ` [PATCH 1/2] state: drop unused code and declarations for non-existing functions Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox