diff --git a/arch/arm/boards/phytec-som-am335x/board.c b/arch/arm/boards/phytec-som-am335x/board.c index 441d563..c25f33a 100644 --- a/arch/arm/boards/phytec-som-am335x/board.c +++ b/arch/arm/boards/phytec-som-am335x/board.c @@ -124,15 +124,11 @@ 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 a49155e..d98b781 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 @@ 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 */